diff --git a/dist/gkd.json b/dist/gkd.json index 30daa100..553158ec 100644 --- a/dist/gkd.json +++ b/dist/gkd.json @@ -1,6 +1,7 @@ { - "name": "GKD官方订阅", - "version": 6, + "id": 0, + "name": "默认订阅", + "version": 7, "author": "lisonge", "supportUrl": "https://github.com/gkd-kit/subscription", "apps": [ diff --git a/package.json b/package.json index 1e05efba..75cdc251 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@gkd-kit/subscription", "type": "module", - "version": "0.0.6", + "version": "0.0.7", "main": "./dist/gkd.json", "unpkg": "./dist/gkd.json", "jsdelivr": "./dist/gkd.json", diff --git a/src/file.ts b/src/file.ts index 856c4ff2..a7a45cab 100644 --- a/src/file.ts +++ b/src/file.ts @@ -78,6 +78,7 @@ export const writeConfig = async (fp: string, config: SubscriptionConfig) => { }); const sortKeys: (keyof SubscriptionConfig)[] = [ + `id`, `name`, `version`, `author`, diff --git a/src/main.ts b/src/main.ts index 07552a05..c8d782bd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,7 +12,8 @@ for await (const tsFp of walk(relativePath('./apps'))) { apps.sort((a, b) => (a.id > b.id ? 1 : -1)); await writeConfig(`../dist/gkd.json`, { - name: `GKD官方订阅`, + id: 0, + name: `默认订阅`, author: `lisonge`, supportUrl: `https://github.com/gkd-kit/subscription`, apps, diff --git a/src/types.ts b/src/types.ts index 3492a66a..a66c65e7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -56,20 +56,26 @@ type RuleConfig = { } & CommonProps; export type SubscriptionConfig = { - name?: string; + /** + * 当前订阅文件的标识, 如果新旧订阅文件id不一致则更新失败\ + * 范围: `[-Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER]`\ + * 建议值: `new Date().getTime()` + */ + id: number; + name: string; version?: number; - author?: string; + author: string; /** * https url * android file path */ updateUrl?: string; /** - * https url + * https url\ * android schema url, qq group */ supportUrl?: string; - apps?: AppConfig[]; + apps: AppConfig[]; }; export const defineSubsConfig = (config: SubscriptionConfig) => {