@oxiaom/adoremix 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/config/webui.js +38 -18
package/package.json
CHANGED
package/src/config/webui.js
CHANGED
|
@@ -41,26 +41,46 @@ function deployWebui(workdir, variant) {
|
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
43
|
const docroot = path.join(workdir, 'etc', 'docroot');
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
fse.ensureDirSync(docroot);
|
|
45
|
+
|
|
46
|
+
// 只替换 UI 相关文件(index.html + assets/ + js/)
|
|
47
|
+
// 保留其他用户数据:mp3/(上传的音频)、bangzhu/、luyin2/、static/、xcx/ 等
|
|
48
|
+
// 这样切换 UI 不会丢失任何业务数据
|
|
49
|
+
const uiFiles = ['index.html'];
|
|
50
|
+
const uiDirs = ['assets', 'js'];
|
|
51
|
+
|
|
52
|
+
// 先删旧 UI 文件(如果存在)
|
|
53
|
+
for (const f of uiFiles) {
|
|
54
|
+
const p = path.join(docroot, f);
|
|
55
|
+
if (fs.existsSync(p)) fs.unlinkSync(p);
|
|
56
|
+
}
|
|
57
|
+
for (const d of uiDirs) {
|
|
58
|
+
const p = path.join(docroot, d);
|
|
59
|
+
if (fs.existsSync(p)) fse.removeSync(p);
|
|
57
60
|
}
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
fse.
|
|
61
|
+
|
|
62
|
+
// 复制新 UI 文件
|
|
63
|
+
for (const f of uiFiles) {
|
|
64
|
+
const src = path.join(srcDir, f);
|
|
65
|
+
if (fs.existsSync(src)) fse.copySync(src, path.join(docroot, f));
|
|
63
66
|
}
|
|
67
|
+
for (const d of uiDirs) {
|
|
68
|
+
const src = path.join(srcDir, d);
|
|
69
|
+
if (fs.existsSync(src)) fse.copySync(src, path.join(docroot, d));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// 复制 webui 包里其他顶层文件(如 favicon.ico 等,但不碰用户已有的非 UI 文件)
|
|
73
|
+
// 注意:只复制 webui 包里"独有"的文件,不覆盖 docroot 已有的同名文件
|
|
74
|
+
const webuiEntries = fs.readdirSync(srcDir);
|
|
75
|
+
for (const entry of webuiEntries) {
|
|
76
|
+
if (uiFiles.includes(entry) || uiDirs.includes(entry)) continue;
|
|
77
|
+
const dst = path.join(docroot, entry);
|
|
78
|
+
if (!fs.existsSync(dst)) {
|
|
79
|
+
// 只在 docroot 不存在时复制(避免覆盖用户数据)
|
|
80
|
+
fse.copySync(path.join(srcDir, entry), dst);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
64
84
|
return true;
|
|
65
85
|
}
|
|
66
86
|
|