diff --git a/src/routes/setting/config/Vocespace.tsx b/src/routes/setting/config/Vocespace.tsx index 6c2f2a69..a48bb6b5 100644 --- a/src/routes/setting/config/Vocespace.tsx +++ b/src/routes/setting/config/Vocespace.tsx @@ -33,10 +33,16 @@ export function ConfigVocespace() { const handleUpdate = async () => { const _values = values as VocespaceConfig; + if (_values.url.trim() === "" && _values.enabled) { alert("Custom domain is required when enabling Vocespace."); return; } + + if (!_values.server_type) { + _values.server_type = "vps"; + } + // 后端快速返回结果,只要检测环境可以执行就立即返回成功,不然会一直pending等待,导致前端超时 const res = await updateConfig(_values); @@ -50,7 +56,11 @@ export function ConfigVocespace() { } else { // 生成 sh文件让用户下载 const el = document.createElement("a"); - const file = new Blob([data as unknown as string], { type: "text/plain" }); + let shell = (data as unknown as string) + .replaceAll("{{", "{") + .replaceAll("}}", "}") + .replaceAll("{.Names}", "{{.Names}}"); + const file = new Blob([shell], { type: "text/plain" }); el.href = URL.createObjectURL(file); el.download = "deploy_vocespace.sh"; document.body.appendChild(el); // Required for this to work in FireFox @@ -102,33 +112,9 @@ export function ConfigVocespace() {