Skip to content

Commit

Permalink
build: fix several type error and config, avoid build failed (koishij…
Browse files Browse the repository at this point in the history
…s#234)

* build: fix several type error and config, avoid build failed

* fix lint error
  • Loading branch information
MaikoTan authored Jul 30, 2024
1 parent 2cb470e commit 32f6e2c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 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
3 changes: 1 addition & 2 deletions packages/e621/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Context, Quester, Schema, trimSlash } from 'koishi'
import { Context, Schema, trimSlash } from 'koishi'
import { ImageSource } from 'koishi-plugin-booru'

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 32f6e2c

Please sign in to comment.