qq-bot-roost 1.0.11 → 1.0.13
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/README.md +3 -3
- package/package.json +3 -3
- package/src/bot.js +12 -0
- package/src/config.js +777 -759
- package/src/gitee.js +5 -4
- package/src/main.js +3 -0
- package/src/message.js +2 -0
- package/src/mirror.js +8 -2
- package/src/outbound.js +39 -0
- package/src/plugin/loader.js +42 -10
- package/src/plugin/market.js +41 -3
- package/src/plugin/runtime-errors.js +27 -0
- package/src/plugin/snapshot.js +64 -0
- package/src/proxy.js +675 -0
- package/src/runtime.js +18 -0
- package/src/services/config-watch.js +2 -0
- package/src/tarball.js +3 -2
- package/src/updater.js +2 -1
- package/src/web/server.js +3741 -3620
- package/web/app.js +4934 -4701
- package/web/index.html +1337 -1315
|
@@ -20,6 +20,7 @@ import { createLogger, setLevel } from '../logger.js';
|
|
|
20
20
|
import { DIRS, PATHS } from '../paths.js';
|
|
21
21
|
import { loadGlobalConfig, loadBotConfig } from '../config.js';
|
|
22
22
|
import { configureMirror } from '../mirror.js';
|
|
23
|
+
import { configureProxy } from '../proxy.js';
|
|
23
24
|
|
|
24
25
|
const log = createLogger('config-watch');
|
|
25
26
|
|
|
@@ -97,6 +98,7 @@ export class ConfigWatchService extends BaseService {
|
|
|
97
98
|
if (after.logLevel) setLevel(after.logLevel);
|
|
98
99
|
// 下载源改了也要立刻生效,不然得重启(用户改的就是这个文件)
|
|
99
100
|
configureMirror(this.globalCfg);
|
|
101
|
+
configureProxy(this.globalCfg);
|
|
100
102
|
|
|
101
103
|
this.onReload?.(after, null);
|
|
102
104
|
log.info('全局配置已重新加载');
|
package/src/tarball.js
CHANGED
|
@@ -22,6 +22,7 @@ import path from 'node:path';
|
|
|
22
22
|
import zlib from 'node:zlib';
|
|
23
23
|
import crypto from 'node:crypto';
|
|
24
24
|
import { createLogger } from './logger.js';
|
|
25
|
+
import { netFetch } from './proxy.js';
|
|
25
26
|
|
|
26
27
|
const log = createLogger('tarball');
|
|
27
28
|
|
|
@@ -161,8 +162,8 @@ export async function extractEntries(entries, destDir) {
|
|
|
161
162
|
*/
|
|
162
163
|
export async function fetchAndExtract(url, destDir, opts = {}) {
|
|
163
164
|
const { timeoutMs = 120000, retries = 1, onRetry, fetcher, expectSha256 = null } = opts;
|
|
164
|
-
//
|
|
165
|
-
const doFetch = fetcher ??
|
|
165
|
+
// 默认 netFetch(带代理支持);插件市场和框架更新会传一个带镜像兜底的实现
|
|
166
|
+
const doFetch = fetcher ?? netFetch;
|
|
166
167
|
|
|
167
168
|
let res = null;
|
|
168
169
|
let lastErr = null;
|
package/src/updater.js
CHANGED
|
@@ -18,6 +18,7 @@ import { compareVersion } from './semver.js';
|
|
|
18
18
|
import path from 'node:path';
|
|
19
19
|
import { createLogger } from './logger.js';
|
|
20
20
|
import { fetchAndExtract } from './tarball.js';
|
|
21
|
+
import { netFetch } from './proxy.js';
|
|
21
22
|
import { fetchViaMirror, currentMirror } from './mirror.js';
|
|
22
23
|
import { fetchGiteeTree, detectGiteeRef, giteeRawUrl } from './gitee.js';
|
|
23
24
|
import { hashDir } from './hashdir.js';
|
|
@@ -304,7 +305,7 @@ async function fetchLatestTagViaApi() {
|
|
|
304
305
|
*/
|
|
305
306
|
async function checkViaGitee(cur) {
|
|
306
307
|
const ref = await detectGiteeRef(REPO);
|
|
307
|
-
const res = await
|
|
308
|
+
const res = await netFetch(giteeRawUrl(REPO, ref, 'package.json'), {
|
|
308
309
|
headers: { 'User-Agent': 'qq-bot-roost-updater' },
|
|
309
310
|
signal: AbortSignal.timeout(10000),
|
|
310
311
|
});
|