Skip to content

Commit 9f81975

Browse files
committed
feat: import way
1 parent 8e8c3a6 commit 9f81975

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

Template.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ Fork 本仓库的 `main`分支。
2424
```
2525
的李跳跳规则填写进入`ltt.json`,然后运行 github action 里的 `convert`
2626

27-
运行成功后,转换结果会出现在`-2.json`
27+
运行成功后,转换结果会出现在`-1.json`
28+
29+
然后参照[教程](https://ltt2gkd.adproqwq.xyz/tutoril.html)导入GKD,
30+
31+
当然,你也可以使用开源仓库、Github gist的方式导入。
2832

2933
由于hash的不可逆性,部分规则会因无法获取具体的应用信息,而被抛弃,具体抛弃数量可以查看`log.txt`
3034

@@ -52,7 +56,11 @@ pnpm i
5256
pnpm convert
5357
```
5458

55-
运行成功后,转换结果会出现在`-2.json`
59+
运行成功后,转换结果会出现在`-1.json`
60+
61+
然后参照[教程](https://ltt2gkd.adproqwq.xyz/tutoril.html)导入GKD,
62+
63+
当然,你也可以使用开源仓库、Github gist的方式导入。
5664

5765
由于hash的不可逆性,部分规则会因无法获取具体的应用信息,而被抛弃,具体抛弃数量可以查看`log.txt`
5866

@@ -96,7 +104,7 @@ pnpm run list
96104

97105
当前收录应用 --APPCOUNT-- 个,其中,添加应用补丁 --PATCHCOUNT-- 个。
98106

99-
注意:其中包含大量 OPPO、小米等 手机品牌和安卓系统的系统应用~~所以只是看起来多~~
107+
注意:其中包含大量各手机品牌和安卓系统的系统应用~~所以只是看起来多~~
100108

101109
## 致谢
102110

src/convert.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json5 from 'json5';
2-
import { RawSubscription, RawApp, RawAppGroup, RawAppRule, IArray } from '@gkd-kit/api';
3-
import { Root } from './types';
2+
import { RawApp, RawAppGroup, RawAppRule, IArray } from '@gkd-kit/api';
3+
import { Root, Subscription } from './types';
44
import { getJsonArrayLength, iArrayToArray, textRuleConvert, boundsRuleConvert } from './method'
55
import fs from 'node:fs/promises';
66

@@ -15,11 +15,7 @@ const convert = async () => {
1515
const originLength = getJsonArrayLength(origin);
1616
let throwCount = 0;
1717

18-
let thisSub: RawSubscription = {
19-
id: -2,
20-
name: '本地订阅',
21-
version: 1,
22-
author: 'gkd',
18+
let thisSub: Subscription = {
2319
globalGroups: [],
2420
categories: [],
2521
apps: [],
@@ -115,6 +111,6 @@ const convert = async () => {
115111

116112
await fs.writeFile(process.cwd() + '/log.txt', `共识别到应用${originLength}个,已抛弃${throwCount}个未知应用的规则`);
117113

118-
await fs.writeFile(process.cwd() + '/-2.json', JSON.stringify(thisSub));
114+
await fs.writeFile(process.cwd() + '/-1.json', JSON.stringify(thisSub));
119115
};
120116
convert();

src/types.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
export type Root = RawApp[];
1+
import { RawGlobalGroup ,RawCategory, RawApp } from "@gkd-kit/api";
2+
3+
export type Root = RawAppConfig[];
24

35
export type PatchApps = RawPatchApp[];
46

57
export type LogApps = LogRawApp[];
68

7-
export type RawApp = {
9+
export type Subscription = {
10+
globalGroups: RawGlobalGroup[],
11+
categories: RawCategory[],
12+
apps: RawApp[],
13+
};
14+
15+
export type RawAppConfig = {
816
/**
917
* 应用包名
1018
*/

0 commit comments

Comments
 (0)