Skip to content

Commit 433037d

Browse files
committed
Send bust along with the request, use it to calculate hash as well.
1 parent 1f6a710 commit 433037d

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

config/torchlight.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
return [
44
'cache' => env('TORCHLIGHT_CACHE_DRIVER', 'default'),
55

6+
'bust' => 1,
7+
68
'theme' => 'material-theme-palenight',
79

810
'token' => env('TORCHLIGHT_TOKEN'),

src/Block.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ public function id()
5151
*/
5252
public function hash()
5353
{
54-
return md5($this->language . $this->theme . $this->code);
54+
return md5(
55+
$this->language .
56+
$this->theme .
57+
$this->code .
58+
config('torchlight.bust', 1)
59+
);
5560
}
5661

5762
/**

src/Client.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ protected function request(Collection $blocks)
4141
$response = Http::timeout(10)
4242
->withToken(config('torchlight.token'))
4343
->post('https://torchlight.dev/api/highlight', [
44+
'bust' => config('torchlight.bust', 1),
4445
'blocks' => $this->blocksAsRequestParam($blocks)->values(),
4546
])
4647
->json();

0 commit comments

Comments
 (0)