Skip to content

Commit

Permalink
Update dashboard to load scripts directly from Phar
Browse files Browse the repository at this point in the history
Update dashboard to inject scripts directly from archive when running in Phar
  • Loading branch information
caendesilva committed Dec 12, 2023
1 parent f2350e3 commit 628b628
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/realtime-compiler/src/Http/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Hyde\Pages\MarkdownPost;
use Desilva\Microserve\Request;
use Desilva\Microserve\Response;
use Hyde\Foundation\PharSupport;
use Hyde\Pages\Concerns\HydePage;
use Hyde\Pages\DocumentationPage;
use Hyde\Support\Models\RouteKey;
Expand Down Expand Up @@ -261,7 +262,11 @@ public function isInteractive(): bool

public function getScripts(): string
{
return file_get_contents(__DIR__.'/../../resources/dashboard.js');
if (PharSupport::running()) {
return file_get_contents('phar://hyde.phar/vendor/hyde/realtime-compiler/resources/dashboard.js');
}

return file_get_contents(Hyde::vendorPath('resources/dashboard.js', 'realtime-compiler'));
}

public function getFlash(string $key, $default = null): ?string
Expand Down

0 comments on commit 628b628

Please sign in to comment.