@luckylillia-dev/luckylillia 9.0.2 → 9.0.4
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/chunks/{coreUpdate-BQLZsgRG.js → coreUpdate-CZs1GqPc.js} +78 -238
- package/chunks/coreUpdate-CZs1GqPc.js.map +1 -0
- package/llbot-core.js +277 -13
- package/llbot-core.js.map +1 -1
- package/llbot-manager.js +24 -44
- package/llbot-manager.js.map +1 -1
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/index.d.ts +1 -1
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/manifest.d.ts +26 -0
- package/node_modules/@luckylillia-dev/plugin-sdk/lib/storage.d.ts +5 -3
- package/package.json +1 -1
- package/webui/assets/index-BOCgu1cH.js +30 -0
- package/webui/index.html +1 -1
- package//346/233/264/346/226/260/346/227/245/345/277/227.txt +20 -0
- package/chunks/coreUpdate-BQLZsgRG.js.map +0 -1
- package/webui/assets/index-DTvzDdGT.js +0 -30
- package//344/275/277/347/224/250/350/257/264/346/230/216.txt +0 -6
|
@@ -51,15 +51,12 @@ var globalVars_exports = /* @__PURE__ */ __exportAll({
|
|
|
51
51
|
LOG_DIR: () => LOG_DIR,
|
|
52
52
|
STATE_DIR: () => STATE_DIR,
|
|
53
53
|
TEMP_DIR: () => TEMP_DIR,
|
|
54
|
-
dbDir: () => dbDir,
|
|
55
54
|
getFixedDataDir: () => getFixedDataDir
|
|
56
55
|
});
|
|
57
56
|
var DATA_DIR = path.resolve("data");
|
|
58
57
|
if (!existsSync(DATA_DIR)) mkdirSync(DATA_DIR);
|
|
59
58
|
var TEMP_DIR = path.join(DATA_DIR, "temp");
|
|
60
59
|
var LOG_DIR = path.join(DATA_DIR, "logs");
|
|
61
|
-
var dbDir = path.join(DATA_DIR, "database");
|
|
62
|
-
if (!existsSync(dbDir)) mkdirSync(dbDir);
|
|
63
60
|
/** The bot's private files: locks. Not for hand edits. */
|
|
64
61
|
var STATE_DIR = path.join(DATA_DIR, "state");
|
|
65
62
|
function getFixedDataDir() {
|
|
@@ -74,24 +71,11 @@ function getFixedDataDir() {
|
|
|
74
71
|
//#endregion
|
|
75
72
|
//#region src/common/utils/environment.ts
|
|
76
73
|
var environment_exports = /* @__PURE__ */ __exportAll({
|
|
77
|
-
currentNativeQQTarget: () => currentNativeQQTarget,
|
|
78
|
-
getAuthTokenPageUrl: () => getAuthTokenPageUrl,
|
|
79
|
-
getCdn: () => getCdn,
|
|
80
74
|
getInstanceArg: () => getInstanceArg,
|
|
81
|
-
getNativeQQTarget: () => getNativeQQTarget,
|
|
82
75
|
getPluginDirs: () => getPluginDirs,
|
|
83
|
-
getProtocol: () => getProtocol,
|
|
84
|
-
getSpecifiedUin: () => getSpecifiedUin,
|
|
85
76
|
isDevMode: () => isDevMode,
|
|
86
77
|
isDockerEnvironment: () => isDockerEnvironment,
|
|
87
|
-
|
|
88
|
-
isPluginHmr: () => isPluginHmr,
|
|
89
|
-
launchPins: () => launchPins,
|
|
90
|
-
lockProtocol: () => lockProtocol,
|
|
91
|
-
lockedProtocol: () => lockedProtocol,
|
|
92
|
-
protocolPins: () => protocolPins,
|
|
93
|
-
resolveProtocolSelection: () => resolveProtocolSelection,
|
|
94
|
-
setProtocolSelection: () => setProtocolSelection
|
|
78
|
+
isPluginHmr: () => isPluginHmr
|
|
95
79
|
});
|
|
96
80
|
function isDockerEnvironment() {
|
|
97
81
|
try {
|
|
@@ -100,82 +84,6 @@ function isDockerEnvironment() {
|
|
|
100
84
|
return false;
|
|
101
85
|
}
|
|
102
86
|
}
|
|
103
|
-
/** `--nativeqq`, `--nativeqq-config <file>` and `--qq-path <QQ>`: the official QQ client bridge, run in this process */
|
|
104
|
-
function getNativeQQTarget(argv = process.argv) {
|
|
105
|
-
const arg = (name) => {
|
|
106
|
-
const equals = argv.find((a) => a.startsWith(name + "="));
|
|
107
|
-
if (equals) return equals.slice(name.length + 1);
|
|
108
|
-
const index = argv.indexOf(name);
|
|
109
|
-
return index >= 0 && argv[index + 1] && !argv[index + 1].startsWith("-") ? argv[index + 1] : "";
|
|
110
|
-
};
|
|
111
|
-
const configPath = arg("--nativeqq-config");
|
|
112
|
-
return argv.includes("--nativeqq") || !!configPath ? {
|
|
113
|
-
configPath,
|
|
114
|
-
qqPath: arg("--qq-path")
|
|
115
|
-
} : null;
|
|
116
|
-
}
|
|
117
|
-
var selection;
|
|
118
|
-
var locked;
|
|
119
|
-
var launch;
|
|
120
|
-
function protocolPins(argv = process.argv, env = process.env) {
|
|
121
|
-
const pins = {};
|
|
122
|
-
const target = getNativeQQTarget(argv);
|
|
123
|
-
if (target) {
|
|
124
|
-
pins.mode = {
|
|
125
|
-
value: "nativeqq",
|
|
126
|
-
by: "--nativeqq"
|
|
127
|
-
};
|
|
128
|
-
pins.nativeQQ = {
|
|
129
|
-
value: target,
|
|
130
|
-
by: "--nativeqq"
|
|
131
|
-
};
|
|
132
|
-
} else if (argv.includes("--direct")) pins.mode = {
|
|
133
|
-
value: "direct",
|
|
134
|
-
by: "--direct"
|
|
135
|
-
};
|
|
136
|
-
const protocol = pinnedProtocol(argv, env);
|
|
137
|
-
if (protocol) pins.protocol = protocol;
|
|
138
|
-
return pins;
|
|
139
|
-
}
|
|
140
|
-
/** protocolPins() of this process, read once: getProtocol() runs for every packet, and argv does not change. */
|
|
141
|
-
function launchPins() {
|
|
142
|
-
return launch ??= protocolPins();
|
|
143
|
-
}
|
|
144
|
-
/** The NT protocol plugin's settings, with what the launch fixes winning. */
|
|
145
|
-
function resolveProtocolSelection(settings, pins = launchPins()) {
|
|
146
|
-
return {
|
|
147
|
-
mode: pins.mode?.value ?? settings.mode,
|
|
148
|
-
protocol: pins.protocol?.value ?? settings.protocol,
|
|
149
|
-
nativeQQ: pins.nativeQQ?.value ?? {
|
|
150
|
-
configPath: "",
|
|
151
|
-
qqPath: settings.nativeQQ.qqPath
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
/** Set by the NT protocol plugin before it mounts the protocol; until then the launch arguments decide. */
|
|
156
|
-
function setProtocolSelection(value) {
|
|
157
|
-
selection = value;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Called as the pure protocol's client is created: the client lives as long as the process (native sign binds
|
|
161
|
-
* its relay to it), and so does the protocol it speaks.
|
|
162
|
-
*/
|
|
163
|
-
function lockProtocol() {
|
|
164
|
-
locked ??= getProtocol();
|
|
165
|
-
}
|
|
166
|
-
/** What the pure protocol is locked to until LLBot restarts; undefined while it has no client. */
|
|
167
|
-
function lockedProtocol() {
|
|
168
|
-
return locked;
|
|
169
|
-
}
|
|
170
|
-
function isNativeQQMode() {
|
|
171
|
-
return selection ? selection.mode === "nativeqq" : getNativeQQTarget() !== null;
|
|
172
|
-
}
|
|
173
|
-
function currentNativeQQTarget() {
|
|
174
|
-
return selection?.nativeQQ ?? getNativeQQTarget() ?? {
|
|
175
|
-
configPath: "",
|
|
176
|
-
qqPath: ""
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
87
|
/**
|
|
180
88
|
* `--dev`: run against a local manager -- loads the development native bundle and reads data/auth_token.dev.txt.
|
|
181
89
|
* argv only, no env fallback: a stray variable on a deployment must never switch it on.
|
|
@@ -211,86 +119,6 @@ function getInstanceArg(argv = process.argv, env = process.env) {
|
|
|
211
119
|
function isPluginHmr(argv = process.argv) {
|
|
212
120
|
return argv.includes("--plugin-hmr");
|
|
213
121
|
}
|
|
214
|
-
/**
|
|
215
|
-
* `-q <uin>` / `--qq <uin>`: 用 qq-session-<uin>[-<protocol>].json; 没给 --instance 时有同名实例就用它。
|
|
216
|
-
* 只解析 argv: config service 也用它, 不能牵扯 native-sign 依赖链
|
|
217
|
-
*/
|
|
218
|
-
function getSpecifiedUin(argv = process.argv) {
|
|
219
|
-
for (let i = 0; i < argv.length; i++) {
|
|
220
|
-
const a = argv[i];
|
|
221
|
-
if ((a === "-q" || a === "--qq") && i + 1 < argv.length) return argv[i + 1];
|
|
222
|
-
if (a.startsWith("-q=")) return a.slice(3);
|
|
223
|
-
if (a.startsWith("--qq=")) return a.slice(5);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/** `--cdn` > 环境变量 CDN (名和值不分大小写) > cf。cf = api-auth.luckylillia.com, china = llbot-api-auth.wumiao.wang */
|
|
227
|
-
function getCdn(argv = process.argv, env = process.env) {
|
|
228
|
-
let raw;
|
|
229
|
-
for (let i = 0; i < argv.length; i++) {
|
|
230
|
-
const a = argv[i];
|
|
231
|
-
if (a === "--cdn" && i + 1 < argv.length) {
|
|
232
|
-
raw = argv[i + 1];
|
|
233
|
-
break;
|
|
234
|
-
}
|
|
235
|
-
if (a.startsWith("--cdn=")) {
|
|
236
|
-
raw = a.slice(6);
|
|
237
|
-
break;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
if (raw === void 0) {
|
|
241
|
-
const key = Object.keys(env).find((k) => k.toLowerCase() === "cdn");
|
|
242
|
-
if (key) raw = env[key];
|
|
243
|
-
}
|
|
244
|
-
return raw?.trim().toLowerCase() === "china" ? "china" : "cf";
|
|
245
|
-
}
|
|
246
|
-
/** The manager frontend, on a different domain from the API host the native signing module talks to. */
|
|
247
|
-
function getAuthTokenPageUrl(cdn = getCdn()) {
|
|
248
|
-
return cdn === "china" ? "https://llbot.wumiao.wang" : "https://auth.luckylillia.com";
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* The profile the protocol layer runs with. The pure protocol: what it is locked to, else `--protocol` / `-p` >
|
|
252
|
-
* the PROTOCOL environment variable > the NT protocol plugin's choice > linux (its default); an unknown value of
|
|
253
|
-
* a flag or the variable is linux. NativeQQ has always run with linux unless launched with another (highway
|
|
254
|
-
* appId, SsoInfoSync), so switching to it keeps that.
|
|
255
|
-
*/
|
|
256
|
-
function getProtocol() {
|
|
257
|
-
const pinned = launchPins().protocol?.value;
|
|
258
|
-
if (selection?.mode === "nativeqq") return pinned ?? "linux";
|
|
259
|
-
return locked ?? pinned ?? selection?.protocol ?? "linux";
|
|
260
|
-
}
|
|
261
|
-
/** A blank value pins nothing, e.g. PROTOCOL= from a compose file whose variable is unset. */
|
|
262
|
-
function pinnedProtocol(argv, env) {
|
|
263
|
-
for (let i = 0; i < argv.length; i++) {
|
|
264
|
-
const a = argv[i];
|
|
265
|
-
let raw;
|
|
266
|
-
let by = a;
|
|
267
|
-
if (a === "--protocol" || a === "-p") raw = argv[i + 1];
|
|
268
|
-
else if (a.startsWith("--protocol=")) [by, raw] = ["--protocol", a.slice(11)];
|
|
269
|
-
else if (a.startsWith("-p=")) [by, raw] = ["-p", a.slice(3)];
|
|
270
|
-
if (raw?.trim()) return {
|
|
271
|
-
value: normalizeProtocol(raw),
|
|
272
|
-
by
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
const key = Object.keys(env).find((k) => k.toLowerCase() === "protocol");
|
|
276
|
-
const raw = key ? env[key] : void 0;
|
|
277
|
-
if (key && raw?.trim()) return {
|
|
278
|
-
value: normalizeProtocol(raw),
|
|
279
|
-
by: key
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
function normalizeProtocol(raw) {
|
|
283
|
-
switch (raw.trim().toLowerCase()) {
|
|
284
|
-
case "win":
|
|
285
|
-
case "windows": return "windows";
|
|
286
|
-
case "mac":
|
|
287
|
-
case "macos":
|
|
288
|
-
case "darwin": return "macos";
|
|
289
|
-
case "wat":
|
|
290
|
-
case "watch": return "watch";
|
|
291
|
-
default: return "linux";
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
122
|
//#endregion
|
|
295
123
|
//#region src/common/instanceName.ts
|
|
296
124
|
/** The default instance: always there, made by the first start */
|
|
@@ -312,11 +140,8 @@ var instance_exports = /* @__PURE__ */ __exportAll({
|
|
|
312
140
|
function instancesDir() {
|
|
313
141
|
return path.join(DATA_DIR, "instances");
|
|
314
142
|
}
|
|
315
|
-
/**
|
|
316
|
-
|
|
317
|
-
* makes for an old account whose settings differed), else default. See config-storage §4.
|
|
318
|
-
*/
|
|
319
|
-
function resolveInstance(argv = process.argv, env = process.env, dir = instancesDir()) {
|
|
143
|
+
/** --instance, else LLBOT_INSTANCE, else default. See config-storage §4. */
|
|
144
|
+
function resolveInstance(argv = process.argv, env = process.env) {
|
|
320
145
|
const fromArgv = getInstanceArg(argv, {});
|
|
321
146
|
const requested = fromArgv ?? getInstanceArg([], env);
|
|
322
147
|
if (requested !== void 0) {
|
|
@@ -326,25 +151,58 @@ function resolveInstance(argv = process.argv, env = process.env, dir = instances
|
|
|
326
151
|
reason: fromArgv !== void 0 ? "--instance" : "LLBOT_INSTANCE"
|
|
327
152
|
};
|
|
328
153
|
}
|
|
329
|
-
const uin = getSpecifiedUin(argv);
|
|
330
|
-
if (uin && isValidInstanceName(uin) && existsSync(path.join(dir, uin))) return {
|
|
331
|
-
name: uin,
|
|
332
|
-
reason: `-q ${uin},且有同名实例`
|
|
333
|
-
};
|
|
334
154
|
return {
|
|
335
155
|
name: DEFAULT_INSTANCE,
|
|
336
156
|
reason: "默认实例"
|
|
337
157
|
};
|
|
338
158
|
}
|
|
339
159
|
var current;
|
|
340
|
-
/**
|
|
341
|
-
* The instance this process runs, fixed on first use. main.ts makes that first use after the startup migration,
|
|
342
|
-
* which may create the instance `-q` points to.
|
|
343
|
-
*/
|
|
160
|
+
/** The instance this process runs, fixed on first use. main.ts makes that first use after the startup migration. */
|
|
344
161
|
function currentInstance() {
|
|
345
162
|
return current ??= resolveInstance();
|
|
346
163
|
}
|
|
347
164
|
//#endregion
|
|
165
|
+
//#region src/common/configPaths.ts
|
|
166
|
+
var configPaths_exports = /* @__PURE__ */ __exportAll({
|
|
167
|
+
INSTANCE_FILES: () => INSTANCE_FILES,
|
|
168
|
+
LEGACY_ACCOUNT_FILE: () => LEGACY_ACCOUNT_FILE,
|
|
169
|
+
configPaths: () => configPaths,
|
|
170
|
+
legacyPaths: () => legacyPaths
|
|
171
|
+
});
|
|
172
|
+
/** What an instance directory holds (docs/config-storage.md §3). */
|
|
173
|
+
var INSTANCE_FILES = {
|
|
174
|
+
/** The bot's own settings: log, logLevel, ffmpeg, webui, ... */
|
|
175
|
+
settings: "settings.json",
|
|
176
|
+
plugins: "plugins.json",
|
|
177
|
+
email: "email.json",
|
|
178
|
+
pluginData: "plugin-data",
|
|
179
|
+
/** The plugins' database (builtin:database); the QQ account's own tables are per account under data/database/ */
|
|
180
|
+
database: "database.db"
|
|
181
|
+
};
|
|
182
|
+
var configPaths = {
|
|
183
|
+
instance: (name = currentInstance().name) => path.join(instancesDir(), name),
|
|
184
|
+
settings: (name) => path.join(configPaths.instance(name), INSTANCE_FILES.settings),
|
|
185
|
+
plugins: (name) => path.join(configPaths.instance(name), INSTANCE_FILES.plugins),
|
|
186
|
+
email: (name) => path.join(configPaths.instance(name), INSTANCE_FILES.email),
|
|
187
|
+
/** Shared WebUI login password at data/webui_token.txt (used by both the unified manager and standalone mode). */
|
|
188
|
+
webuiToken: () => path.join(DATA_DIR, "webui_token.txt"),
|
|
189
|
+
/** Cross-instance plugin data root at data/plugin-data/ (ctx.storage.dir('host')). */
|
|
190
|
+
sharedPluginData: () => path.join(DATA_DIR, "plugin-data"),
|
|
191
|
+
pluginData: (name) => path.join(configPaths.instance(name), INSTANCE_FILES.pluginData),
|
|
192
|
+
database: (name) => path.join(configPaths.instance(name), INSTANCE_FILES.database)
|
|
193
|
+
};
|
|
194
|
+
/** Where things lived before instances: read once by the startup migration, then renamed to *.bak. */
|
|
195
|
+
var legacyPaths = {
|
|
196
|
+
account: (uin) => path.join(DATA_DIR, `config_${uin}.json`),
|
|
197
|
+
email: () => path.join(DATA_DIR, "email_config.json"),
|
|
198
|
+
/** The unreleased data/config/{global,accounts/<uin>}/ layout. */
|
|
199
|
+
configDir: () => path.join(DATA_DIR, "config"),
|
|
200
|
+
/** The plugin entries before data/config/, from early in this branch. */
|
|
201
|
+
pluginsFile: () => path.join(DATA_DIR, "plugins.json"),
|
|
202
|
+
pluginData: () => path.join(DATA_DIR, "plugin-data")
|
|
203
|
+
};
|
|
204
|
+
var LEGACY_ACCOUNT_FILE = /^config_(\d+)\.json$/;
|
|
205
|
+
//#endregion
|
|
348
206
|
//#region node_modules/json5/dist/index.js
|
|
349
207
|
var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
350
208
|
(function(global, factory) {
|
|
@@ -1499,48 +1357,8 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1499
1357
|
}));
|
|
1500
1358
|
}));
|
|
1501
1359
|
//#endregion
|
|
1502
|
-
//#region src/common/configPaths.ts
|
|
1503
|
-
var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1);
|
|
1504
|
-
var configPaths_exports = /* @__PURE__ */ __exportAll({
|
|
1505
|
-
INSTANCE_FILES: () => INSTANCE_FILES,
|
|
1506
|
-
LEGACY_ACCOUNT_FILE: () => LEGACY_ACCOUNT_FILE,
|
|
1507
|
-
configPaths: () => configPaths,
|
|
1508
|
-
legacyPaths: () => legacyPaths
|
|
1509
|
-
});
|
|
1510
|
-
/** What an instance directory holds (docs/config-storage.md §3). */
|
|
1511
|
-
var INSTANCE_FILES = {
|
|
1512
|
-
/** The bot's own settings: log, logLevel, ffmpeg, webui, ... */
|
|
1513
|
-
settings: "settings.json",
|
|
1514
|
-
plugins: "plugins.json",
|
|
1515
|
-
email: "email.json",
|
|
1516
|
-
webuiToken: "webui_token.txt",
|
|
1517
|
-
pluginData: "plugin-data",
|
|
1518
|
-
/** The plugins' database (builtin:database); the QQ account's own tables are per account under data/database/ */
|
|
1519
|
-
database: "database.db"
|
|
1520
|
-
};
|
|
1521
|
-
var configPaths = {
|
|
1522
|
-
instance: (name = currentInstance().name) => path.join(instancesDir(), name),
|
|
1523
|
-
settings: (name) => path.join(configPaths.instance(name), INSTANCE_FILES.settings),
|
|
1524
|
-
plugins: (name) => path.join(configPaths.instance(name), INSTANCE_FILES.plugins),
|
|
1525
|
-
email: (name) => path.join(configPaths.instance(name), INSTANCE_FILES.email),
|
|
1526
|
-
webuiToken: (name) => path.join(configPaths.instance(name), INSTANCE_FILES.webuiToken),
|
|
1527
|
-
pluginData: (name) => path.join(configPaths.instance(name), INSTANCE_FILES.pluginData),
|
|
1528
|
-
database: (name) => path.join(configPaths.instance(name), INSTANCE_FILES.database)
|
|
1529
|
-
};
|
|
1530
|
-
/** Where things lived before instances: read once by the startup migration, then renamed to *.bak. */
|
|
1531
|
-
var legacyPaths = {
|
|
1532
|
-
account: (uin) => path.join(DATA_DIR, `config_${uin}.json`),
|
|
1533
|
-
email: () => path.join(DATA_DIR, "email_config.json"),
|
|
1534
|
-
webuiToken: () => path.join(DATA_DIR, "webui_token.txt"),
|
|
1535
|
-
/** The unreleased data/config/{global,accounts/<uin>}/ layout. */
|
|
1536
|
-
configDir: () => path.join(DATA_DIR, "config"),
|
|
1537
|
-
/** The plugin entries before data/config/, from early in this branch. */
|
|
1538
|
-
pluginsFile: () => path.join(DATA_DIR, "plugins.json"),
|
|
1539
|
-
pluginData: () => path.join(DATA_DIR, "plugin-data")
|
|
1540
|
-
};
|
|
1541
|
-
var LEGACY_ACCOUNT_FILE = /^config_(\d+)\.json$/;
|
|
1542
|
-
//#endregion
|
|
1543
1360
|
//#region src/common/jsonFile.ts
|
|
1361
|
+
var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1);
|
|
1544
1362
|
var HOST = hostname();
|
|
1545
1363
|
/**
|
|
1546
1364
|
* One JSON file, read-tolerant and crash-safe.
|
|
@@ -2120,9 +1938,8 @@ function migrateToInstances(log) {
|
|
|
2120
1938
|
const instanceWide = readJson(log, path.join(legacyPaths.configDir(), "global", "settings.json"));
|
|
2121
1939
|
const email = newest(readJson(log, legacyPaths.email()), readJson(log, path.join(legacyPaths.configDir(), "global", "email.json")));
|
|
2122
1940
|
const plugins = newest(readJson(log, legacyPaths.pluginsFile()), readJson(log, path.join(legacyPaths.configDir(), "global", "plugins.json")));
|
|
2123
|
-
const token = existsSync(legacyPaths.webuiToken()) ? legacyPaths.webuiToken() : void 0;
|
|
2124
1941
|
const pluginData = existsSync(legacyPaths.pluginData()) ? legacyPaths.pluginData() : void 0;
|
|
2125
|
-
if (!accounts.length && !instanceWide && !email && !plugins && !
|
|
1942
|
+
if (!accounts.length && !instanceWide && !email && !plugins && !pluginData) return;
|
|
2126
1943
|
const baseline = accounts[0] ?? (instanceWide && {
|
|
2127
1944
|
...instanceWide,
|
|
2128
1945
|
uin: ""
|
|
@@ -2149,7 +1966,6 @@ function migrateToInstances(log) {
|
|
|
2149
1966
|
if (settings) writeJson(path.join(dir, INSTANCE_FILES.settings), settings);
|
|
2150
1967
|
if (email) writeJson(path.join(dir, INSTANCE_FILES.email), email.value);
|
|
2151
1968
|
writeJson(path.join(dir, INSTANCE_FILES.plugins), keepLoginMethod(plugins?.value));
|
|
2152
|
-
if (token) copyFileSync(token, path.join(dir, INSTANCE_FILES.webuiToken));
|
|
2153
1969
|
}
|
|
2154
1970
|
if (pluginData) renameSync(pluginData, path.join(staging, DEFAULT_INSTANCE, INSTANCE_FILES.pluginData));
|
|
2155
1971
|
renameSync(staging, instancesDir());
|
|
@@ -2168,7 +1984,7 @@ function migrateToInstances(log) {
|
|
|
2168
1984
|
for (const { name, from } of instances) {
|
|
2169
1985
|
const what = from ? `QQ ${from} 的配置` : "没有登录过的旧配置";
|
|
2170
1986
|
log.info(`已把${what}迁到实例 ${name}(data/instances/${name}/)`);
|
|
2171
|
-
if (name !== "default") log.info(`QQ ${name} 的配置和 ${DEFAULT_INSTANCE} 不同,单独放在实例 ${name}:用
|
|
1987
|
+
if (name !== "default") log.info(`QQ ${name} 的配置和 ${DEFAULT_INSTANCE} 不同,单独放在实例 ${name}:用 --instance ${name} 启动就会用它`);
|
|
2172
1988
|
}
|
|
2173
1989
|
log.info("登录方式沿用旧版的纯协议 · Linux,可以在 WebUI 的「NTQQ 协议」页更改");
|
|
2174
1990
|
if (sources.size) log.info(`旧配置文件已改名为 *.bak:${[...sources].map((source) => path.relative(DATA_DIR, source)).join("、")}`);
|
|
@@ -2350,6 +2166,31 @@ function migrateExtractedPlugins(log) {
|
|
|
2350
2166
|
* every start, before the migrations that look for the plugins by their new names; a directory both names have is
|
|
2351
2167
|
* left for the user to merge.
|
|
2352
2168
|
*/
|
|
2169
|
+
/**
|
|
2170
|
+
* The WebUI password used to be each instance's (data/instances/<name>/webui_token.txt) and is now
|
|
2171
|
+
* data/webui_token.txt for all of them. Without that file, the first password found becomes it: the instance
|
|
2172
|
+
* starting now, then default, then the others. Otherwise an upgrade would leave the WebUI without a password,
|
|
2173
|
+
* for anyone who reaches it to set. The old files stay, unused.
|
|
2174
|
+
*/
|
|
2175
|
+
function migrateWebuiToken(log, first) {
|
|
2176
|
+
const target = configPaths.webuiToken();
|
|
2177
|
+
if (existsSync(target)) return;
|
|
2178
|
+
const names = [...new Set([
|
|
2179
|
+
first,
|
|
2180
|
+
DEFAULT_INSTANCE,
|
|
2181
|
+
...list(instancesDir())
|
|
2182
|
+
].filter((name) => !!name))];
|
|
2183
|
+
for (const name of names) {
|
|
2184
|
+
const source = path.join(instancesDir(), name, "webui_token.txt");
|
|
2185
|
+
try {
|
|
2186
|
+
if (!readFileSync(source, "utf8").trim()) continue;
|
|
2187
|
+
mkdirSync(path.dirname(target), { recursive: true });
|
|
2188
|
+
copyFileSync(source, target);
|
|
2189
|
+
log.info(`WebUI 改为所有实例共用一个密码:沿用实例 ${name} 的密码,现在保存在 ${path.relative(DATA_DIR, target)}`);
|
|
2190
|
+
return;
|
|
2191
|
+
} catch {}
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2353
2194
|
function migrateRenamedPackages(log) {
|
|
2354
2195
|
const renamed = (name) => typeof name === "string" && Object.hasOwn(RENAMED_PACKAGES, name) ? RENAMED_PACKAGES[name] : void 0;
|
|
2355
2196
|
const file = configPaths.plugins();
|
|
@@ -2399,8 +2240,7 @@ function migrateRenamedPackages(log) {
|
|
|
2399
2240
|
log.info(`插件已改用 @luckylillia-dev 包名,设置随之迁移:${[...moved].join("、") || "信任与界面设置"}。旧包名的已装插件照常使用,在插件市场更新后换成新包`);
|
|
2400
2241
|
}
|
|
2401
2242
|
}
|
|
2402
|
-
const root
|
|
2403
|
-
for (const [previous, current] of Object.entries(RENAMED_PACKAGES)) {
|
|
2243
|
+
for (const root of [configPaths.pluginData(), configPaths.sharedPluginData()]) for (const [previous, current] of Object.entries(RENAMED_PACKAGES)) {
|
|
2404
2244
|
const from = path.join(root, previous.replace("/", "+"));
|
|
2405
2245
|
const to = path.join(root, current.replace("/", "+"));
|
|
2406
2246
|
if (!existsSync(from)) continue;
|
|
@@ -4286,7 +4126,7 @@ var Hono = class extends Hono$1 {
|
|
|
4286
4126
|
//#endregion
|
|
4287
4127
|
//#region src/version.ts
|
|
4288
4128
|
var version_exports = /* @__PURE__ */ __exportAll({ version: () => version });
|
|
4289
|
-
var version = "9.0.
|
|
4129
|
+
var version = "9.0.4";
|
|
4290
4130
|
//#endregion
|
|
4291
4131
|
//#region src/main/manager/protocol.ts
|
|
4292
4132
|
var protocol_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -7121,7 +6961,7 @@ var CoreUpdater = class {
|
|
|
7121
6961
|
current;
|
|
7122
6962
|
constructor(options) {
|
|
7123
6963
|
this.options = options;
|
|
7124
|
-
this.current = options.current ?? "9.0.
|
|
6964
|
+
this.current = options.current ?? "9.0.4";
|
|
7125
6965
|
}
|
|
7126
6966
|
status() {
|
|
7127
6967
|
const latest = this.latest;
|
|
@@ -7533,6 +7373,6 @@ function createCoreUpdateRoutes(updater) {
|
|
|
7533
7373
|
return router;
|
|
7534
7374
|
}
|
|
7535
7375
|
//#endregion
|
|
7536
|
-
export { Hono as $, Registries as A,
|
|
7376
|
+
export { Hono as $, Registries as A, require_dist as At, installHostLifecycle as B, getPluginDirs as Bt, scanPluginRoots as C, normalizeScope as Ct, removeScannedPackage as D, deepMerge as Dt, cleanupRemovedPackages as E, platform_exports as Et, parseSpec as F, resolveInstance as Ft, GATEWAY_SECRET_HEADER as G, LOG_DIR as Gt, GATEWAY_INSTANCE_HEADER as H, isDockerEnvironment as Ht, pickVersion as I, DEFAULT_INSTANCE as It, isManaged as J, globalVars_exports as Jt, MANAGED_ENV as K, STATE_DIR as Kt, lockInstance as L, INVALID_INSTANCE_NAME as Lt, isExactVersion as M, configPaths_exports as Mt, isPackageName as N, currentInstance as Nt, scannedPackagePath as O, mergeNewProperties as Ot, matches as P, instance_exports as Pt, version_exports as Q, __toESM as Qt, lockManager as R, isValidInstanceName as Rt, resolveMain as S, acceptsScope as St, sdkRangeOf as T, normalizePlatformId as Tt, GATEWAY_PREFIX_HEADER as U, isPluginHmr as Ut, GATEWAY_AUTH_HEADER as V, isDevMode as Vt, GATEWAY_SECRET_ENV as W, DATA_DIR as Wt, protocol_exports as X, __exportAll as Xt, isManagerMessage as Y, __commonJSMin as Yt, version as Z, __require as Zt, manifest_exports as _, templateSection as _t, scheduleAutoCheck as a, migrateRenamedPackages as at, parsePluginDependencies as b, newEntryId as bt, marketSettings as c, renameNativeQQSettings as ct, extractPackage as d, renamed_exports as dt, HtmlEscapedCallbackPhase as et, readTarStream as f, withCurrentNames as ft, isInside as g, templateConfig as gt, isImagePath as h, DEPRECATED_KEYS as ht, installDirOf as i, migrateNTQQMessaging as it, RegistryError as j, configPaths as jt, require_semver as k, JsonFile as kt, registriesOf as l, RENAMED_PACKAGES as lt, SDK_PACKAGE as m, ADAPTER_KEYS as mt, CoreUpdater as n, liftBuiltinSettings as nt, updateBlocker as o, migrateToInstances as ot, PLUGIN_CATEGORIES as p, ADAPTER_ENTRIES as pt, isInstanceMessage as q, TEMP_DIR as qt, coreUpdate_exports as r, migrateExtractedPlugins as rt, MarketSchema as s, migrateWebuiToken as st, CoreUpdateError as t, resolveCallback as tt, Catalog as u, currentPackageName as ut, matchesPluginVersion as v, upgradeConfig as vt, sdkIncompatibility as w, normalizePlatform as wt, readPluginPackage as x, normalizeUi as xt, normalizeService as y, PluginStore as yt, runningInstances as z, environment_exports as zt };
|
|
7537
7377
|
|
|
7538
|
-
//# sourceMappingURL=coreUpdate-
|
|
7378
|
+
//# sourceMappingURL=coreUpdate-CZs1GqPc.js.map
|