Skip to content

Commit

Permalink
Merge pull request #1 from koishijs/main
Browse files Browse the repository at this point in the history
[pull] main from koishijs:main
  • Loading branch information
CyanChanges authored Feb 24, 2024
2 parents b7f1fe9 + c75371a commit fe882b1
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 47 deletions.
21 changes: 3 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,9 @@ on:

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
- name: Install
run: yarn

- name: Build
run: yarn build

- name: Set npm token
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish packages
run: yarn pub
uses: cordiverse/workflows/.github/workflows/publish.yml@main
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

deploy:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "koishi-plugin-booru",
"description": "Image service for Koishi",
"version": "1.1.3",
"version": "1.1.4",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
Expand Down 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 fe882b1

Please sign in to comment.