Skip to content

Commit

Permalink
refa: migrate danbooru schema to i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
MaikoTan committed Aug 14, 2024
1 parent b0f0c7d commit 2aeaa31
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/danbooru/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,19 @@ namespace DanbooruImageSource {
export const Config: Schema<Config> = Schema.intersect([
ImageSource.createSchema({ label: 'danbooru' }),
Schema.object({
endpoint: Schema.string().description('Danbooru 的 URL。').default('https://danbooru.donmai.us/'),
endpoint: Schema.string().default('https://danbooru.donmai.us/'),
/**
* @see https://danbooru.donmai.us/wiki_pages/help%3Aapi
*/
keyPairs: Schema.array(
Schema.object({
login: Schema.string().required().description('用户名。'),
apiKey: Schema.string().required().role('secret').description('API 密钥。'),
login: Schema.string().required(),
apiKey: Schema.string().required().role('secret'),
}),
)
.default([])
.description(
'Danbooru 的登录凭据。[点击前往获取及设置教程](https://booru.koishi.chat/zh-CN/plugins/danbooru.html#configure-credentials)',
),
}).description('搜索设置'),
).default([]),
}).i18n({
'zh-CN': require('./locales/zh-CN.schema'),
}),
])
}

Expand Down
7 changes: 7 additions & 0 deletions packages/danbooru/src/locales/zh-CN.schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$description: 搜索设置
endpoint: Danbooru 的 URL。
keyPairs:
$description: Danbooru 的登录凭据。[点击前往获取及设置教程](https://booru.koishi.chat/zh-CN/plugins/danbooru.html#configure-credentials)
$inner:
login: 用户名。
apiKey: API 密钥。

0 comments on commit 2aeaa31

Please sign in to comment.