Skip to content

Commit

Permalink
build: fix several type error and config, avoid build failed
Browse files Browse the repository at this point in the history
  • Loading branch information
MaikoTan committed Jul 30, 2024
1 parent 2cb470e commit c77544d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class ImageService extends Service {

async imgUrlToBase64(url: string): Promise<string> {
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')}`
})
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/source.ts
Original file line number Diff line number Diff line change
@@ -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<Config extends ImageSource.Config = ImageSource.Config> {
static inject: string[] | Partial<Inject> = ['booru']
static inject: string[] | Partial<Record<'required' | 'optional', string[]>> = ['booru']

languages: string[] = []
source: string
Expand Down
1 change: 0 additions & 1 deletion packages/e621/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { e621 } from './types'
class e621ImageSource extends ImageSource<e621ImageSource.Config> {
languages = ['en']
source = 'e621'
http: Quester

constructor(ctx: Context, config: e621ImageSource.Config) {
super(ctx, config)
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit c77544d

Please sign in to comment.