Skip to content

Commit

Permalink
fix: keyPairs default values and docs (#206)
Browse files Browse the repository at this point in the history
* fix: keyPairs default values and docs

* feat: add link for bypassing pixiv detection
  • Loading branch information
MaikoTan authored Mar 25, 2024
1 parent 97de9ab commit 3df346e
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/zh-CN/plugins/danbooru.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Danbooru 的登录凭据。如该项为空,则使用匿名登录。

由于 Danbooru 的 [API 限制](https://danbooru.donmai.us/wiki_pages/help%3Ausers),匿名用户一次只能搜索 2 个标签,且极易触发 CloudFlare 防火墙限制(这表现为请求时无法获取图片,并返回 403 错误码)。因此推荐设置至少一个登录凭据用于检索图片,当登录凭据设置为多个时,将会针对每个凭据的搜索次数进行平均分配。

## 获取与设置登录凭据
## 获取与设置登录凭据 {#configure-credentials}

1. 访问 [Danbooru](https://danbooru.donmai.us) 并登录。如果你还没有账号,你需要先注册一个账号。
1. 访问 [个人页面](https://danbooru.donmai.us/profile),找到 `API Key` 字样并点击其右方的 `View` 按钮。
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/plugins/e621.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ e621/e926 的登录凭据。如该项为空,则使用匿名登录。

由于 e621/e926 的 [API 限制](https://e621.net/help/api),每个凭据一秒内只能搜索两次图片,因此推荐设置至少一个登录凭据用于检索图片,当登录凭据设置为多个时,将会针对每个凭据的搜索次数进行平均分配。

## 获取与设置登录凭据
## 获取与设置登录凭据 {#configure-credentials}

1. 访问 [e621](https://e621.net/)[e926](https://e926.net/) 并登录。如果你还没有账号,你需要先注册一个账号。
1. 访问 [e621 的个人页面](https://e621.net/users/home)[e926 的个人页面](https://e926.net/users/home),点击 `Manage API Access` 按钮。
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/plugins/gelbooru.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Gelbooru 的登录凭据。如该项为空,则使用匿名登录。

由于 Gelbooru 的 API 限制,匿名用户极易触发防火墙限制(这表现为请求时无法获取图片,并返回 403 错误码)。因此推荐设置至少一个登录凭据用于检索图片,当登录凭据设置为多个时,将会针对每个凭据的搜索次数进行平均分配。

## 获取与设置登录凭据
## 获取与设置登录凭据 {#configure-credentials}

1. 访问 [Gelbooru](https://gelbooru.com) 并登录。如果你还没有账号,你需要先注册一个账号。
1. 访问 [个人页面](https://gelbooru.com/index.php?page=account&s=options) 并翻阅到页面底部找到 `API Access Credentials` 字样,复制其右侧的文本框的内容。
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/plugins/pixiv.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Pixiv APP API 的 `Refresh Token`。

使用 route 突破检测时的 AES 加密密钥。

## 突破 Pixiv 检测
## 突破 Pixiv 检测 {#bypass-pixiv-detection}

Pixiv 站点全站引入了图片防外部引用检测,主要是检测 HTTP 请求的 Referer 头。这个检测会阻止插件直接引用图片链接,导致部分适配器无法直接发送图片链接。为了解决这个问题,本插件提供了三种突破检测的方式。

Expand Down
8 changes: 5 additions & 3 deletions packages/danbooru/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ namespace DanbooruImageSource {
login: Schema.string().required().description('用户名。'),
apiKey: Schema.string().required().role('secret').description('API 密钥。'),
}),
).description(
'API 密钥对。[点击前往获取及设置教程](https://booru.koishi.chat/zh-CN/plugins/danbooru.html#获取与设置登录凭据)',
),
)
.default([])
.description(
'Danbooru 的登录凭据。[点击前往获取及设置教程](https://booru.koishi.chat/zh-CN/plugins/danbooru.html#configure-credentials)',
),
}).description('搜索设置'),
])
}
Expand Down
4 changes: 3 additions & 1 deletion packages/e621/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ namespace e621ImageSource {
}),
)
.default([])
.description('e621/e926 的登录凭据。'),
.description(
'e621/e926 的登录凭据。[点击前往获取及设置教程](https://booru.koishi.chat/zh-CN/plugins/e621.html#configure-credentials)',
),
userAgent: Schema.string().description('设置请求的 User Agent。').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',
Expand Down
4 changes: 3 additions & 1 deletion packages/gelbooru/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ namespace GelbooruImageSource {
Schema.object({
endpoint: Schema.string().description('Gelbooru 的 URL。').default('https://gelbooru.com/index.php'),
keyPairs: Schema.array(Schema.string().required().role('secret'))
.description('Gelbooru 的登录凭据。')
.description(
'Gelbooru 的登录凭据。[点击前往获取及设置教程](https://booru.koishi.chat/zh-CN/plugins/gelbooru.html#configure-credentials)',
)
.default([]),
}).description('搜索设置'),
])
Expand Down
4 changes: 3 additions & 1 deletion packages/konachan/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ namespace KonachanImageSource {
login: Schema.string().required().description('用户名'),
password: Schema.string().required().role('secret').description('密码'),
}),
).description('Konachan 的登录凭据。'),
)
.default([])
.description('Konachan 的登录凭据。'),
}).description('搜索设置'),
])
}
Expand Down
4 changes: 3 additions & 1 deletion packages/lolibooru/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ namespace LolibooruImageSource {
login: Schema.string().required().description('用户名'),
password: Schema.string().required().role('secret').description('密码'),
}),
).description('Lolibooru 的登录凭据。'),
)
.default([])
.description('Lolibooru 的登录凭据。'),
}).description('搜索设置'),
])
}
Expand Down
4 changes: 3 additions & 1 deletion packages/pixiv/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ namespace PixivImageSource {
Schema.const('route').description('使用插件本地反代'),
Schema.const('asset').description('下载到 assets 缓存'),
])
.description('突破 Pixiv 站点图片防外部引用检测的方式')
.description(
'突破 Pixiv 站点图片防外部引用检测的方式。[参考](https://booru.koishi.chat/zh-CN/plugins/pixiv.html#bypass-pixiv-detection)',
)
.default('proxy'),
}),
Schema.union([
Expand Down
6 changes: 4 additions & 2 deletions packages/sankaku/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ namespace SankakuComplexImageSource {
password: Schema.string().required().role('secret').description('SankakuComplex 密码'),
tokenType: Schema.string().hidden().default('Bearer').description('SankakuComplex 访问令牌类型'),
accessToken: Schema.string().hidden().description('SankakuComplex 访问令牌'),
}).description('SankakuComplex 的登录凭证'),
),
}),
)
.default([])
.description('SankakuComplex 的登录凭证'),
userAgent: Schema.string().description('设置请求的 User Agent。').default(
// eslint-disable-next-line max-len
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
Expand Down
4 changes: 3 additions & 1 deletion packages/yande/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ namespace YandeImageSource {
login: Schema.string().required().description('Yande.re 的用户名。'),
password: Schema.string().required().role('secret').description('Yande.re 的密码。'),
}),
).description('Yande.re 的登录凭据。'),
)
.default([])
.description('Yande.re 的登录凭据。'),
}).description('搜索设置'),
])
}
Expand Down

0 comments on commit 3df346e

Please sign in to comment.