Skip to content

Commit

Permalink
feat: support koishi v4.17.0 (#136)
Browse files Browse the repository at this point in the history
* fix: support new cordis service config type restriction

* feat: update to koishi 4.17.0
  • Loading branch information
MaikoTan authored Feb 24, 2024
1 parent b7f1fe9 commit 9764228
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
}
},
"peerDependencies": {
"koishi": "^4.15.2"
"koishi": "^4.17.0"
},
"devDependencies": {
"@koishijs/assets": "^1.0.2",
"koishi": "^4.15.2"
"koishi": "^4.17.0"
},
"dependencies": {
"languagedetect": "^2.0.0"
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ImageService extends Service {
private sources: ImageSource[] = []
private languageDetect = new LanguageDetect()

constructor(ctx: Context, private config: Config) {
constructor(ctx: Context, config: Config) {
super(ctx, 'booru', true)
this.config = config
}
Expand Down Expand Up @@ -63,8 +63,8 @@ class ImageService extends Service {
for (const source of sources) {
const tags = source.tokenize(query.query)
const images = await source.get({ count: query.count, tags, raw: query.query }).catch((err) => {
if (Quester.isAxiosError(err)) {
logger.warn(`source ${source.config.label} request failed ${err.status ? `with code ${err.status} ${JSON.stringify(err.response?.data)}` : ''}`)
if (Quester.Error.is(err)) {
logger.warn(`source ${source.config.label} request failed ${err.response?.status ? `with code ${err.response?.status} ${JSON.stringify(err.response?.data)}` : ''}`)
} else {
logger.error(`source ${source.config.label} unknown error: ${err.message}`)
}
Expand All @@ -91,8 +91,8 @@ class ImageService extends Service {
return this.ctx.http.axios(image.url, { method: 'GET', responseType: 'arraybuffer' }).then(resp => {
return `data:${resp.headers['content-type']};base64,${Buffer.from(resp.data, 'binary').toString('base64')}`
}).catch(err => {
if (Quester.isAxiosError(err)) {
logger.warn(`Request images failed with HTTP status ${err.status}: ${JSON.stringify(err.response?.data)}.`)
if (Quester.Error.is(err)) {
logger.warn(`Request images failed with HTTP status ${err.response?.status}: ${JSON.stringify(err.response?.data)}.`)
} else {
logger.error(`Request images failed with unknown error: ${err.message}.`)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/danbooru/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
}
},
"peerDependencies": {
"koishi": "^4.15.2",
"koishi": "^4.17.0",
"koishi-plugin-booru": "^1.1.0"
},
"devDependencies": {
"koishi": "^4.15.2"
"koishi": "^4.17.0"
}
}
4 changes: 2 additions & 2 deletions packages/e621/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
}
},
"peerDependencies": {
"koishi": "^4.15.2",
"koishi": "^4.17.0",
"koishi-plugin-booru": "^1.1.0"
},
"devDependencies": {
"koishi": "^4.15.2"
"koishi": "^4.17.0"
}
}
4 changes: 2 additions & 2 deletions packages/gelbooru/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
}
},
"peerDependencies": {
"koishi": "^4.15.2",
"koishi": "^4.17.0",
"koishi-plugin-booru": "^1.1.0"
},
"devDependencies": {
"koishi": "^4.15.2"
"koishi": "^4.17.0"
}
}
4 changes: 2 additions & 2 deletions packages/konachan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
}
},
"peerDependencies": {
"koishi": "^4.15.2",
"koishi": "^4.17.0",
"koishi-plugin-booru": "^1.1.0"
},
"devDependencies": {
"koishi": "^4.15.2"
"koishi": "^4.17.0"
}
}
2 changes: 1 addition & 1 deletion packages/local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}
},
"peerDependencies": {
"koishi": "^4.15.2",
"koishi": "^4.17.0",
"koishi-plugin-booru": "^1.1.0"
}
}
4 changes: 2 additions & 2 deletions packages/lolibooru/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
}
},
"peerDependencies": {
"koishi": "^4.15.2",
"koishi": "^4.17.0",
"koishi-plugin-booru": "^1.1.0"
},
"devDependencies": {
"koishi": "^4.15.2"
"koishi": "^4.17.0"
}
}
4 changes: 2 additions & 2 deletions packages/lolicon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
}
},
"peerDependencies": {
"koishi": "^4.15.2",
"koishi": "^4.17.0",
"koishi-plugin-booru": "^1.1.0"
},
"devDependencies": {
"koishi": "^4.15.2"
"koishi": "^4.17.0"
}
}
4 changes: 2 additions & 2 deletions packages/pixiv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
}
},
"peerDependencies": {
"koishi": "^4.15.2",
"koishi": "^4.17.0",
"koishi-plugin-booru": "^1.1.0"
},
"devDependencies": {
"koishi": "^4.15.2"
"koishi": "^4.17.0"
}
}
4 changes: 2 additions & 2 deletions packages/safebooru/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
}
},
"peerDependencies": {
"koishi": "^4.15.2",
"koishi": "^4.17.0",
"koishi-plugin-booru": "^1.1.0"
},
"devDependencies": {
"koishi": "^4.15.2"
"koishi": "^4.17.0"
}
}
4 changes: 2 additions & 2 deletions packages/sankaku/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
}
},
"peerDependencies": {
"koishi": "^4.15.2",
"koishi": "^4.17.0",
"koishi-plugin-booru": "^1.1.0"
},
"devDependencies": {
"koishi": "^4.15.2"
"koishi": "^4.17.0"
}
}
4 changes: 2 additions & 2 deletions packages/yande/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
}
},
"peerDependencies": {
"koishi": "^4.15.2",
"koishi": "^4.17.0",
"koishi-plugin-booru": "^1.1.0"
},
"devDependencies": {
"koishi": "^4.15.2"
"koishi": "^4.17.0"
}
}

0 comments on commit 9764228

Please sign in to comment.