diff --git a/packages/core/package.json b/packages/core/package.json index 242688cdf..8e2f2aa02 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -44,12 +44,12 @@ } }, "peerDependencies": { - "@koishijs/plugin-proxy-agent": "^0.1.4 || ^0.2.0", + "@cordisjs/plugin-proxy-agent": ">=0.3.0", "koishi": "^4.17.0" }, "devDependencies": { + "@cordisjs/plugin-proxy-agent": ">=0.3.3", "@koishijs/assets": "^1.0.2", - "@koishijs/plugin-proxy-agent": "^0.2.0", "koishi": "^4.17.0" }, "dependencies": { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 1a4e37c28..649c7b2d8 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -99,7 +99,7 @@ class ImageService extends Service { async imgUrlToBase64(url: string): Promise { return this.ctx - .http(url, { method: 'GET', responseType: 'arraybuffer' }) + .http(url, { method: 'GET', responseType: 'arraybuffer', proxyAgent: '' }) .then((resp) => { return `data:${resp.headers['content-type']};base64,${Buffer.from(resp.data).toString('base64')}` }) @@ -214,7 +214,9 @@ export const Config = Schema.intersect([ ]) export function apply(ctx: Context, config: Config) { + // @ts-expect-error inject structure not compatiable ctx.plugin(ImageService, config) + // @ts-expect-error inject structure not compatiable ctx.plugin(Command, config) // eslint-disable-next-line @typescript-eslint/no-var-requires diff --git a/packages/core/src/source.ts b/packages/core/src/source.ts index d8c0511ba..abd018fd3 100644 --- a/packages/core/src/source.ts +++ b/packages/core/src/source.ts @@ -1,10 +1,9 @@ import { Context, Element, Quester, Schema } from 'koishi' -import type {} from '@koishijs/plugin-proxy-agent' -import type { Inject } from 'cordis' +import type {} from '@cordisjs/plugin-proxy-agent' export abstract class ImageSource { - static inject: string[] | Partial = ['booru'] + static inject: string[] | Partial> = ['booru'] languages: string[] = [] source: string diff --git a/packages/e621/src/index.ts b/packages/e621/src/index.ts index 9893ffc01..cb0ac2859 100644 --- a/packages/e621/src/index.ts +++ b/packages/e621/src/index.ts @@ -6,7 +6,6 @@ import { e621 } from './types' class e621ImageSource extends ImageSource { languages = ['en'] source = 'e621' - http: Quester constructor(ctx: Context, config: e621ImageSource.Config) { super(ctx, config) diff --git a/tsconfig.base.json b/tsconfig.base.json index 9f9a75b04..f58270280 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,13 +1,13 @@ { "compilerOptions": { - "target": "es2019", - "module": "commonjs", + "target": "esnext", + "module": "esnext", "declaration": true, "composite": true, "incremental": true, "skipLibCheck": true, "esModuleInterop": true, - "moduleResolution": "node", + "moduleResolution": "bundler", "strictBindCallApply": true, "jsx": "react-jsx", "jsxImportSource": "@satorijs/element",