mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 19:23:26 +00:00
no message
This commit is contained in:
parent
18d57a41c4
commit
0c9b553591
@ -52,18 +52,18 @@ class IndexController extends InvokeController
|
|||||||
*/
|
*/
|
||||||
public function main()
|
public function main()
|
||||||
{
|
{
|
||||||
$scripts = [];
|
|
||||||
if (config('app.debug')) {
|
if (config('app.debug')) {
|
||||||
$src = preg_replace("/^(\/\/(.*?))(:\d+)?\//i", "$1:" . env("APP_DEV_PORT") . "/", asset_main("resources/assets/js/app.js"));
|
$style = null;
|
||||||
$scripts[] = "<script type=\"module\" src=\"{$src}\"></script>";
|
$script = preg_replace("/^(\/\/(.*?))(:\d+)?\//i", "$1:" . env("APP_DEV_PORT") . "/", asset_main("resources/assets/js/app.js"));
|
||||||
} else {
|
} else {
|
||||||
$array = Base::json2array(file_get_contents(public_path('manifest.json')));
|
$array = Base::json2array(file_get_contents(public_path('manifest.json')));
|
||||||
$scripts[] = "<link rel=\"stylesheet\" href=\"" . asset_main($array['resources/assets/js/app.js']['css'][0]) . "\"/>";
|
$style = asset_main($array['resources/assets/js/app.js']['css'][0]);
|
||||||
$scripts[] = "<script type=\"module\" src=\"" . asset_main($array['resources/assets/js/app.js']['file']) . "\"></script>";
|
$script = asset_main($array['resources/assets/js/app.js']['file']);
|
||||||
}
|
}
|
||||||
return response()->view('main', [
|
return response()->view('main', [
|
||||||
'version' => Base::getVersion(),
|
'version' => Base::getVersion(),
|
||||||
'script' => implode("\n", $scripts),
|
'style' => $style,
|
||||||
|
'script' => $script,
|
||||||
])->header('Link', "<" . url('manifest.txt') . ">; rel=\"prefetch\"");
|
])->header('Link', "<" . url('manifest.txt') . ">; rel=\"prefetch\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
42
cmd
42
cmd
@ -41,10 +41,15 @@ rand_string() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
supervisorctl_restart() {
|
restart_php() {
|
||||||
local RES=`run_exec php "supervisorctl update $1"`
|
local RES=`run_exec php "supervisorctl update php"`
|
||||||
if [ -z "$RES" ]; then
|
if [ -z "$RES" ]; then
|
||||||
run_exec php "supervisorctl restart $1"
|
RES=`run_exec php "supervisorctl restart php"`
|
||||||
|
fi
|
||||||
|
local IN=`echo $RES | grep "ERROR"`
|
||||||
|
if [[ "$IN" != "" ]]; then
|
||||||
|
$COMPOSE stop php
|
||||||
|
$COMPOSE start php
|
||||||
else
|
else
|
||||||
echo -e "$RES"
|
echo -e "$RES"
|
||||||
fi
|
fi
|
||||||
@ -95,13 +100,13 @@ run_compile() {
|
|||||||
env_set APP_DEV_PORT $(rand 20001 30000)
|
env_set APP_DEV_PORT $(rand 20001 30000)
|
||||||
fi
|
fi
|
||||||
run_exec php "php bin/run --mode=$type"
|
run_exec php "php bin/run --mode=$type"
|
||||||
supervisorctl_restart php
|
restart_php
|
||||||
#
|
#
|
||||||
if [ "$type" = "prod" ]; then
|
if [ "$type" = "prod" ]; then
|
||||||
rm -rf "./public/js/build"
|
rm -rf "./public/js/build"
|
||||||
npx vite build
|
npx vite build -- fromcmd
|
||||||
else
|
else
|
||||||
npx vite
|
npx vite -- fromcmd
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,18 +125,17 @@ run_electron() {
|
|||||||
if [ -d "./electron/dist" ]; then
|
if [ -d "./electron/dist" ]; then
|
||||||
rm -rf "./electron/dist"
|
rm -rf "./electron/dist"
|
||||||
fi
|
fi
|
||||||
if [ -d "./electron/public" ] && [ "$argv" != "--nobuild" ]; then
|
if [ -d "./electron/public" ]; then
|
||||||
rm -rf "./electron/public"
|
rm -rf "./electron/public"
|
||||||
fi
|
fi
|
||||||
mkdir -p ./electron/public
|
|
||||||
cp ./electron/index.html ./electron/public/index.html
|
|
||||||
#
|
#
|
||||||
if [ "$argv" != "dev" ] && [ "$argv" != "--nobuild" ]; then
|
|
||||||
npx vite build -- --env --electron
|
|
||||||
fi
|
|
||||||
if [ "$argv" == "dev" ]; then
|
if [ "$argv" == "dev" ]; then
|
||||||
run_exec php "php bin/run --mode=$argv"
|
run_exec php "php bin/run --mode=$argv"
|
||||||
supervisorctl_restart php
|
restart_php
|
||||||
|
else
|
||||||
|
mkdir -p ./electron/public
|
||||||
|
cp ./electron/index.html ./electron/public/index.html
|
||||||
|
npx vite build -- fromcmd electron
|
||||||
fi
|
fi
|
||||||
node ./electron/build.js $argv
|
node ./electron/build.js $argv
|
||||||
}
|
}
|
||||||
@ -304,7 +308,7 @@ if [ $# -gt 0 ]; then
|
|||||||
# 设置初始化密码
|
# 设置初始化密码
|
||||||
res=`run_exec mariadb "sh /etc/mysql/repassword.sh"`
|
res=`run_exec mariadb "sh /etc/mysql/repassword.sh"`
|
||||||
$COMPOSE up -d
|
$COMPOSE up -d
|
||||||
supervisorctl_restart php
|
restart_php
|
||||||
echo -e "${OK} ${GreenBG} 安装完成 ${Font}"
|
echo -e "${OK} ${GreenBG} 安装完成 ${Font}"
|
||||||
echo -e "地址: http://${GreenBG}127.0.0.1:$(env_get APP_PORT)${Font}"
|
echo -e "地址: http://${GreenBG}127.0.0.1:$(env_get APP_PORT)${Font}"
|
||||||
echo -e "$res"
|
echo -e "$res"
|
||||||
@ -316,7 +320,7 @@ if [ $# -gt 0 ]; then
|
|||||||
git pull
|
git pull
|
||||||
run_exec php "composer update"
|
run_exec php "composer update"
|
||||||
run_exec php "php artisan migrate"
|
run_exec php "php artisan migrate"
|
||||||
supervisorctl_restart php
|
restart_php
|
||||||
$COMPOSE up -d
|
$COMPOSE up -d
|
||||||
elif [[ "$1" == "uninstall" ]]; then
|
elif [[ "$1" == "uninstall" ]]; then
|
||||||
shift 1
|
shift 1
|
||||||
@ -350,14 +354,14 @@ if [ $# -gt 0 ]; then
|
|||||||
elif [[ "$1" == "url" ]]; then
|
elif [[ "$1" == "url" ]]; then
|
||||||
shift 1
|
shift 1
|
||||||
env_set APP_URL "$1"
|
env_set APP_URL "$1"
|
||||||
supervisorctl_restart php
|
restart_php
|
||||||
echo -e "${OK} ${GreenBG} 修改成功 ${Font}"
|
echo -e "${OK} ${GreenBG} 修改成功 ${Font}"
|
||||||
elif [[ "$1" == "env" ]]; then
|
elif [[ "$1" == "env" ]]; then
|
||||||
shift 1
|
shift 1
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
env_set $1 "$2"
|
env_set $1 "$2"
|
||||||
fi
|
fi
|
||||||
supervisorctl_restart php
|
restart_php
|
||||||
echo -e "${OK} ${GreenBG} 修改成功 ${Font}"
|
echo -e "${OK} ${GreenBG} 修改成功 ${Font}"
|
||||||
elif [[ "$1" == "repassword" ]]; then
|
elif [[ "$1" == "repassword" ]]; then
|
||||||
shift 1
|
shift 1
|
||||||
@ -385,7 +389,7 @@ if [ $# -gt 0 ]; then
|
|||||||
else
|
else
|
||||||
env_set APP_DEBUG "true"
|
env_set APP_DEBUG "true"
|
||||||
fi
|
fi
|
||||||
supervisorctl_restart php
|
restart_php
|
||||||
elif [[ "$1" == "https" ]]; then
|
elif [[ "$1" == "https" ]]; then
|
||||||
shift 1
|
shift 1
|
||||||
if [[ "$@" == "auto" ]]; then
|
if [[ "$@" == "auto" ]]; then
|
||||||
@ -393,7 +397,7 @@ if [ $# -gt 0 ]; then
|
|||||||
else
|
else
|
||||||
env_set APP_SCHEME "true"
|
env_set APP_SCHEME "true"
|
||||||
fi
|
fi
|
||||||
supervisorctl_restart php
|
restart_php
|
||||||
elif [[ "$1" == "artisan" ]]; then
|
elif [[ "$1" == "artisan" ]]; then
|
||||||
shift 1
|
shift 1
|
||||||
e="php artisan $@" && run_exec php "$e"
|
e="php artisan $@" && run_exec php "$e"
|
||||||
|
|||||||
@ -11,12 +11,24 @@
|
|||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
<title>{{ config('app.name', 'WebPage') }}</title>
|
<title>{{ config('app.name', 'WebPage') }}</title>
|
||||||
<link rel="shortcut icon" href="{{ asset_main('favicon.ico') }}">
|
<link rel="shortcut icon" href="{{ asset_main('favicon.ico') }}">
|
||||||
|
@if($style)
|
||||||
|
<link rel="stylesheet" type="text/css" href="{{ $style }}">
|
||||||
|
@endif
|
||||||
<link rel="stylesheet" type="text/css" href="{{ asset_main('css/iview.css') }}?v={{ $version }}">
|
<link rel="stylesheet" type="text/css" href="{{ asset_main('css/iview.css') }}?v={{ $version }}">
|
||||||
<link rel="stylesheet" type="text/css" href="{{ asset_main('css/loading.css') }}?v={{ $version }}">
|
<link rel="stylesheet" type="text/css" href="{{ asset_main('css/loading.css') }}?v={{ $version }}">
|
||||||
<script src="{{ asset_main('js/scroll-into-view.min.js') }}?v={{ $version }}"></script>
|
<script src="{{ asset_main('js/scroll-into-view.min.js') }}?v={{ $version }}"></script>
|
||||||
<script>
|
<script>
|
||||||
window.csrfToken = { csrfToken : "{{ csrf_token() }}" };
|
window.csrfToken = {
|
||||||
window.systemInfo = { title: "{{config('app.name', 'WebPage')}}", debug: "{{config('app.debug') ? 'yes' : 'no'}}", version : "{{ $version }}", origin: window.location.origin + "/", homeUrl: null, apiUrl: null };
|
csrfToken: "{{ csrf_token() }}"
|
||||||
|
};
|
||||||
|
window.systemInfo = {
|
||||||
|
title: "{{config('app.name', 'WebPage')}}",
|
||||||
|
debug: "{{config('app.debug') ? 'yes' : 'no'}}",
|
||||||
|
version: "{{ $version }}",
|
||||||
|
origin: window.location.origin + "/",
|
||||||
|
homeUrl: null,
|
||||||
|
apiUrl: null
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -37,7 +49,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!! $script !!}
|
<script type="module" src="{{$script}}"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
9
vite.config.js
vendored
9
vite.config.js
vendored
@ -1,13 +1,20 @@
|
|||||||
import {resolve} from "path";
|
import {resolve} from "path";
|
||||||
|
import {spawnSync} from "child_process";
|
||||||
import {defineConfig, loadEnv} from 'vite'
|
import {defineConfig, loadEnv} from 'vite'
|
||||||
import {createVuePlugin} from 'vite-plugin-vue2';
|
import {createVuePlugin} from 'vite-plugin-vue2';
|
||||||
import vitePluginRequire from 'vite-plugin-require'
|
import vitePluginRequire from 'vite-plugin-require'
|
||||||
import vitePluginFileCopy from 'vite-plugin-file-copy';
|
import vitePluginFileCopy from 'vite-plugin-file-copy';
|
||||||
|
|
||||||
const argv = process.argv;
|
const argv = process.argv;
|
||||||
const isElectron = argv.includes('--electron');
|
const isCmd = argv.includes('fromcmd');
|
||||||
|
const isElectron = argv.includes('electron');
|
||||||
const publicPath = isElectron ? 'electron/public' : 'public';
|
const publicPath = isElectron ? 'electron/public' : 'public';
|
||||||
|
|
||||||
|
if (!isCmd) {
|
||||||
|
spawnSync("npx", [resolve(__dirname, 'cmd'), argv.includes("build") ? "build" : "dev"], {stdio: "inherit"});
|
||||||
|
process.exit()
|
||||||
|
}
|
||||||
|
|
||||||
export default defineConfig(({command, mode}) => {
|
export default defineConfig(({command, mode}) => {
|
||||||
const env = loadEnv(mode, process.cwd(), '')
|
const env = loadEnv(mode, process.cwd(), '')
|
||||||
const host = "0.0.0.0"
|
const host = "0.0.0.0"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user