Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/market/src/node/locales/schema.de-DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ search:
$description: 搜索设置
endpoint: 用于搜索插件市场的网址。默认跟随插件源设置。
timeout: 搜索插件市场的超时时间。
delay: 延迟多久后再开始首次同步。
proxyAgent: 用于搜索插件市场的代理。
1 change: 1 addition & 0 deletions plugins/market/src/node/locales/schema.en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ search:
$description: 搜索设置
endpoint: 用于搜索插件市场的网址。默认跟随插件源设置。
timeout: 搜索插件市场的超时时间。
delay: 延迟多久后再开始首次同步。
proxyAgent: 用于搜索插件市场的代理。
1 change: 1 addition & 0 deletions plugins/market/src/node/locales/schema.fr-FR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ search:
$description: 搜索设置
endpoint: 用于搜索插件市场的网址。默认跟随插件源设置。
timeout: 搜索插件市场的超时时间。
delay: 延迟多久后再开始首次同步。
proxyAgent: 用于搜索插件市场的代理。
1 change: 1 addition & 0 deletions plugins/market/src/node/locales/schema.ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ search:
$description: 搜索设置
endpoint: 用于搜索插件市场的网址。默认跟随插件源设置。
timeout: 搜索插件市场的超时时间。
delay: 延迟多久后再开始首次同步。
proxyAgent: 用于搜索插件市场的代理。
1 change: 1 addition & 0 deletions plugins/market/src/node/locales/schema.ru-RU.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ search:
$description: 搜索设置
endpoint: 用于搜索插件市场的网址。默认跟随插件源设置。
timeout: 搜索插件市场的超时时间。
delay: 延迟多久后再开始首次同步。
proxyAgent: 用于搜索插件市场的代理。
1 change: 1 addition & 0 deletions plugins/market/src/node/locales/schema.zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ search:
$description: 搜索设置
endpoint: 用于搜索插件市场的网址。默认跟随插件源设置。
timeout: 搜索插件市场的超时时间。
delay: 延迟多久后再开始首次同步。
proxyAgent: 用于搜索插件市场的代理。
1 change: 1 addition & 0 deletions plugins/market/src/node/locales/schema.zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ search:
$description: 搜尋設定
endpoint: 用於搜尋外掛程式市場的網址。默認跟隨外掛程式源設置。
timeout: 搜尋外掛程式市場的超時時間。
delay: 延遲多久後再開始首次同步。
proxyAgent: 用於搜尋外掛程式市場的代理。
7 changes: 6 additions & 1 deletion plugins/market/src/node/market.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Context, Dict, HTTP, Schema, Time } from 'koishi'
import { Context, Dict, HTTP, Schema, Time, sleep } from 'koishi'
import Scanner, { SearchObject, SearchResult } from '@koishijs/registry'
import { MarketProvider as BaseMarketProvider } from '../shared'

Expand Down Expand Up @@ -29,6 +29,9 @@ class MarketProvider extends BaseMarketProvider {
this.fullCache = {}
this.tempCache = {}
if (refresh) this.ctx.installer.refresh(true)
if (!refresh && this.config.delay) {
await sleep(this.config.delay)
}
await this.prepare()
super.start()
}
Expand Down Expand Up @@ -101,11 +104,13 @@ namespace MarketProvider {
export interface Config {
endpoint?: string
timeout?: number
delay?: number
}

export const Config: Schema<Config> = Schema.object({
endpoint: Schema.string().role('link'),
timeout: Schema.number().role('time').default(Time.second * 30),
delay: Schema.number().role('time').default(0).description('执行首次同步前的等待时间。'),
proxyAgent: Schema.string().role('link'),
})
}
Expand Down