@@ -70,7 +70,7 @@ const OperatingSystemTranslated = computed(() => {
7070 ])
7171})
7272
73- const generateScript = (hostname : string , port : string , token : string , webrtcIP : string , webrtcPort : string , webrtcUsername : string , webrtcPassword : string ) => {
73+ const generateScript = (hostname : string , port : string , token : string , webrtcIP : string , webrtcPort : string , webrtcUsername : string , webrtcPassword : string , webUIURL : string ) => {
7474 if (state .operatingSystem === OperatingSystemEnum .GL_KVM ) {
7575 return ` #!/bin/sh
7676
@@ -81,15 +81,25 @@ WEBRTC_IP="${webrtcIP}"
8181WEBRTC_PORT="${webrtcPort }"
8282WEBRTC_USERNAME="${webrtcUsername }"
8383WEBRTC_PASSWORD="${webrtcPassword }"
84+ WEBUI_URL="${webUIURL }"
8485
8586TARGET_DIR="/etc/kvmd/user/scripts"
8687SCRIPT_FILE="$TARGET_DIR/S01selfCloud"
8788WATCHDOG_SCRIPT="$TARGET_DIR/rtty-loop.sh"
89+ CLOUD_CONFIG="/etc/kvmd/user/selfhost-cloud.json"
8890
8991# 1. Create directory
9092mkdir -p "$TARGET_DIR"
9193
92- # 2. Write S01selfCloud script
94+ # 2. Write selfhost cloud config JSON
95+ cat <<CLOUDCFG > "$CLOUD_CONFIG"
96+ {
97+ "webui_url": "$WEBUI_URL",
98+ "updated_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
99+ }
100+ CLOUDCFG
101+
102+ # 3. Write S01selfCloud script
93103cat <<'EOF' > "$SCRIPT_FILE"
94104#!/bin/sh
95105
@@ -181,10 +191,10 @@ esac
181191exit 0
182192EOF
183193
184- # 3 . Add execution permissions
194+ # 4 . Add execution permissions
185195chmod +x "$SCRIPT_FILE"
186196
187- # 4 . Execute restart once
197+ # 5 . Execute restart once
188198"$SCRIPT_FILE" restart
189199
190200`
@@ -202,8 +212,8 @@ chmod +x "$SCRIPT_FILE"
202212
203213/** 组装脚本 */
204214const handleGenerateScript = () => {
205- const { hostname, port, token, webrtcIP, webrtcPort, webrtcUsername, webrtcPassword } = state .scriptData as any
206- state .scriptContent = generateScript (hostname , port , token , webrtcIP , webrtcPort , webrtcUsername , webrtcPassword )
215+ const { hostname, port, token, webrtcIP, webrtcPort, webrtcUsername, webrtcPassword, webUIURL } = state .scriptData as any
216+ state .scriptContent = generateScript (hostname , port , token , webrtcIP , webrtcPort , webrtcUsername , webrtcPassword , webUIURL )
207217}
208218
209219/** 复制脚本 */
0 commit comments