diff --git a/packages/koishi-core/src/adapter.ts b/packages/koishi-core/src/adapter.ts index 578c5e95ef..dafa7e85ea 100644 --- a/packages/koishi-core/src/adapter.ts +++ b/packages/koishi-core/src/adapter.ts @@ -117,6 +117,7 @@ export namespace Adapter { logger.debug('websocket client opening') bot.status = Bot.Status.CONNECTING const socket = await this.prepare(bot) + const url = socket.url.replace(/\?.+/, '') socket.on('error', error => logger.debug(error)) @@ -126,7 +127,8 @@ export namespace Adapter { logger.debug(`websocket closed with ${code}`) if (!this._listening) return - const message = reason || `failed to connect to ${socket.url}` + // remove query args to protect privacy + const message = reason || `failed to connect to ${url}` let timeout = retryInterval if (_retryCount >= retryTimes) { if (this.app.status === App.Status.open) { @@ -146,7 +148,7 @@ export namespace Adapter { socket.on('open', () => { _retryCount = 0 bot.socket = socket - logger.debug('connect to ws server:', socket.url) + logger.info('connect to ws server:', url) this.connect(bot).then(() => { bot.status = Bot.Status.GOOD resolve() diff --git a/packages/plugin-eval/src/main.ts b/packages/plugin-eval/src/main.ts index 35c4a0b1a4..71aa9dca0d 100644 --- a/packages/plugin-eval/src/main.ts +++ b/packages/plugin-eval/src/main.ts @@ -184,17 +184,8 @@ export class EvalWorker { }) } - addSetupFile(name: string, filename: string) { - if (this.config.setupFiles[name] === filename) return - const ctx = this[Context.current] - this.config.setupFiles[name] = filename - ctx.before('disconnect', () => { - delete this.config.setupFiles[name] - }) - } - // delegated class methods which use instance properties - // should be written in arrow functions + // should be written in arrow functions to ensure accessibility start = async () => { this.state = State.opening await this.ctx.parallel('eval/before-start') diff --git a/packages/plugin-eval/src/worker/index.ts b/packages/plugin-eval/src/worker/index.ts index fa9b09869b..54d9c3c1cf 100644 --- a/packages/plugin-eval/src/worker/index.ts +++ b/packages/plugin-eval/src/worker/index.ts @@ -161,7 +161,7 @@ export class WorkerHandle { async sync(scope: Scope) { await scope.user?._update() await scope.channel?._update() - const buffer = serialize(storage) + const buffer = serialize(scope.storage) await safeWriteFile(storagePath, buffer) }