@luckylillia-dev/luckylillia 9.0.4 → 9.0.6
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-CZs1GqPc.js → coreUpdate-CEtHqh6r.js} +76 -21
- package/chunks/coreUpdate-CEtHqh6r.js.map +1 -0
- package/llbot-core.js +50 -11
- package/llbot-core.js.map +1 -1
- package/llbot-manager.js +1 -1
- package/package.json +1 -1
- package/webui/assets/{index-BOCgu1cH.js → index-DdKHZet8.js} +1 -1
- package/webui/index.html +1 -1
- package//346/233/264/346/226/260/346/227/245/345/277/227.txt +14 -0
- package/chunks/coreUpdate-CZs1GqPc.js.map +0 -1
|
@@ -4126,7 +4126,7 @@ var Hono = class extends Hono$1 {
|
|
|
4126
4126
|
//#endregion
|
|
4127
4127
|
//#region src/version.ts
|
|
4128
4128
|
var version_exports = /* @__PURE__ */ __exportAll({ version: () => version });
|
|
4129
|
-
var version = "9.0.
|
|
4129
|
+
var version = "9.0.6";
|
|
4130
4130
|
//#endregion
|
|
4131
4131
|
//#region src/main/manager/protocol.ts
|
|
4132
4132
|
var protocol_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -4428,12 +4428,14 @@ var RETRY_AFTER = 3e5;
|
|
|
4428
4428
|
/** No answer at all, or a server-side one: worth trying elsewhere first for a while, unlike a 404. */
|
|
4429
4429
|
var unreachable = (error) => error.status === void 0 || error.status === 429 || error.status >= 500;
|
|
4430
4430
|
/**
|
|
4431
|
-
*
|
|
4432
|
-
*
|
|
4433
|
-
*
|
|
4434
|
-
*
|
|
4431
|
+
* The main registry (npm itself) and its mirrors. Which versions there are is asked of the main registry first:
|
|
4432
|
+
* a mirror may lag behind it. What gets installed comes from the mirrors first: they are faster where npm is
|
|
4433
|
+
* slow, and a version is the same file wherever it is. A registry that cannot be reached is tried last for a
|
|
4434
|
+
* while, so a dead one does not cost a timeout on every request. Tarballs are checked against the integrity of
|
|
4435
|
+
* the document they came from, so a mirror cannot substitute one.
|
|
4435
4436
|
*/
|
|
4436
4437
|
var Registries = class {
|
|
4438
|
+
/** The main registry first, then the mirrors */
|
|
4437
4439
|
registries;
|
|
4438
4440
|
down = /* @__PURE__ */ new Map();
|
|
4439
4441
|
constructor(urls, fetch) {
|
|
@@ -4441,16 +4443,20 @@ var Registries = class {
|
|
|
4441
4443
|
if (!unique.length) throw new Error("at least one npm registry is needed");
|
|
4442
4444
|
this.registries = unique.map((url) => new Registry(url, fetch));
|
|
4443
4445
|
}
|
|
4444
|
-
/**
|
|
4445
|
-
ordered() {
|
|
4446
|
-
const
|
|
4447
|
-
const
|
|
4448
|
-
return [...
|
|
4446
|
+
/** The order for a lookup, with the ones that recently could not be reached moved to the end */
|
|
4447
|
+
ordered(lookup = "latest") {
|
|
4448
|
+
const [main, ...mirrors] = this.registries;
|
|
4449
|
+
const preferred = lookup === "install" ? [...mirrors, main] : [main, ...mirrors];
|
|
4450
|
+
return [...preferred.filter((registry) => this.healthy(registry)), ...preferred.filter((registry) => !this.healthy(registry))];
|
|
4449
4451
|
}
|
|
4450
|
-
|
|
4452
|
+
healthy(registry) {
|
|
4453
|
+
return !((this.down.get(registry) ?? 0) > Date.now());
|
|
4454
|
+
}
|
|
4455
|
+
async packument(name, full = false, need, lookup = "latest") {
|
|
4456
|
+
if (lookup === "latest" && !need) return this.newest(name, full);
|
|
4451
4457
|
const errors = [];
|
|
4452
4458
|
let incomplete;
|
|
4453
|
-
for (const registry of this.ordered()) try {
|
|
4459
|
+
for (const registry of this.ordered(lookup)) try {
|
|
4454
4460
|
const document = await registry.packument(name, full);
|
|
4455
4461
|
this.down.delete(registry);
|
|
4456
4462
|
if (!need || need(document)) return document;
|
|
@@ -4461,6 +4467,35 @@ var Registries = class {
|
|
|
4461
4467
|
if (incomplete) return incomplete;
|
|
4462
4468
|
throw combine(errors);
|
|
4463
4469
|
}
|
|
4470
|
+
/**
|
|
4471
|
+
* The main registry's document; when it cannot answer, the one with the newest `latest` of the mirrors, which are
|
|
4472
|
+
* asked together. Registries that recently could not be reached are only asked when the others cannot answer.
|
|
4473
|
+
*/
|
|
4474
|
+
async newest(name, full) {
|
|
4475
|
+
const [main, ...mirrors] = this.registries;
|
|
4476
|
+
const errors = [];
|
|
4477
|
+
const ask = async (registry) => {
|
|
4478
|
+
try {
|
|
4479
|
+
const document = await registry.packument(name, full);
|
|
4480
|
+
this.down.delete(registry);
|
|
4481
|
+
return document;
|
|
4482
|
+
} catch (e) {
|
|
4483
|
+
errors.push(this.failed(registry, e));
|
|
4484
|
+
}
|
|
4485
|
+
};
|
|
4486
|
+
const mainUp = this.healthy(main);
|
|
4487
|
+
if (mainUp) {
|
|
4488
|
+
const document = await ask(main);
|
|
4489
|
+
if (document) return document;
|
|
4490
|
+
}
|
|
4491
|
+
const later = [...mirrors.filter((registry) => !this.healthy(registry)), ...mainUp ? [] : [main]];
|
|
4492
|
+
for (const group of [mirrors.filter((registry) => this.healthy(registry)), later]) {
|
|
4493
|
+
let best;
|
|
4494
|
+
for (const document of await Promise.all(group.map(ask))) if (document && (!best || newerLatest(document, best))) best = document;
|
|
4495
|
+
if (best) return best;
|
|
4496
|
+
}
|
|
4497
|
+
throw combine(errors);
|
|
4498
|
+
}
|
|
4464
4499
|
async tarball(version, maxBytes, onProgress) {
|
|
4465
4500
|
const errors = [];
|
|
4466
4501
|
for (const [url, registry] of this.tarballSources(version)) try {
|
|
@@ -4476,13 +4511,17 @@ var Registries = class {
|
|
|
4476
4511
|
}
|
|
4477
4512
|
throw combine(errors);
|
|
4478
4513
|
}
|
|
4479
|
-
/**
|
|
4514
|
+
/**
|
|
4515
|
+
* The same path on each registry, the mirrors first. A URL on another host (a CDN the document names) is tried
|
|
4516
|
+
* first, as that is where the file is
|
|
4517
|
+
*/
|
|
4480
4518
|
tarballSources(version) {
|
|
4481
4519
|
const original = version.dist.tarball;
|
|
4482
4520
|
const owner = this.registries.find((registry) => original.startsWith(registry.url + "/"));
|
|
4483
4521
|
const path = owner ? original.slice(owner.url.length) : `/${version.name}/-/${version.name.split("/").pop()}-${version.version}.tgz`;
|
|
4484
|
-
const
|
|
4485
|
-
|
|
4522
|
+
const order = this.ordered("install");
|
|
4523
|
+
const sources = new Map(owner ? [] : [[original, order[0]]]);
|
|
4524
|
+
for (const registry of order) if (!sources.has(registry.url + path)) sources.set(registry.url + path, registry);
|
|
4486
4525
|
return [...sources];
|
|
4487
4526
|
}
|
|
4488
4527
|
failed(registry, e) {
|
|
@@ -4491,6 +4530,18 @@ var Registries = class {
|
|
|
4491
4530
|
return error;
|
|
4492
4531
|
}
|
|
4493
4532
|
};
|
|
4533
|
+
/** Whether a's `latest` is newer than b's; an invalid one never is */
|
|
4534
|
+
function newerLatest(a, b) {
|
|
4535
|
+
const left = a["dist-tags"]?.latest;
|
|
4536
|
+
const right = b["dist-tags"]?.latest;
|
|
4537
|
+
if (typeof left !== "string") return false;
|
|
4538
|
+
if (typeof right !== "string") return true;
|
|
4539
|
+
try {
|
|
4540
|
+
return compareVersions(left, right) > 0;
|
|
4541
|
+
} catch {
|
|
4542
|
+
return false;
|
|
4543
|
+
}
|
|
4544
|
+
}
|
|
4494
4545
|
function combine(errors) {
|
|
4495
4546
|
if (errors.length === 1) return errors[0];
|
|
4496
4547
|
const status = errors.every((error) => error.status === 404) ? 404 : void 0;
|
|
@@ -6832,11 +6883,15 @@ var Catalog = class {
|
|
|
6832
6883
|
//#endregion
|
|
6833
6884
|
//#region src/plugin/internal/tool/market/settings.ts
|
|
6834
6885
|
var MarketSchema = Schema.object({
|
|
6835
|
-
registry: Schema.string().role("link").default("https://registry.
|
|
6836
|
-
mirrors: Schema.array(Schema.string().role("link")).default([
|
|
6886
|
+
registry: Schema.string().role("link").default("https://registry.npmjs.org").description("主源:查插件目录、检查更新时先问它,一般用 npm 官方源 https://registry.npmjs.org。连不上时改问镜像源,用版本最新的那个"),
|
|
6887
|
+
mirrors: Schema.array(Schema.string().role("link")).default([
|
|
6888
|
+
"https://registry.npmmirror.com",
|
|
6889
|
+
"https://mirrors.huaweicloud.com/repository/npm",
|
|
6890
|
+
"https://mirrors.cloud.tencent.com/npm"
|
|
6891
|
+
]).description("镜像源:下载插件和依赖时按顺序先用它们,哪个有需要的版本就用哪个,都没有再用主源"),
|
|
6837
6892
|
catalog: Schema.string().default(MARKET_PACKAGE).description("提供插件列表和已审核版本的 npm 目录包,不清楚时保持默认即可")
|
|
6838
6893
|
});
|
|
6839
|
-
/** Every registry to use
|
|
6894
|
+
/** Every registry to use: the main one first, then the mirrors (Registries orders them per lookup) */
|
|
6840
6895
|
var registriesOf = (settings) => [settings.registry, ...settings.mirrors ?? []];
|
|
6841
6896
|
var sameUrl = (a, b) => a.replace(/\/+$/, "") === b.replace(/\/+$/, "");
|
|
6842
6897
|
var isWebUrl = (value) => {
|
|
@@ -6961,7 +7016,7 @@ var CoreUpdater = class {
|
|
|
6961
7016
|
current;
|
|
6962
7017
|
constructor(options) {
|
|
6963
7018
|
this.options = options;
|
|
6964
|
-
this.current = options.current ?? "9.0.
|
|
7019
|
+
this.current = options.current ?? "9.0.6";
|
|
6965
7020
|
}
|
|
6966
7021
|
status() {
|
|
6967
7022
|
const latest = this.latest;
|
|
@@ -7060,7 +7115,7 @@ var CoreUpdater = class {
|
|
|
7060
7115
|
this.blocked = await this.options.blocker?.();
|
|
7061
7116
|
if (this.blocked) throw new CoreUpdateError(this.blocked, 409);
|
|
7062
7117
|
if (!newer(version, this.current)) throw new CoreUpdateError(`${version} 不比正在运行的 ${this.current} 新`, 409);
|
|
7063
|
-
const document = await this.options.registry().packument(CORE_PACKAGE, false, (doc) => Object.hasOwn(doc.versions ?? {}, version));
|
|
7118
|
+
const document = await this.options.registry().packument(CORE_PACKAGE, false, (doc) => Object.hasOwn(doc.versions ?? {}, version), "install");
|
|
7064
7119
|
const release = Object.hasOwn(document.versions ?? {}, version) ? document.versions[version] : void 0;
|
|
7065
7120
|
if (!release) throw new CoreUpdateError(`npm 上没有 ${CORE_PACKAGE}@${version}`, 404);
|
|
7066
7121
|
if (release.name !== "@luckylillia-dev/luckylillia" || release.version !== version) throw new CoreUpdateError("npm 返回的包与请求的版本不符", 502);
|
|
@@ -7375,4 +7430,4 @@ function createCoreUpdateRoutes(updater) {
|
|
|
7375
7430
|
//#endregion
|
|
7376
7431
|
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 };
|
|
7377
7432
|
|
|
7378
|
-
//# sourceMappingURL=coreUpdate-
|
|
7433
|
+
//# sourceMappingURL=coreUpdate-CEtHqh6r.js.map
|