Skip to content

Commit

Permalink
fix: add config.endpoint, close #7
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Nov 5, 2023
1 parent 15b9c54 commit 2463dbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "koishi-plugin-market-info",
"description": "Koishi plugin market information",
"version": "2.0.0",
"version": "2.0.1",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
Expand All @@ -25,11 +25,6 @@
"description": {
"en": "Plugin market information",
"zh": "插件市场查询与订阅,第一时间获知插件更新!"
},
"service": {
"required": [
"installer"
]
}
},
"keywords": [
Expand All @@ -47,9 +42,8 @@
"koishi": "^4.15.0"
},
"devDependencies": {
"@koishijs/plugin-market": "^2.3.1",
"@koishijs/registry": "^6.0.4",
"@types/node": "^18.15.5",
"@types/node": "^20.8.10",
"atsc": "^1.2.2",
"koishi": "^4.15.0",
"typescript": "^5.2.2"
Expand Down
6 changes: 3 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ const logger = new Logger('market')

export const name = 'market-info'

export const using = ['installer']

export interface Rule {
platform: string
channelId: string
Expand All @@ -24,6 +22,7 @@ export const Rule: Schema<Rule> = Schema.object({

export interface Config {
rules: Rule[]
endpoint: string
interval: number
showHidden: boolean
showDeletion: boolean
Expand All @@ -33,6 +32,7 @@ export interface Config {

export const Config: Schema<Config> = Schema.object({
rules: Schema.array(Rule).description('推送规则。'),
endpoint: Schema.string().default('https://registry.koishi.chat/index.json').description('插件市场地址。'),
interval: Schema.number().default(Time.minute * 30).description('轮询间隔 (毫秒)。'),
showHidden: Schema.boolean().default(false).description('是否显示隐藏的插件。'),
showDeletion: Schema.boolean().default(false).description('是否显示删除的插件。'),
Expand All @@ -53,7 +53,7 @@ export function apply(ctx: Context, config: Config) {
}

const getMarket = async () => {
const data = await ctx.http.get<SearchResult>(ctx.installer.endpoint)
const data = await ctx.http.get<SearchResult>(config.endpoint)
return makeDict(data)
}

Expand Down

0 comments on commit 2463dbb

Please sign in to comment.