diff options
author | Sam Light <samlight1994@gmail.com> | 2022-09-06 12:28:29 +0100 |
---|---|---|
committer | Sam Light <samlight1994@gmail.com> | 2022-09-06 12:28:29 +0100 |
commit | 516cf804367366a4c0c237e6b8f4829d899c85f9 (patch) | |
tree | dbcf37990a81a7e0ab5ec8bb06fb76337b6284c6 /src | |
parent | 04ef34a320e568175bca98a86a7bdb6aeaa9520c (diff) |
Cache bust javascript file
Diffstat (limited to 'src')
-rw-r--r-- | src/Http/Controllers/ScormPlayerController.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/Http/Controllers/ScormPlayerController.php b/src/Http/Controllers/ScormPlayerController.php index 34a5967..7c801c9 100644 --- a/src/Http/Controllers/ScormPlayerController.php +++ b/src/Http/Controllers/ScormPlayerController.php @@ -21,6 +21,8 @@ use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; class ScormPlayerController extends Controller { + private const JS_PATH = __DIR__ . '/../../../dist/js/scorm_player.js'; + public function player(Request $request, Scorm $module) { $sco = $request->query('sco'); @@ -33,9 +35,14 @@ class ScormPlayerController extends Controller ], ]; + $js_uri = route('scorm-player.javascript', [ + 'version' => substr(md5(filemtime(self::JS_PATH)), 10, 8) + ]); + return view('scorm-player::player', compact( 'sco', - 'scorm_api_data' + 'scorm_api_data', + 'js_uri' )); } @@ -101,4 +108,13 @@ class ScormPlayerController extends Controller ]; } + public function jsSource(Request $request) + { + return response()->file(self::JS_PATH, [ + 'Content-Type' => 'application/javascript', + //'Cache-Control' => $cacheControl, + //'ETag' => $etag, + ]); + } + } |