Merge remote-tracking branch 'refs/remotes/yeyang52/master'

This commit is contained in:
2024-07-11 03:43:39 +08:00
6 changed files with 40 additions and 12 deletions

16
.github/ISSUE_TEMPLATE/question.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: 其他问题及意见反馈
description: 插件使用上的问题反馈、功能失效等。
title: "[问题反馈]: "
labels: ["question"]
body:
- type: input
attributes:
label: 反馈内容
description: 请简要描述您需要反馈的内容。
validations:
required: true
- type: textarea
attributes:
label: 其他说明
description: 如果您有任何其他信息或补充说明,请在这里添加。

View File

@@ -8,3 +8,9 @@ bikaDirectConnection: false
bikaImageProxy: s3.go2778.com/static
#哔咔图片质量,可选值 ['low', 'medium', 'high', 'original'] 质量依次从低到高
imageQuality: medium
#使用的hibiapi地址https://github.com/mixmoe/HibiAPI
hibiAPI: https://hibiapi.dengfenglai.icu
#哔咔搜索排序方式dd最新发布、da最早发布、ld最多喜欢、vd最多浏览
searchSort: ld
#隐藏哔咔搜索简略图
hideSearchImg: false

View File

@@ -35,7 +35,7 @@ export function supportGuoba() {
// 配置项 schemas
schemas: [
{
component: "whole.Divider",
component: "Divider",
label: "消息通知"
},
{

View File

@@ -188,10 +188,15 @@ export default new class {
*/
async proxyRequestImg(url, { cache, timeout, headers } = {}) {
if (!this.getAgent()) return segment.image(url, cache, timeout, headers)
const start = Date.now()
let Request = await this.get(url, {
headers
headers,
responseType: "buffer"
}).catch(err => logger.error(err))
return segment.image(Request?.body ?? `${Plugin_Path}/resources/img/imgerror.png`, cache, timeout)
const kb = Request ? logger.magenta((Request?.length / 1024).toFixed(2) + "kb") : logger.red("error")
const ms = logger.green(Date.now() - start + "ms")
logger.debug(`[Yenai-Plugin][proxyRequestImg][${_.truncate(url)}] ${kb} ${ms}`)
return segment.image(Request ?? `${Plugin_Path}/resources/img/imgerror.png`, cache, timeout)
}
_prepareRequest(options) {

View File

@@ -4,7 +4,7 @@ import { Config } from "../components/index.js"
export default new (class {
constructor() {
this.domain = "https://api.obfs.dev/api/bika"
this.domain = `${Config.bika.hibiAPI}/api/bika`
this.hearder = {
headers: {
"x-image-quality": Config.bika.imageQuality
@@ -28,6 +28,7 @@ export default new (class {
* @returns {Array<string>} 返回搜索结果信息数组
*/
async search(keyword, page = 1, type = "advanced", sort = "ld") {
sort = Config.bika.searchSort || sort
let types = [
{
alias: [ "关键词", "advanced", "高级" ],
@@ -60,14 +61,14 @@ export default new (class {
let { title, tags, categories, author, description = "未知", likesCount, thumb, _id, finished } = item
msg.push(_id)
msg.push([
`${index + 1}${title}\n`,
`作者:${author}\n`,
`描述:${_.truncate(description)}\n`,
`分类:${categories.join("")}\n`,
`喜欢:${likesCount}\n`,
`完结:${finished}\n`,
tags ? `tag${_.truncate(tags.join(","))}\n` : "",
await this._requestBikaImg(thumb.fileServer, thumb.path)
`${index + 1}${title}\n`,
`作者:${author}\n`,
`描述:${_.truncate(description)}\n`,
`分类:${categories.join("")}\n`,
`喜欢:${likesCount}\n`,
`完结:${finished}\n`,
tags ? `tag${_.truncate(tags.join(","))}\n` : "",
Config.bika.hideSearchImg ? "" : await this._requestBikaImg(thumb.fileServer, thumb.path)
])
}
return msg