@luckylillia-dev/luckylillia 9.0.2 → 9.0.3
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-FeEAjxU_.js} +78 -238
- package/chunks/coreUpdate-FeEAjxU_.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-zYO4ACTl.js +30 -0
- package/webui/index.html +1 -1
- package//346/233/264/346/226/260/346/227/245/345/277/227.txt +13 -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
package/llbot-manager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as Registries, Ft as
|
|
1
|
+
import { A as Registries, Ft as resolveInstance, G as GATEWAY_SECRET_HEADER, Gt as LOG_DIR, H as GATEWAY_INSTANCE_HEADER, Ht as isDockerEnvironment, It as DEFAULT_INSTANCE, K as MANAGED_ENV, Kt as STATE_DIR, Lt as INVALID_INSTANCE_NAME, R as lockManager, Rt as isValidInstanceName, U as GATEWAY_PREFIX_HEADER, V as GATEWAY_AUTH_HEADER, W as GATEWAY_SECRET_ENV, Wt as DATA_DIR, a as scheduleAutoCheck, i as installDirOf, jt as configPaths, l as registriesOf, n as CoreUpdater, o as updateBlocker, ot as migrateToInstances, q as isInstanceMessage, s as MarketSchema, st as migrateWebuiToken, t as CoreUpdateError, z as runningInstances } from "./chunks/coreUpdate-FeEAjxU_.js";
|
|
2
2
|
import { n as isSupervised, r as parentPidOf, t as SUPERVISED_ENV } from "./chunks/restart-TVy8kurW.js";
|
|
3
|
-
import { appendFileSync,
|
|
3
|
+
import { appendFileSync, createReadStream, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fork } from "node:child_process";
|
|
6
6
|
import { networkInterfaces } from "node:os";
|
|
@@ -976,6 +976,9 @@ function createManagerApi(options) {
|
|
|
976
976
|
/**
|
|
977
977
|
* How the arguments llbot.js was given are split between the manager and the instances it runs. The launchers
|
|
978
978
|
* (desktop app, CLI, Docker) keep passing what they passed when each process was one instance.
|
|
979
|
+
*
|
|
980
|
+
* Only the bot's own arguments are known here. Anything else belongs to the plugins (a protocol plugin's login
|
|
981
|
+
* mode, `--plugin` to install one) and goes to the instance the launch names, as it did when that was the only one.
|
|
979
982
|
*/
|
|
980
983
|
/** The manager's own: the WebUI port is the gateway's, the parent is the manager's */
|
|
981
984
|
var MANAGER_VALUE = /* @__PURE__ */ new Set([
|
|
@@ -983,22 +986,12 @@ var MANAGER_VALUE = /* @__PURE__ */ new Set([
|
|
|
983
986
|
"--parent-pid",
|
|
984
987
|
"--instance"
|
|
985
988
|
]);
|
|
986
|
-
/**
|
|
987
|
-
var
|
|
988
|
-
|
|
989
|
-
"--
|
|
990
|
-
"
|
|
991
|
-
"--
|
|
992
|
-
"--nativeqq-config",
|
|
993
|
-
"--qq-path",
|
|
994
|
-
"--cmd-whitelist",
|
|
995
|
-
"--plugin",
|
|
996
|
-
"--plugin-config"
|
|
997
|
-
]);
|
|
998
|
-
var TARGET_FLAG = /* @__PURE__ */ new Set([
|
|
999
|
-
"--direct",
|
|
1000
|
-
"--nativeqq",
|
|
1001
|
-
"--dump-packets"
|
|
989
|
+
/** The bot's own settings for every instance; `--plugin-dir` takes a value */
|
|
990
|
+
var SHARED_VALUE = /* @__PURE__ */ new Set(["--plugin-dir"]);
|
|
991
|
+
var SHARED_FLAG = /* @__PURE__ */ new Set([
|
|
992
|
+
"--plugin-hmr",
|
|
993
|
+
"--dev",
|
|
994
|
+
"--debug"
|
|
1002
995
|
]);
|
|
1003
996
|
var nameOf = (arg) => arg.startsWith("-") && arg.includes("=") ? arg.slice(0, arg.indexOf("=")) : arg;
|
|
1004
997
|
/** Whether `arg` at `index` is followed by its value as a separate argument */
|
|
@@ -1018,17 +1011,17 @@ function splitArgs(argv) {
|
|
|
1018
1011
|
if (name === "--webui-port" && value !== void 0 && /^\d+$/.test(value) && +value > 0 && +value <= 65535) result.webuiPort = +value;
|
|
1019
1012
|
continue;
|
|
1020
1013
|
}
|
|
1021
|
-
if (
|
|
1022
|
-
result.
|
|
1023
|
-
if (!inline && takesNext(argv, i)) result.target.push(argv[++i]);
|
|
1014
|
+
if (SHARED_FLAG.has(name)) {
|
|
1015
|
+
result.shared.push(arg);
|
|
1024
1016
|
continue;
|
|
1025
1017
|
}
|
|
1026
|
-
if (
|
|
1027
|
-
result.
|
|
1018
|
+
if (SHARED_VALUE.has(name)) {
|
|
1019
|
+
result.shared.push(arg);
|
|
1020
|
+
if (!inline && takesNext(argv, i)) result.shared.push(argv[++i]);
|
|
1028
1021
|
continue;
|
|
1029
1022
|
}
|
|
1030
|
-
result.
|
|
1031
|
-
if (!inline &&
|
|
1023
|
+
result.target.push(arg);
|
|
1024
|
+
if (!inline && takesNext(argv, i)) result.target.push(argv[++i]);
|
|
1032
1025
|
}
|
|
1033
1026
|
return result;
|
|
1034
1027
|
}
|
|
@@ -1050,7 +1043,6 @@ var GatewayAuth = class {
|
|
|
1050
1043
|
lockedUntil = 0;
|
|
1051
1044
|
constructor(options) {
|
|
1052
1045
|
this.options = options;
|
|
1053
|
-
this.migrate();
|
|
1054
1046
|
}
|
|
1055
1047
|
/** The password; re-read when the file changed (the desktop app or a hand edit may reset it) */
|
|
1056
1048
|
getToken() {
|
|
@@ -1153,17 +1145,6 @@ var GatewayAuth = class {
|
|
|
1153
1145
|
}
|
|
1154
1146
|
this.access(ip, method, url, 200);
|
|
1155
1147
|
}
|
|
1156
|
-
/** The first start under the manager: the default instance's password becomes everyone's */
|
|
1157
|
-
migrate() {
|
|
1158
|
-
if (existsSync(this.options.file)) return;
|
|
1159
|
-
for (const source of this.options.migrateFrom?.() ?? []) try {
|
|
1160
|
-
if (!readFileSync(source, "utf8").trim()) continue;
|
|
1161
|
-
mkdirSync(path.dirname(this.options.file), { recursive: true });
|
|
1162
|
-
copyFileSync(source, this.options.file);
|
|
1163
|
-
this.options.log?.info(`WebUI 改为所有实例共用一个密码:沿用 ${source} 的密码,其他实例原来的密码不再使用`);
|
|
1164
|
-
return;
|
|
1165
|
-
} catch {}
|
|
1166
|
-
}
|
|
1167
1148
|
access(ip, method, url, status, message) {
|
|
1168
1149
|
if (!this.options.accessLog) return;
|
|
1169
1150
|
try {
|
|
@@ -1660,7 +1641,7 @@ async function main() {
|
|
|
1660
1641
|
registry.load();
|
|
1661
1642
|
let explicitTarget;
|
|
1662
1643
|
try {
|
|
1663
|
-
const choice = resolveInstance(argv, process.env
|
|
1644
|
+
const choice = resolveInstance(argv, process.env);
|
|
1664
1645
|
if (choice.reason !== "默认实例") explicitTarget = choice.name;
|
|
1665
1646
|
} catch (error) {
|
|
1666
1647
|
log.error(error.message);
|
|
@@ -1701,13 +1682,12 @@ async function main() {
|
|
|
1701
1682
|
instances.set(name, existing);
|
|
1702
1683
|
return existing;
|
|
1703
1684
|
};
|
|
1685
|
+
migrateWebuiToken({
|
|
1686
|
+
info: (...parts) => log.info(parts.join(" ")),
|
|
1687
|
+
warn: (...parts) => log.warn(parts.join(" "))
|
|
1688
|
+
}, target);
|
|
1704
1689
|
const auth = new GatewayAuth({
|
|
1705
|
-
file:
|
|
1706
|
-
migrateFrom: () => [...new Set([
|
|
1707
|
-
target,
|
|
1708
|
-
registry.defaultInstance(),
|
|
1709
|
-
...registry.list()
|
|
1710
|
-
].filter((x) => Boolean(x)))].map((name) => path.join(registry.instancesDir, name, "webui_token.txt")),
|
|
1690
|
+
file: configPaths.webuiToken(),
|
|
1711
1691
|
accessLog: path.join(LOG_DIR, "webui_access.log"),
|
|
1712
1692
|
log
|
|
1713
1693
|
});
|