Skip to content

Commit

Permalink
refactor: simplify Pixiv configuration by removing following settings…
Browse files Browse the repository at this point in the history
… and updating user ID usage in providers
  • Loading branch information
Hoshino-Yumetsuki committed Dec 3, 2024
1 parent de78c99 commit 54f157a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
27 changes: 6 additions & 21 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ export interface Config {
isLog: boolean
pixiv: {
phpSESSID: string
following: {
userId: string
limit: number
}
userId: string
}
danbooru?: {
keyPairs: { login: string; apiKey: string }[]
Expand All @@ -40,7 +37,6 @@ export interface Config {
tokenType?: string
accessToken?: string
}[]
userAgent?: string
}
konachan?: {
keyPairs: { login: string; password: string }[]
Expand Down Expand Up @@ -142,17 +138,11 @@ export const Config: Schema<Config> = Schema.intersect([
.description(
'Pixiv 的 PHPSESSID,用于访问个性化内容。返回的图片分级取决于该 Pixiv 账号所有者的分级设置。'
)
.role('secret')
.default(''),
userId: Schema.string()
.description('Pixiv 用户 ID,用于获取关注列表')
.default(''),
following: Schema.object({
userId: Schema.string()
.description('Pixiv 用户 ID,用于获取关注列表')
.default(''),
limit: Schema.number()
.description('获取关注列表的数量限制')
.default(100)
.min(1)
.max(100)
}).description('Pixiv Following 设置')
}).description('Pixiv 设置')
}),

Expand Down Expand Up @@ -246,12 +236,7 @@ export const Config: Schema<Config> = Schema.intersect([
})
)
.default([])
.description('Sankaku Complex API 鉴权信息'),
userAgent: Schema.string()
.default(
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36'
)
.description('User Agent')
.description('Sankaku Complex API 鉴权信息')
}).description('Sankaku Complex 设置'),
konachan: Schema.object({
keyPairs: Schema.array(
Expand Down
2 changes: 1 addition & 1 deletion src/providers/pixiv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export class PixivFollowingSourceProvider extends PixivBaseProvider {
while (true) {
const url = PixivFollowingSourceProvider.FOLLOWING_URL.replace(
'{USER_ID}',
this.config.pixiv.following.userId
this.config.pixiv.userId
)
.replace('{OFFSET_COUNT}', offset.toString())
.replace('{LIMIT_COUNT}', LIMIT.toString())
Expand Down
3 changes: 2 additions & 1 deletion src/providers/sankaku.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {
} from '../utils/type'
import { SourceProvider } from '../utils/type'
import { logger } from '../index'
import { USER_AGENT } from '../utils/request'

interface SankakuPost {
id: number
Expand All @@ -31,7 +32,7 @@ export class SankakuSourceProvider extends SourceProvider {
super(ctx, config)
this.http = ctx.http.extend({
headers: {
'User-Agent': config.sankaku?.userAgent
'User-Agent': USER_AGENT
},
proxyAgent: config.isProxy ? config.proxyHost : undefined
})
Expand Down

0 comments on commit 54f157a

Please sign in to comment.