Skip to content

Commit

Permalink
Fix again......
Browse files Browse the repository at this point in the history
  • Loading branch information
DellZHackintosh authored Jul 2, 2024
1 parent 273a398 commit 73f8d28
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Forum/Controller/ServiceWorkerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,10 @@
use Psr\Http\Server\RequestHandlerInterface;
use Flarum\Settings\SettingsRepositoryInterface;

$settings = resolve(SettingsRepositoryInterface::class);
$offlinePath = $settings->get('askvortsov-pwa.customOfflinePage', 'offline');
$timestamp = '// Generated on ' . date("Y-m-d H:i:s") . PHP_EOL;
$offlineVar = 'const offlineFallbackPage = "' . $offlinePath . '";' . PHP_EOL;

class ServiceWorkerController implements RequestHandlerInterface
{
use PWATrait;
use Askvortsov\FlarumPWA\Forum\Controller;

protected Filesystem $assetDir;

Expand All @@ -43,6 +38,11 @@ public function __construct(Factory $filesystemFactory)
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
$settings = resolve(SettingsRepositoryInterface::class);
$offlinePath = $settings->get('askvortsov-pwa.customOfflinePage', 'offline');
$timestamp = '// Generated on ' . date("Y-m-d H:i:s") . PHP_EOL;
$offlineVar = 'const offlineFallbackPage = "' . $offlinePath . '";' . PHP_EOL;

return new TextResponse($timestamp . $offlineVar . $this->assetDir->get('extensions/askvortsov-pwa/sw.js'), 200, ['content-type' => 'text/javascript; charset=utf-8']);
}
}

0 comments on commit 73f8d28

Please sign in to comment.