Skip to content

Commit

Permalink
refa: migrate e621 schema to i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
MaikoTan committed Aug 14, 2024
1 parent 2aeaa31 commit fa6c504
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/e621/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,20 @@ namespace e621ImageSource {
export const Config: Schema<Config> = Schema.intersect([
ImageSource.createSchema({ label: 'e621' }),
Schema.object({
endpoint: Schema.string().description('e621/e926 的 URL。').default('https://e621.net/'),
endpoint: Schema.string().default('https://e621.net/'),
keyPairs: Schema.array(
Schema.object({
login: Schema.string().required().description('e621/e926 的用户名。'),
apiKey: Schema.string().required().role('secret').description('e621/e926 的 API Key。'),
login: Schema.string().required(),
apiKey: Schema.string().required().role('secret'),
}),
)
.default([])
.description(
'e621/e926 的登录凭据。[点击前往获取及设置教程](https://booru.koishi.chat/zh-CN/plugins/e621.html#configure-credentials)',
),
userAgent: Schema.string().description('设置请求的 User Agent。').default(
).default([]),
userAgent: Schema.string().default(
// eslint-disable-next-line max-len
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.37',
),
}).description('搜索设置'),
}).i18n({
'zh-CN': require('./locales/zh-CN.schema'),
}),
])
}

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

0 comments on commit fa6c504

Please sign in to comment.