diff --git a/.env.docker b/.env.docker
index 50370288d..1ce4ffe06 100644
--- a/.env.docker
+++ b/.env.docker
@@ -8,6 +8,7 @@ APP_URL=http://localhost
APP_ID=
APP_IPPR=
APP_PORT=2222
+APP_DEV_PORT=
LOG_CHANNEL=stack
LOG_LEVEL=debug
diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php
index fd0afaebb..5a7992786 100755
--- a/app/Http/Controllers/IndexController.php
+++ b/app/Http/Controllers/IndexController.php
@@ -52,19 +52,19 @@ class IndexController extends InvokeController
*/
public function main()
{
- $hash = 'no';
- $path = public_path('js/hash');
- $murl = url('manifest.txt');
- if (file_exists($path)) {
- $hash = trim(file_get_contents(public_path('js/hash')));
- if (strlen($hash) > 16) {
- $hash = 'long';
- }
+ $scripts = [];
+ if (config('app.debug')) {
+ $port = env("APP_DEV_PORT");
+ $scripts[] = "";
+ } else {
+ $manifest = Base::json2array(file_get_contents(public_path('manifest.json')));
+ $scripts[] = "";
+ $scripts[] = "";
}
return response()->view('main', [
'version' => Base::getVersion(),
- 'hash' => $hash
- ])->header('Link', "<{$murl}>; rel=\"prefetch\"");
+ 'script' => implode("\n", $scripts),
+ ])->header('Link', "<" . url('manifest.txt') . ">; rel=\"prefetch\"");
}
/**
diff --git a/cmd b/cmd
index 6bfac7817..4d9341f46 100755
--- a/cmd
+++ b/cmd
@@ -99,6 +99,9 @@ run_compile() {
if [ ! -d "./node_modules" ]; then
npm install
fi
+ if [ "$type" = "dev" ]; then
+ env_set APP_DEV_PORT $(rand 20001 30000)
+ fi
run_exec php "php bin/run --mode=$type"
supervisorctl_restart php
#
diff --git a/resources/views/main.blade.php b/resources/views/main.blade.php
index ae0ad8990..61464ca26 100755
--- a/resources/views/main.blade.php
+++ b/resources/views/main.blade.php
@@ -37,19 +37,7 @@
-@php
- if (config('app.debug')) {
- echo ' ';
- }else{
- $manifest = json_decode(file_get_contents(public_path('manifest.json')), true);
- $css = $manifest['resources/assets/js/app.js']['css'][0];
- $css2 = $manifest['resources/assets/js/pages/manage/calendar.vue']['css'][0];
- $js = $manifest['resources/assets/js/app.js']['file'];
- echo ' ';
- echo ' ';
- echo ' ';
- }
-@endphp
+{!! $script !!}