From 2463dbbc2b0961fffccf9568cdfcf9aea8536c27 Mon Sep 17 00:00:00 2001 From: Shigma Date: Mon, 6 Nov 2023 01:14:50 +0800 Subject: [PATCH] fix: add config.endpoint, close #7 --- package.json | 10 ++-------- src/index.tsx | 6 +++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 7fc5074..068f601 100644 --- a/package.json +++ b/package.json @@ -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": [ @@ -25,11 +25,6 @@ "description": { "en": "Plugin market information", "zh": "插件市场查询与订阅,第一时间获知插件更新!" - }, - "service": { - "required": [ - "installer" - ] } }, "keywords": [ @@ -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" diff --git a/src/index.tsx b/src/index.tsx index 1b6d1ab..e087ffd 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -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 @@ -24,6 +22,7 @@ export const Rule: Schema = Schema.object({ export interface Config { rules: Rule[] + endpoint: string interval: number showHidden: boolean showDeletion: boolean @@ -33,6 +32,7 @@ export interface Config { export const Config: Schema = 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('是否显示删除的插件。'), @@ -53,7 +53,7 @@ export function apply(ctx: Context, config: Config) { } const getMarket = async () => { - const data = await ctx.http.get(ctx.installer.endpoint) + const data = await ctx.http.get(config.endpoint) return makeDict(data) }