diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..fb18af0a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,218 @@ +# 编写订阅贡献指南 + +很高兴能有更多人参与到本项目默认订阅规则的开发中 + +需要: 一台 Android 设备, 一台电脑(可选) + +## 环境搭建(无电脑跳过) + +本项目基于 nodejs + typescript + +- 安装 [nodejs](https://nodejs.org/) 或者 [volta](https://volta.sh/) +- 安装 [pnpm](https://pnpm.io/zh/installation) +- 建议安装 [Visual Studio Code](https://code.visualstudio.com/) +- Fork 本项目, 然后 Clone 至本地, 切换到项目根目录,安装依赖 `pnpm install` + +## 开始 + +首先我们需要给需要添加规则的APP打快照, 也就是把APP的广告截图节点信息给保存下来 + +首先打开APP-主页 -允许无障碍授权 + +Android>=11 的无障碍可以自己截屏, 所以如果你的设备不满足 Android>=11, 需要额外开启 高级设置-截屏服务 + +有 3 种方式打快照 + +- 通过悬浮窗按钮: 高级设置-允许悬浮窗授权 - 然后回到APP开启悬浮窗服务, 此时界面会出现一个截屏按钮, 点击这个按钮即可打快照 +- 通过按键快照: 高级设置-打开按键快照, 按下音量健即可打快照 +- 网页端审查工具: 打开网页端审查工具连接设备-点击快照按钮即可打快照, 网页端审查工具的使用在下面说明 + +我们以 WPS 为例子, WPS 首页文档列表有一个广告, 我们先给 WPS 打一个快照, 然后使用 网页审查工具 编写测试规则订阅 关闭这个广告 + +打开 WPS, 然后使用上面 3 种方式之一打快照, 然后打开设置-高级设置-快照记录, 可以看到已经有了一个快照记录 + +
+ 截图: 快照记录 + +![image](https://github.com/gkd-kit/subscription/assets/38517192/ea86d3eb-00c4-44aa-b4a8-a42c08052404) + +
+ +如果你没有电脑, 可以点击快照-分享-此时会分享一个zip文件, 截图和节点信息全在里面, 可以分享到某个云盘或者保存到本地, 然后在 [subscription/issues/new](https://github.com/gkd-kit/subscription/issues/new) 上传这个 zip 或者填写分享链接, 然后提出问题, 项目维护者会帮助你处理这个快照 + +
+ 截图: 分享快照 + +![image](https://github.com/gkd-kit/subscription/assets/38517192/8f37ce6b-4027-4679-988f-27730f60c971) + +
+ +有电脑, 接下来我们将使用 网页审查工具 + +首先让 Android 设备 和 电脑 处于同一个局域网(连接同一个WIFI), 也可以 Android 开热点, 然后电脑连接这个热点 + +打开 APP 主页-设置-高级设置-HTTP服务, 此时 HTTP 服务底部出现一条地址 `http://192.168.1.3:8888` + +
+ 示例: HTTP服务 + +![image](https://github.com/gkd-kit/subscription/assets/38517192/27aa1a3a-4096-4a0e-97ca-27a709645bba) + +
+ +安装油猴脚本 , 因为浏览器不允许 https 去连接 http 域名, 可以通过油猴脚本绕过这个限制 + +浏览器打开 , 然后在这个网站启用油猴脚本的注入功能, 然后点击右上角 Android 小图标去连接设备 + +在设置页面左上角输入上诉地址 `http://192.168.1.3:8888`, 然后点击 `刷新连接`, 即可成功连接设备 + +![image](https://github.com/gkd-kit/subscription/assets/38517192/d3a956ca-f54b-4d9d-a2ae-3792b5a18aa4) + +可以看到第一个项目就是我们刚刚在 WPS 打的快照, 点击这个项目右侧的 `查看` 按钮 + +我们就能在电脑上审查 这个快照 + +## 审查快照 + +很明显我们只需要点击文字 `小米·广告` 右侧关闭图标即可 + +![image](https://github.com/gkd-kit/subscription/assets/38517192/96c78639-d304-4950-80f2-2b8f23cdaf36) + +我们把鼠标直接放到这个图标上去, 然后点击它, 可以看到中间的节点树已经展开, 右侧也出现了属性列表 + +很明显这个图标按钮具有一个唯一的 id `com.mopub.ad.xiaomi:id/nativeclose`, 接下来编写一个简单的规则去点击它 + +那么先去了解一下这个选择器 , 如果你写过 CSS, 应该对这个选择器很熟悉 + +了解完了之后, 编写的选择器也很简单 `[id="com.mopub.ad.xiaomi:id/nativeclose"]` + +接下来测试这个选择器能否选中这个图标按钮, 点击审查工具的 选择器查询, 输入刚刚这个规则, 然后点击查询 + +![image](https://github.com/gkd-kit/subscription/assets/38517192/3aea04fd-da91-4f43-a79e-e40fdad4a5d4) + +很明显这个选择器是有效的, 那么我们去真机测试这个选择器到底行8行 + +回到刚刚的设备连接页面, 点击顶部的 `执行选择器` 按钮, 然后手机回到 WPS 界面等待出现广告 + +点击执行选择器确定按钮, 发现提示 `无点击目标`, 这是为什么呢, 我们对这个页面再打一个快照看看 + + 鼠标移动到截图里的广告关闭按钮上去点击后查看节点树和属性面板 + +发现这个图标按钮的属性id已经变成了 `cn.wps.moffice_eng:id/nativeclose`, 于是我们需要扩展一下刚刚的选择器, 确保两个按钮都能选中 + +把这个选择器改成 `[id$="/nativeclose"]`, 这样两个节点都能选上 + +回到网页端设备连接界面-执行选择器-输入 `[id$="/nativeclose"]` 点击确认 + +![2023-09-03_15-24-55](https://github.com/gkd-kit/subscription/assets/38517192/113219f1-164c-40c9-bf76-a9b2a3f66503) + +可以看到点击成功了, 但是出现了另外一个弹窗了, 叫你选择关闭原因, 这时我们直接点击网页端的快照按钮得到新快照 + +点击截图里的 `关闭当前广告`, 查看属性面板, 编写测试选择器 `[text="关闭当前广告"]`, 去执行 执行选择器 + +![2023-09-03_15-31-18](https://github.com/gkd-kit/subscription/assets/38517192/ab99c7fb-6e7d-45de-b969-58db41519df7) + +那么选择器部分就基本没问题了, 接下来实时编写规则 + +## 编写订阅 + +订阅规则各个属性作用可以查看 [types.ts](https://github.com/gkd-kit/subscription/blob/main/src/types.ts) + +打开浏览器设备连接页面-点击修改内存订阅, 输入如下内容, 然后点击确认 + +```text +// 订阅使用 JSON5 语法, 根节点可以是数组也可以是对象 +{ + id: 'cn.wps.moffice_eng', + name: 'WPS', + groups: [ + { + key: 1, + name: '首页-文档列表广告', + activityIds: ['cn.wps.moffice.main.StartPublicActivity', 'cn.wps.moffice.main.local.HomeRootActivity'], + rules: [ + { + matches: '[text="关闭当前广告"]', + snapshotUrls: 'https://gkd-kit.gitee.io/import/12505365', + }, + { + matches: '[id$="/ll_close"]', + snapshotUrls: [ + 'https://gkd-kit.gitee.io/import/12505350', + 'https://gkd-kit.gitee.io/import/12505286', + ], + }, + ], + }, + ], +} +``` + +此时回到APP首页-订阅, 会发现多了一条订阅 + +![image](https://github.com/gkd-kit/subscription/assets/38517192/89413281-4ad3-4c9c-aee5-97eb9da4bcd0) + +接下来把 WPS 清除全部数据后重新打开, 可以看到规则已经生效, 广告已经被自动关闭 + +![2023-09-03_15-55-18](https://github.com/gkd-kit/subscription/assets/38517192/57787554-0443-4bc0-9f29-1759aae07b9b) + +当你关闭 HTTP 服务器时, 这个内存订阅也会被清除 + +## 提交代码 + +如果你要添加 APP 不存在本项目, 那么需要在 [apps](https://github.com/gkd-kit/subscription/tree/main/src/apps) 目录下新建文件 xxx.ts, xxx 是 appId 比如 WPS 是 cn.wps.moffice_eng.ts + +这个文件的初始内容是 + +```ts +import { defineAppConfig } from '../types'; + +export default defineAppConfig({ + id: 'cn.wps.moffice_eng', + name: 'WPS', + groups: [], +}); +``` + +然后在的 group 节点后添加你的规则及其快照链接, 文件内容变成 + +```ts +import { defineAppConfig } from '../types'; + +export default defineAppConfig({ + id: 'cn.wps.moffice_eng', + name: 'WPS', + groups: [ + { + key: 1, + name: '首页-文档列表广告', + exampleUrls: [ + 'https://github.com/gkd-kit/subscription/assets/38517192/57787554-0443-4bc0-9f29-1759aae07b9b', + ], + activityIds: [ + 'cn.wps.moffice.main.StartPublicActivity', + 'cn.wps.moffice.main.local.HomeRootActivity', + ], + rules: [ + { + matches: '[text="关闭当前广告"]', + snapshotUrls: 'https://gkd-kit.gitee.io/import/12505365', + }, + { + matches: '[id$="/nativeclose"]', + snapshotUrls: [ + 'https://gkd-kit.gitee.io/import/12505350', + 'https://gkd-kit.gitee.io/import/12505286', + ], + }, + ], + }, + ], +}); +``` + +注意每个规则一定要添加快照链接, 否则后期维护根本不知道这个规则到底点的是啥 + +然后运行校验命令 `npm run check`, 它会检测你的规则是否书写正确, 也会检测每个选择器语法是否正确 + +然后提交这个文件发起 pr 即可 diff --git a/README.md b/README.md index d35de07a..2d0e2e57 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ 搞快点 APP 默认订阅规则 -当前订阅文件已适配 81 个 APP, 共有 136 规则组 +当前订阅文件已适配 81 个 APP, 共有 137 规则组 + +如何编写订阅/贡献此项目 -> [CONTRIBUTING.md](./CONTRIBUTING.md) ## 适配 APP 列表 @@ -26,6 +28,11 @@ ### [cn.wps.moffice_eng](/src/apps/cn.wps.moffice_eng.ts) - WPS - 开屏广告 +- 首页-文档列表广告 + - [示例-0](https://github.com/gkd-kit/subscription/assets/38517192/57787554-0443-4bc0-9f29-1759aae07b9b) + - [快照-0](https://gkd-kit.gitee.io/import/12505365) + - [快照-1](https://gkd-kit.gitee.io/import/12505350) + - [快照-2](https://gkd-kit.gitee.io/import/12505286) ### [com.MobileTicket](/src/apps/com.MobileTicket.ts) - 铁路12306 @@ -33,7 +40,7 @@ ### [com.UCMobile](/src/apps/com.UCMobile.ts) - UC浏览器 -- 开屏广告 +- 开屏广告 - 空规则组-待实现 - 推荐页广告 ### [com.achievo.vipshop](/src/apps/com.achievo.vipshop.ts) - 唯品会 diff --git a/Template.md b/Template.md index f597e85f..17db555d 100644 --- a/Template.md +++ b/Template.md @@ -4,6 +4,8 @@ 当前订阅文件已适配 --APP_SIZE-- 个 APP, 共有 --GROUP_SIZE-- 规则组 +如何编写订阅/贡献此项目 -> [CONTRIBUTING.md](./CONTRIBUTING.md) + ## 适配 APP 列表 --APP_LIST-- diff --git a/dist/gkd.json b/dist/gkd.json index 12afc760..e5f6a9ef 100644 --- a/dist/gkd.json +++ b/dist/gkd.json @@ -1,7 +1,7 @@ { "id": 0, "name": "默认订阅", - "version": 44, + "version": 45, "author": "lisonge", "supportUri": "https://github.com/gkd-kit/subscription", "apps": [ @@ -82,6 +82,30 @@ "name": "开屏广告", "activityIds": "cn.wps.moffice.documentmanager.PreStartActivity", "rules": "[id=`cn.wps.moffice_eng:id/splash_skip`]" + }, + { + "key": 1, + "name": "首页-文档列表广告", + "exampleUrls": [ + "https://github.com/gkd-kit/subscription/assets/38517192/57787554-0443-4bc0-9f29-1759aae07b9b" + ], + "activityIds": [ + "cn.wps.moffice.main.StartPublicActivity", + "cn.wps.moffice.main.local.HomeRootActivity" + ], + "rules": [ + { + "matches": "[text=\"关闭当前广告\"]", + "snapshotUrls": "https://gkd-kit.gitee.io/import/12505365" + }, + { + "matches": "[id$=\"/nativeclose\"]", + "snapshotUrls": [ + "https://gkd-kit.gitee.io/import/12505350", + "https://gkd-kit.gitee.io/import/12505286" + ] + } + ] } ] }, @@ -104,6 +128,7 @@ { "key": -1, "name": "开屏广告", + "desc": "空规则组-待实现", "activityIds": "com.uc.browser.InnerUCMobile" }, { @@ -1046,12 +1071,12 @@ "key": 2, "name": "关闭不感兴趣广告弹窗", "activityIds": "com.sina.weibo.view.bottomsheet.dialog.", - "rules": [ - [ + "rules": { + "matches": [ "[text=\"为何会看到此广告\"]", "[text=\"不感兴趣\"]" ] - ] + } } ] }, diff --git a/package.json b/package.json index 6dc3360c..171dd473 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@gkd-kit/subscription", "type": "module", - "version": "0.0.44", + "version": "0.0.45", "main": "./dist/gkd.json", "unpkg": "./dist/gkd.json", "jsdelivr": "./dist/gkd.json", @@ -13,7 +13,8 @@ "./dist" ], "scripts": { - "build": "tsx ./src/main.ts" + "build": "tsc --noEmit && tsx ./scripts/build.ts", + "check": "tsc --noEmit && tsx ./scripts/check.ts" }, "devDependencies": { "@gkd-kit/selector": "0.0.11", diff --git a/scripts/build.ts b/scripts/build.ts new file mode 100644 index 00000000..5ee547b7 --- /dev/null +++ b/scripts/build.ts @@ -0,0 +1,4 @@ +import subsConfig from '../src/config'; +import { writeConfig } from '../src/file'; + +await writeConfig(process.cwd() + `/dist/gkd.json`, subsConfig); diff --git a/scripts/check.ts b/scripts/check.ts new file mode 100644 index 00000000..be94822c --- /dev/null +++ b/scripts/check.ts @@ -0,0 +1,7 @@ +import subsConfig from '../src/config'; +import { checkConfig } from '../src/file'; +import picocolors from 'picocolors'; + +checkConfig(subsConfig); + +console.log(picocolors.green(`校验成功, 合法订阅`)); diff --git a/src/apps/air.tv.douyu.android.ts b/src/apps/air.tv.douyu.android.ts index 35801d10..a6b9cc88 100644 --- a/src/apps/air.tv.douyu.android.ts +++ b/src/apps/air.tv.douyu.android.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'air.tv.douyu.android', name: `斗鱼`, groups: [ @@ -42,4 +42,4 @@ export default { rules: '[text="立即升级"] - [text="忽略"][clickable=true]', }, ], -}; +}); diff --git a/src/apps/cmb.pb.ts b/src/apps/cmb.pb.ts index ee2be157..fec0f979 100644 --- a/src/apps/cmb.pb.ts +++ b/src/apps/cmb.pb.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'cmb.pb', name: '招商银行', groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`cmb.pb:id/ll_launch_ad_skip_hot_area`]', }, ], -}; +}); diff --git a/src/apps/cn.damai.ts b/src/apps/cn.damai.ts index c4ebe286..536b3de0 100644 --- a/src/apps/cn.damai.ts +++ b/src/apps/cn.damai.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'cn.damai', name: `大麦`, groups: [ @@ -12,4 +12,4 @@ export default { snapshotUrls: `https://gkd-kit.gitee.io/import/38517192/38859663-6f0c-48b1-9392-20ae937a8c9e`, }, ], -}; +}); diff --git a/src/apps/cn.wps.moffice_eng.ts b/src/apps/cn.wps.moffice_eng.ts index cce79a9c..02f3a372 100644 --- a/src/apps/cn.wps.moffice_eng.ts +++ b/src/apps/cn.wps.moffice_eng.ts @@ -1,8 +1,8 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'cn.wps.moffice_eng', - name: `WPS`, + name: 'WPS', groups: [ { key: 0, @@ -10,5 +10,29 @@ export default { activityIds: 'cn.wps.moffice.documentmanager.PreStartActivity', rules: '[id=`cn.wps.moffice_eng:id/splash_skip`]', }, + { + key: 1, + name: '首页-文档列表广告', + exampleUrls: [ + 'https://github.com/gkd-kit/subscription/assets/38517192/57787554-0443-4bc0-9f29-1759aae07b9b', + ], + activityIds: [ + 'cn.wps.moffice.main.StartPublicActivity', + 'cn.wps.moffice.main.local.HomeRootActivity', + ], + rules: [ + { + matches: '[text="关闭当前广告"]', + snapshotUrls: 'https://gkd-kit.gitee.io/import/12505365', + }, + { + matches: '[id$="/nativeclose"]', + snapshotUrls: [ + 'https://gkd-kit.gitee.io/import/12505350', + 'https://gkd-kit.gitee.io/import/12505286', + ], + }, + ], + }, ], -}; +}); diff --git a/src/apps/com.MobileTicket.ts b/src/apps/com.MobileTicket.ts index f03ac762..432bc8d0 100644 --- a/src/apps/com.MobileTicket.ts +++ b/src/apps/com.MobileTicket.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.MobileTicket', name: `铁路12306`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.MobileTicket:id/tv_skip`]', }, ], -}; +}); diff --git a/src/apps/com.UCMobile.ts b/src/apps/com.UCMobile.ts index e75a3924..2e4a43b6 100644 --- a/src/apps/com.UCMobile.ts +++ b/src/apps/com.UCMobile.ts @@ -1,12 +1,13 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.UCMobile', name: `UC浏览器`, groups: [ { key: -1, name: `开屏广告`, + desc: `空规则组-待实现`, activityIds: `com.uc.browser.InnerUCMobile`, // TODO }, @@ -20,4 +21,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.achievo.vipshop.ts b/src/apps/com.achievo.vipshop.ts index 1406bbc2..874e7fe7 100644 --- a/src/apps/com.achievo.vipshop.ts +++ b/src/apps/com.achievo.vipshop.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.achievo.vipshop', name: `唯品会`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.achievo.vipshop:id/adv_countdown`]', }, ], -}; +}); diff --git a/src/apps/com.alibaba.wireless.ts b/src/apps/com.alibaba.wireless.ts index 6c580b30..56fdf0db 100644 --- a/src/apps/com.alibaba.wireless.ts +++ b/src/apps/com.alibaba.wireless.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.alibaba.wireless', name: `阿里巴巴`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.alibaba.wireless:id/v5_splash_over`]', }, ], -}; +}); diff --git a/src/apps/com.android.bankabc.ts b/src/apps/com.android.bankabc.ts index a4472dfc..ef37beb8 100644 --- a/src/apps/com.android.bankabc.ts +++ b/src/apps/com.android.bankabc.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.android.bankabc', name: `中国农业银行`, groups: [ @@ -12,4 +12,4 @@ export default { snapshotUrls: `https://gkd-kit.gitee.io/import/38517192/3653218a-e0e0-4a60-8308-dea5fd4179b3`, }, ], -}; +}); diff --git a/src/apps/com.android.thememanager.ts b/src/apps/com.android.thememanager.ts index c891e859..01453b59 100644 --- a/src/apps/com.android.thememanager.ts +++ b/src/apps/com.android.thememanager.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.android.thememanager', name: `miui主题壁纸`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.android.thememanager:id/ad_close_btn`]', }, ], -}; +}); diff --git a/src/apps/com.anjuke.android.app.ts b/src/apps/com.anjuke.android.app.ts index be6d82b2..4015399e 100644 --- a/src/apps/com.anjuke.android.app.ts +++ b/src/apps/com.anjuke.android.app.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.anjuke.android.app', name: `安居客`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.anjuke.android.app:id/skip_btn`]', }, ], -}; +}); diff --git a/src/apps/com.baidu.BaiduMap.ts b/src/apps/com.baidu.BaiduMap.ts index 88575405..d7069588 100644 --- a/src/apps/com.baidu.BaiduMap.ts +++ b/src/apps/com.baidu.BaiduMap.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.baidu.BaiduMap', name: `百度地图`, groups: [ @@ -14,4 +14,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.baidu.homework.ts b/src/apps/com.baidu.homework.ts index 2d8ead57..e88cf6fe 100644 --- a/src/apps/com.baidu.homework.ts +++ b/src/apps/com.baidu.homework.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.baidu.homework', name: `作业帮`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.baidu.homework:id/adx_splash_skip_text`]', }, ], -}; +}); diff --git a/src/apps/com.baidu.netdisk.ts b/src/apps/com.baidu.netdisk.ts index 10ef8d87..53f67cc1 100644 --- a/src/apps/com.baidu.netdisk.ts +++ b/src/apps/com.baidu.netdisk.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.baidu.netdisk', name: `百度网盘`, groups: [ @@ -18,4 +18,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.baidu.tieba.ts b/src/apps/com.baidu.tieba.ts index 39644cc9..c22daf98 100644 --- a/src/apps/com.baidu.tieba.ts +++ b/src/apps/com.baidu.tieba.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.baidu.tieba', name: `百度贴吧`, groups: [ @@ -78,4 +78,4 @@ export default { snapshotUrls: `https://gkd-kit.gitee.io/import/12496934`, }, ], -}; +}); diff --git a/src/apps/com.baidutieba.davy.ts b/src/apps/com.baidutieba.davy.ts index 8c8a79b1..e44be009 100644 --- a/src/apps/com.baidutieba.davy.ts +++ b/src/apps/com.baidutieba.davy.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.baidutieba.davy', name: '贴吧一键签到大师', groups: [ @@ -30,4 +30,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.bjsk.intelligent.ts b/src/apps/com.bjsk.intelligent.ts index a82f89d9..4a3abfeb 100644 --- a/src/apps/com.bjsk.intelligent.ts +++ b/src/apps/com.bjsk.intelligent.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.bjsk.intelligent', name: `WiFi智能钥匙`, groups: [ @@ -23,4 +23,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.cmcc.cmvideo.ts b/src/apps/com.cmcc.cmvideo.ts index 9869bf73..c907f7f2 100644 --- a/src/apps/com.cmcc.cmvideo.ts +++ b/src/apps/com.cmcc.cmvideo.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.cmcc.cmvideo', name: `咪咕视频`, groups: [ @@ -25,4 +25,4 @@ export default { snapshotUrls: `https://gkd-kit.gitee.io/import/12498315`, }, ], -}; +}); diff --git a/src/apps/com.coolapk.market.ts b/src/apps/com.coolapk.market.ts index 40970d35..494d702c 100644 --- a/src/apps/com.coolapk.market.ts +++ b/src/apps/com.coolapk.market.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.coolapk.market', name: `酷安`, groups: [ @@ -48,4 +48,4 @@ export default { rules: '[text=`立即更新`] - [text=`取消`]', }, ], -}; +}); diff --git a/src/apps/com.copymanga.app.ts b/src/apps/com.copymanga.app.ts index 8e05af95..b97d4700 100644 --- a/src/apps/com.copymanga.app.ts +++ b/src/apps/com.copymanga.app.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.copymanga.app', name: '拷貝漫畫', groups: [ @@ -62,4 +62,4 @@ export default { }, }, ], -}; +}); diff --git a/src/apps/com.ct.client.ts b/src/apps/com.ct.client.ts index 4f99f6d0..e0cde607 100644 --- a/src/apps/com.ct.client.ts +++ b/src/apps/com.ct.client.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.ct.client', name: `中国电信`, groups: [ @@ -14,4 +14,4 @@ export default { rules: '[id=`com.ct.client:id/tvSkip`]', }, ], -}; +}); diff --git a/src/apps/com.daimajia.gold.ts b/src/apps/com.daimajia.gold.ts index 8f2a15a3..dc00c6c2 100644 --- a/src/apps/com.daimajia.gold.ts +++ b/src/apps/com.daimajia.gold.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.daimajia.gold', name: `稀土掘金`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.daimajia.gold:id/fl_skip`]', }, ], -}; +}); diff --git a/src/apps/com.dianping.v1.ts b/src/apps/com.dianping.v1.ts index 8ae76e50..8245414d 100644 --- a/src/apps/com.dianping.v1.ts +++ b/src/apps/com.dianping.v1.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.dianping.v1', name: `大众点评`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.dianping.v1:id/new_skip`]', }, ], -}; +}); diff --git a/src/apps/com.douban.frodo.ts b/src/apps/com.douban.frodo.ts index 1b0e6f29..118c032f 100644 --- a/src/apps/com.douban.frodo.ts +++ b/src/apps/com.douban.frodo.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.douban.frodo', name: '豆瓣', groups: [ @@ -15,4 +15,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.dragon.read.ts b/src/apps/com.dragon.read.ts index c3039eea..980c318c 100644 --- a/src/apps/com.dragon.read.ts +++ b/src/apps/com.dragon.read.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.dragon.read', name: `番茄免费小说`, groups: [ @@ -19,4 +19,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.duokan.phone.remotecontroller.ts b/src/apps/com.duokan.phone.remotecontroller.ts index 37a3e534..d9c5ec7f 100644 --- a/src/apps/com.duokan.phone.remotecontroller.ts +++ b/src/apps/com.duokan.phone.remotecontroller.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.duokan.phone.remotecontroller', name: `万能遥控`, groups: [ @@ -13,4 +13,4 @@ export default { 'ImageView[id=`com.duokan.phone.remotecontroller:id/image_close_banner`]', }, ], -}; +}); diff --git a/src/apps/com.duowan.kiwi.ts b/src/apps/com.duowan.kiwi.ts index d49bafd3..794c01b9 100644 --- a/src/apps/com.duowan.kiwi.ts +++ b/src/apps/com.duowan.kiwi.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.duowan.kiwi', name: `虎牙直播`, groups: [ @@ -24,4 +24,4 @@ export default { '[id=`com.duowan.kiwi:id/hyui_dialog_button_positive`][text=`我知道了`]', }, ], -}; +}); diff --git a/src/apps/com.google.android.youtube.ts b/src/apps/com.google.android.youtube.ts index 93a93850..3bddde53 100644 --- a/src/apps/com.google.android.youtube.ts +++ b/src/apps/com.google.android.youtube.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.google.android.youtube', name: `youtube`, groups: [ @@ -12,4 +12,4 @@ export default { rules: '[id=`com.google.android.youtube:id/skip_ad_button`]', }, ], -}; +}); diff --git a/src/apps/com.gotokeep.keep.ts b/src/apps/com.gotokeep.keep.ts index 37a5e4a6..2c85c7ea 100644 --- a/src/apps/com.gotokeep.keep.ts +++ b/src/apps/com.gotokeep.keep.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.gotokeep.keep', name: `Keep`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.gotokeep.keep:id/textSkip`]', }, ], -}; +}); diff --git a/src/apps/com.greenpoint.android.mc10086.activity.ts b/src/apps/com.greenpoint.android.mc10086.activity.ts index b379b0cb..dff1135d 100644 --- a/src/apps/com.greenpoint.android.mc10086.activity.ts +++ b/src/apps/com.greenpoint.android.mc10086.activity.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.greenpoint.android.mc10086.activity', name: `中国移动`, groups: [ @@ -12,4 +12,4 @@ export default { '[id=`com.greenpoint.android.mc10086.activity:id/video_time_skip`]', }, ], -}; +}); diff --git a/src/apps/com.handsgo.jiakao.android.ts b/src/apps/com.handsgo.jiakao.android.ts index 9aea35a1..f163b998 100644 --- a/src/apps/com.handsgo.jiakao.android.ts +++ b/src/apps/com.handsgo.jiakao.android.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.handsgo.jiakao.android', name: `驾考宝典`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.handsgo.jiakao.android:id/closeLayout`]', }, ], -}; +}); diff --git a/src/apps/com.hunantv.imgo.activity.ts b/src/apps/com.hunantv.imgo.activity.ts index 2c8d84c1..dbe2c282 100644 --- a/src/apps/com.hunantv.imgo.activity.ts +++ b/src/apps/com.hunantv.imgo.activity.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.hunantv.imgo.activity', name: `芒果TV`, groups: [ @@ -44,4 +44,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.hupu.shihuo.ts b/src/apps/com.hupu.shihuo.ts index 742b5013..33fc6479 100644 --- a/src/apps/com.hupu.shihuo.ts +++ b/src/apps/com.hupu.shihuo.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.hupu.shihuo', name: `识货`, groups: [ @@ -12,4 +12,4 @@ export default { rules: '[id=`com.hupu.shihuo:id/fl_countdown`]', }, ], -}; +}); diff --git a/src/apps/com.hxak.liangongbao.ts b/src/apps/com.hxak.liangongbao.ts index e32c5739..87f56ff5 100644 --- a/src/apps/com.hxak.liangongbao.ts +++ b/src/apps/com.hxak.liangongbao.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.hxak.liangongbao', name: `链工宝`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.hxak.liangongbao:id/time_down`]', }, ], -}; +}); diff --git a/src/apps/com.icbc.ts b/src/apps/com.icbc.ts index 83dbd07d..3f5b072e 100644 --- a/src/apps/com.icbc.ts +++ b/src/apps/com.icbc.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.icbc', name: `中国工商银行`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.icbc:id/close_btn`]', }, ], -}; +}); diff --git a/src/apps/com.intsig.camscanner.ts b/src/apps/com.intsig.camscanner.ts index a9edc874..7d51508d 100644 --- a/src/apps/com.intsig.camscanner.ts +++ b/src/apps/com.intsig.camscanner.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.intsig.camscanner', name: `扫描全能王`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.intsig.camscanner:id/tv_drop_cnl_close_new`]', }, ], -}; +}); diff --git a/src/apps/com.iqiyi.hotchat.ts b/src/apps/com.iqiyi.hotchat.ts index 9441e1d8..5c13bd70 100644 --- a/src/apps/com.iqiyi.hotchat.ts +++ b/src/apps/com.iqiyi.hotchat.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.iqiyi.hotchat', name: `爱奇艺热聊`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.iqiyi.hotchat:id/tv_advertisement_lunch_skip`]', }, ], -}; +}); diff --git a/src/apps/com.jym.mall.ts b/src/apps/com.jym.mall.ts index 5e81df59..139415b0 100644 --- a/src/apps/com.jym.mall.ts +++ b/src/apps/com.jym.mall.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.jym.mall', name: `交易猫`, groups: [ @@ -11,4 +11,4 @@ export default { snapshotUrls: `https://gkd-kit.gitee.io/import/12496974`, }, ], -}; +}); diff --git a/src/apps/com.kmxs.reader.ts b/src/apps/com.kmxs.reader.ts index 39618c48..2e0cace7 100644 --- a/src/apps/com.kmxs.reader.ts +++ b/src/apps/com.kmxs.reader.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.kmxs.reader', name: `七猫免费小说`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.kmxs.reader:id/young_dialog_close`]', }, ], -}; +}); diff --git a/src/apps/com.kuaikan.comic.ts b/src/apps/com.kuaikan.comic.ts index 77dd1e32..fc8bc54f 100644 --- a/src/apps/com.kuaikan.comic.ts +++ b/src/apps/com.kuaikan.comic.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.kuaikan.comic', name: `快看`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.kuaikan.comic:id/skip_button`]', }, ], -}; +}); diff --git a/src/apps/com.kugou.android.ts b/src/apps/com.kugou.android.ts index d9bfa5b5..a1f922ab 100644 --- a/src/apps/com.kugou.android.ts +++ b/src/apps/com.kugou.android.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.kugou.android', name: `酷狗音乐`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[desc=`跳过`]', }, ], -}; +}); diff --git a/src/apps/com.kwai.videoeditor.ts b/src/apps/com.kwai.videoeditor.ts index b105cdb1..d9109dd9 100644 --- a/src/apps/com.kwai.videoeditor.ts +++ b/src/apps/com.kwai.videoeditor.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.kwai.videoeditor', name: `快影`, groups: [ @@ -12,4 +12,4 @@ export default { snapshotUrls: `https://gkd-kit.gitee.io/import/38517192/d12c3b08-8233-4584-b2b9-595ebb4ce665`, }, ], -}; +}); diff --git a/src/apps/com.mihoyo.hyperion.ts b/src/apps/com.mihoyo.hyperion.ts index acbd0542..b33e9ff0 100644 --- a/src/apps/com.mihoyo.hyperion.ts +++ b/src/apps/com.mihoyo.hyperion.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.mihoyo.hyperion', name: `米游社`, groups: [ @@ -21,4 +21,4 @@ export default { rules: 'TextView[id=`com.mihoyo.hyperion:id/tv_dialog_i_know`]', }, ], -}; +}); diff --git a/src/apps/com.miui.player.ts b/src/apps/com.miui.player.ts index aee25035..68318a11 100644 --- a/src/apps/com.miui.player.ts +++ b/src/apps/com.miui.player.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.miui.player', name: `小米音乐`, groups: [ @@ -12,4 +12,4 @@ export default { '@TextView[text$=`跳过`] + TextView[id=`com.miui.player:id/ad_view`]', }, ], -}; +}); diff --git a/src/apps/com.miui.systemAdSolution.ts b/src/apps/com.miui.systemAdSolution.ts index 4bbae064..c6059bda 100644 --- a/src/apps/com.miui.systemAdSolution.ts +++ b/src/apps/com.miui.systemAdSolution.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.miui.systemAdSolution', name: `miui系统广告`, groups: [ @@ -17,4 +17,4 @@ export default { rules: '[id=`com.miui.systemAdSolution:id/no_interest`]', }, ], -}; +}); diff --git a/src/apps/com.mt.mtxx.mtxx.ts b/src/apps/com.mt.mtxx.mtxx.ts index 9959f0cb..de30181b 100644 --- a/src/apps/com.mt.mtxx.mtxx.ts +++ b/src/apps/com.mt.mtxx.mtxx.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.mt.mtxx.mtxx', name: `美图秀秀`, groups: [ @@ -12,4 +12,4 @@ export default { snapshotUrls: `https://gkd-kit.gitee.io/import/38517192/1f56aa17-c290-4e56-b6fb-a94bc778448b`, }, ], -}; +}); diff --git a/src/apps/com.netease.cloudmusic.ts b/src/apps/com.netease.cloudmusic.ts index 32b2d3a2..8c9f447b 100644 --- a/src/apps/com.netease.cloudmusic.ts +++ b/src/apps/com.netease.cloudmusic.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.netease.cloudmusic', name: `网易云音乐`, groups: [ @@ -29,4 +29,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.qidian.QDReader.ts b/src/apps/com.qidian.QDReader.ts index ee72491d..f9a39455 100644 --- a/src/apps/com.qidian.QDReader.ts +++ b/src/apps/com.qidian.QDReader.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.qidian.QDReader', name: `起点读书`, groups: [ @@ -11,4 +11,4 @@ export default { rules: 'Button[text^=`跳过`]', }, ], -}; +}); diff --git a/src/apps/com.qiyi.video.ts b/src/apps/com.qiyi.video.ts index b641976e..3719a9c5 100644 --- a/src/apps/com.qiyi.video.ts +++ b/src/apps/com.qiyi.video.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.qiyi.video', name: `爱奇艺`, groups: [ @@ -27,4 +27,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.quark.browser.ts b/src/apps/com.quark.browser.ts index 99249d63..1fe31247 100644 --- a/src/apps/com.quark.browser.ts +++ b/src/apps/com.quark.browser.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.quark.browser', name: `夸克浏览器`, groups: [ @@ -14,4 +14,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.sankuai.meituan.takeoutnew.ts b/src/apps/com.sankuai.meituan.takeoutnew.ts index 809510dd..4b005c1b 100644 --- a/src/apps/com.sankuai.meituan.takeoutnew.ts +++ b/src/apps/com.sankuai.meituan.takeoutnew.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.sankuai.meituan.takeoutnew', name: `美团外卖`, groups: [ @@ -28,4 +28,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.sankuai.meituan.ts b/src/apps/com.sankuai.meituan.ts index 392f87e4..68843860 100644 --- a/src/apps/com.sankuai.meituan.ts +++ b/src/apps/com.sankuai.meituan.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.sankuai.meituan', name: `美团`, groups: [ @@ -11,4 +11,4 @@ export default { rules: 'TextView[id=`com.sankuai.meituan:id/close_btn`][text^=`跳过`]', }, ], -}; +}); diff --git a/src/apps/com.sdu.didi.psnger.ts b/src/apps/com.sdu.didi.psnger.ts index 0674ee19..b4d1bb9b 100644 --- a/src/apps/com.sdu.didi.psnger.ts +++ b/src/apps/com.sdu.didi.psnger.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.sdu.didi.psnger', name: `滴滴`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.sdu.didi.psnger:id/skip_ad_ll`]', }, ], -}; +}); diff --git a/src/apps/com.sina.weibo.ts b/src/apps/com.sina.weibo.ts index 63c11b86..aa6c1471 100644 --- a/src/apps/com.sina.weibo.ts +++ b/src/apps/com.sina.weibo.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.sina.weibo', name: `微博`, groups: [ @@ -20,7 +20,9 @@ export default { key: 2, name: `关闭不感兴趣广告弹窗`, activityIds: `com.sina.weibo.view.bottomsheet.dialog.`, - rules: [[`[text="为何会看到此广告"]`, `[text="不感兴趣"]`]], // 1688889362832 + rules: { + matches: [`[text="为何会看到此广告"]`, `[text="不感兴趣"]`], + }, // 1688889362832 }, ], -}; +}); diff --git a/src/apps/com.smile.gifmaker.ts b/src/apps/com.smile.gifmaker.ts index d4a82d2b..a6a13e6a 100644 --- a/src/apps/com.smile.gifmaker.ts +++ b/src/apps/com.smile.gifmaker.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.smile.gifmaker', name: `快手`, groups: [ @@ -12,4 +12,4 @@ export default { '@[id=`com.smile.gifmaker:id/positive`] + [id=`com.smile.gifmaker:id/set_teenage_mode`]', }, ], -}; +}); diff --git a/src/apps/com.snda.wifilocating.ts b/src/apps/com.snda.wifilocating.ts index 79dc8c02..9045decb 100644 --- a/src/apps/com.snda.wifilocating.ts +++ b/src/apps/com.snda.wifilocating.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.snda.wifilocating', name: `WiFi万能钥匙`, groups: [ @@ -28,4 +28,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.ss.android.article.video.ts b/src/apps/com.ss.android.article.video.ts index 80e8db1e..719d4d18 100644 --- a/src/apps/com.ss.android.article.video.ts +++ b/src/apps/com.ss.android.article.video.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.ss.android.article.video', name: `西瓜视频`, groups: [ @@ -14,4 +14,4 @@ export default { rules: [`TextView[text="我知道了"][clickable=true]`], }, ], -}; +}); diff --git a/src/apps/com.ss.android.ugc.aweme.ts b/src/apps/com.ss.android.ugc.aweme.ts index ae51f781..8288a61b 100644 --- a/src/apps/com.ss.android.ugc.aweme.ts +++ b/src/apps/com.ss.android.ugc.aweme.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.ss.android.ugc.aweme', name: `抖音`, groups: [ @@ -10,4 +10,4 @@ export default { rules: 'Button[text=`开启青少年模式`] + * > Button[text!=null]', }, ], -}; +}); diff --git a/src/apps/com.taobao.taobao.ts b/src/apps/com.taobao.taobao.ts index 59775bee..50fdf3e9 100644 --- a/src/apps/com.taobao.taobao.ts +++ b/src/apps/com.taobao.taobao.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: `com.taobao.taobao`, name: `淘宝`, groups: [ @@ -11,4 +11,4 @@ export default { rules: `[id='com.taobao.taobao:id/close']`, // 1687596777612 }, ], -}; +}); diff --git a/src/apps/com.tencent.androidqqmail.ts b/src/apps/com.tencent.androidqqmail.ts index 6d692ef1..30019f94 100644 --- a/src/apps/com.tencent.androidqqmail.ts +++ b/src/apps/com.tencent.androidqqmail.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.tencent.androidqqmail', name: `qq邮箱`, groups: [ @@ -14,4 +14,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.tencent.djcity.ts b/src/apps/com.tencent.djcity.ts index 7c5e3d89..c8f05ed6 100644 --- a/src/apps/com.tencent.djcity.ts +++ b/src/apps/com.tencent.djcity.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.tencent.djcity', name: `掌上道聚城`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.tencent.djcity:id/ad_view_ll_skip`]', }, ], -}; +}); diff --git a/src/apps/com.tencent.karaoke.ts b/src/apps/com.tencent.karaoke.ts index 158533a1..97ffb780 100644 --- a/src/apps/com.tencent.karaoke.ts +++ b/src/apps/com.tencent.karaoke.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.tencent.karaoke', name: `全民K歌`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[text*=`跳过`][id!=null]', }, ], -}; +}); diff --git a/src/apps/com.tencent.mm.ts b/src/apps/com.tencent.mm.ts index ed371dc2..22241ac3 100644 --- a/src/apps/com.tencent.mm.ts +++ b/src/apps/com.tencent.mm.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.tencent.mm', name: `微信`, groups: [ @@ -39,4 +39,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.tencent.mobileqq.ts b/src/apps/com.tencent.mobileqq.ts index d18e38a8..4bfc21b6 100644 --- a/src/apps/com.tencent.mobileqq.ts +++ b/src/apps/com.tencent.mobileqq.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.tencent.mobileqq', name: `QQ`, groups: [ @@ -33,4 +33,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.tencent.mtt.ts b/src/apps/com.tencent.mtt.ts index 5f33aaf9..a4ab8823 100644 --- a/src/apps/com.tencent.mtt.ts +++ b/src/apps/com.tencent.mtt.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.tencent.mtt', name: `QQ浏览器`, groups: [ @@ -20,4 +20,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.tencent.qqlive.ts b/src/apps/com.tencent.qqlive.ts index b990195a..becf627b 100644 --- a/src/apps/com.tencent.qqlive.ts +++ b/src/apps/com.tencent.qqlive.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.tencent.qqlive', name: `腾讯视频`, groups: [ @@ -22,4 +22,4 @@ export default { 'TextView[text*=`青少年模式`] +n TextView[id=`com.tencent.qqlive:id/arg`][text=`我知道了`]', }, ], -}; +}); diff --git a/src/apps/com.tencent.qqmusic.ts b/src/apps/com.tencent.qqmusic.ts index 632560a7..33978034 100644 --- a/src/apps/com.tencent.qqmusic.ts +++ b/src/apps/com.tencent.qqmusic.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.tencent.qqmusic', name: `QQ音乐`, groups: [ @@ -23,4 +23,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.tencent.qt.sns.ts b/src/apps/com.tencent.qt.sns.ts index c9b50df1..9e291e21 100644 --- a/src/apps/com.tencent.qt.sns.ts +++ b/src/apps/com.tencent.qt.sns.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.tencent.qt.sns', name: `掌上穿越火线`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.tencent.qt.sns:id/tv_timer`][text$=`跳过`]', }, ], -}; +}); diff --git a/src/apps/com.xiaomi.market.ts b/src/apps/com.xiaomi.market.ts index a4aa0e34..22443329 100644 --- a/src/apps/com.xiaomi.market.ts +++ b/src/apps/com.xiaomi.market.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.xiaomi.market', name: `小米应用商店`, groups: [ @@ -11,4 +11,4 @@ export default { rules: "Button[text='关闭']", }, ], -}; +}); diff --git a/src/apps/com.xiaomi.shop.ts b/src/apps/com.xiaomi.shop.ts index b842d3af..3c58e0dd 100644 --- a/src/apps/com.xiaomi.shop.ts +++ b/src/apps/com.xiaomi.shop.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.xiaomi.shop', name: `小米商城`, groups: [ @@ -14,4 +14,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.ximalaya.ting.android.ts b/src/apps/com.ximalaya.ting.android.ts index 9a80c689..d9c5c36f 100644 --- a/src/apps/com.ximalaya.ting.android.ts +++ b/src/apps/com.ximalaya.ting.android.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.ximalaya.ting.android', name: `喜马拉雅`, groups: [ @@ -14,4 +14,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.ximalaya.ting.lite.ts b/src/apps/com.ximalaya.ting.lite.ts index e65007b5..937700ad 100644 --- a/src/apps/com.ximalaya.ting.lite.ts +++ b/src/apps/com.ximalaya.ting.lite.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.ximalaya.ting.lite', name: `喜马拉雅极速版`, groups: [ @@ -19,4 +19,4 @@ export default { rules: "[id='com.ximalaya.ting.lite:id/main_ad_top_home_iv_close']", }, ], -}; +}); diff --git a/src/apps/com.xunlei.downloadprovider.ts b/src/apps/com.xunlei.downloadprovider.ts index 0e065c76..dfe9b995 100644 --- a/src/apps/com.xunlei.downloadprovider.ts +++ b/src/apps/com.xunlei.downloadprovider.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.xunlei.downloadprovider', name: `迅雷`, groups: [ @@ -11,4 +11,4 @@ export default { rules: 'TextView[text^=`跳过`]', }, ], -}; +}); diff --git a/src/apps/com.yek.android.kfc.activitys.ts b/src/apps/com.yek.android.kfc.activitys.ts index 2397fbe4..686c6daf 100644 --- a/src/apps/com.yek.android.kfc.activitys.ts +++ b/src/apps/com.yek.android.kfc.activitys.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.yek.android.kfc.activitys', name: `肯德基`, groups: [ @@ -11,4 +11,4 @@ export default { rules: '[id=`com.yek.android.kfc.activitys:id/splash_tv_3`]', }, ], -}; +}); diff --git a/src/apps/com.yipiao.ts b/src/apps/com.yipiao.ts index 1b6c17a3..a20790f8 100644 --- a/src/apps/com.yipiao.ts +++ b/src/apps/com.yipiao.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.yipiao', name: `智行火车票12306抢票`, groups: [ @@ -11,4 +11,4 @@ export default { rules: 'LinearLayout > TextView + TextView[text=`跳过`]', }, ], -}; +}); diff --git a/src/apps/com.zhihu.android.ts b/src/apps/com.zhihu.android.ts index 357196bb..46d395eb 100644 --- a/src/apps/com.zhihu.android.ts +++ b/src/apps/com.zhihu.android.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.zhihu.android', name: `知乎`, groups: [ @@ -101,4 +101,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/com.zidongdianji.ts b/src/apps/com.zidongdianji.ts index 4414aa9b..ba57fe36 100644 --- a/src/apps/com.zidongdianji.ts +++ b/src/apps/com.zidongdianji.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'com.zidongdianji', name: `自动点击器`, groups: [ @@ -27,4 +27,4 @@ export default { ], }, ], -}; +}); diff --git a/src/apps/ctrip.android.view.ts b/src/apps/ctrip.android.view.ts index 1105d2c7..f9dda5ae 100644 --- a/src/apps/ctrip.android.view.ts +++ b/src/apps/ctrip.android.view.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'ctrip.android.view', name: `携程旅行`, groups: [ @@ -12,4 +12,4 @@ export default { rules: [`LinearLayout[childCount=2] > TextView + TextView[text="跳过"]`], }, ], -}; +}); diff --git a/src/apps/gov.pianzong.androidnga.ts b/src/apps/gov.pianzong.androidnga.ts index be0ed91c..1dd97aca 100644 --- a/src/apps/gov.pianzong.androidnga.ts +++ b/src/apps/gov.pianzong.androidnga.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'gov.pianzong.androidnga', name: `NGA玩家社区`, groups: [ @@ -19,4 +19,4 @@ export default { snapshotUrls: `https://gkd-kit.gitee.io/import/12482727`, }, ], -}; +}); diff --git a/src/apps/li.songe.gkd.ts b/src/apps/li.songe.gkd.ts index 24ad0861..ef1228c1 100644 --- a/src/apps/li.songe.gkd.ts +++ b/src/apps/li.songe.gkd.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'li.songe.gkd', name: `GKD`, groups: [ @@ -9,4 +9,4 @@ export default { name: `GKD-空规则组`, }, ], -}; +}); diff --git a/src/apps/tv.danmaku.bili.ts b/src/apps/tv.danmaku.bili.ts index f41d4bd9..694a7914 100644 --- a/src/apps/tv.danmaku.bili.ts +++ b/src/apps/tv.danmaku.bili.ts @@ -1,6 +1,6 @@ -import type { AppConfig } from '../types'; +import { defineAppConfig } from '../types'; -export default { +export default defineAppConfig({ id: 'tv.danmaku.bili', name: `B站`, groups: [ @@ -61,4 +61,4 @@ export default { rules: ['[id=`tv.danmaku.bili:id/click_skip`]'], }, ], -}; +}); diff --git a/src/main.ts b/src/config.ts similarity index 73% rename from src/main.ts rename to src/config.ts index ec797560..4467b619 100644 --- a/src/main.ts +++ b/src/config.ts @@ -1,11 +1,11 @@ -import { relativePath, walk, writeConfig } from './file'; -import { AppConfig, AppConfigMudule } from './types'; -import url from 'node:url'; import path from 'node:path'; +import url from 'node:url'; import picocolors from 'picocolors'; +import { walk } from './file'; +import type { AppConfig, AppConfigMudule, SubscriptionConfig } from './types'; const apps: AppConfig[] = []; -for await (const tsFp of walk(relativePath('./apps'))) { +for await (const tsFp of walk(process.cwd() + '/src/apps')) { const mod: AppConfigMudule = await import(url.pathToFileURL(tsFp).href); const appConfig = mod.default; if (path.basename(tsFp, `.ts`) != appConfig.id) { @@ -22,11 +22,12 @@ for await (const tsFp of walk(relativePath('./apps'))) { // a,b,c,d apps.sort((a, b) => (a.id > b.id ? 1 : -1)); - -await writeConfig(`../dist/gkd.json`, { +const subsConfig: SubscriptionConfig = { id: 0, name: `默认订阅`, author: `lisonge`, supportUri: `https://github.com/gkd-kit/subscription`, apps, -}); +}; + +export default subsConfig; diff --git a/src/file.ts b/src/file.ts index 4c47f335..cef6a692 100644 --- a/src/file.ts +++ b/src/file.ts @@ -2,14 +2,13 @@ import dayjs from 'dayjs'; import _ from 'lodash'; import fs from 'node:fs/promises'; import path from 'node:path'; -import url from 'node:url'; -import selfPkg from '../package.json'; -import type { SubscriptionConfig, IArray } from './types'; +import type selfPkgT from '../package.json'; import { parseSelector } from './selector'; +import type { IArray, SubscriptionConfig } from './types'; -export const relativePath = (p: string) => { - return url.fileURLToPath(new URL(p, import.meta.url)); -}; +const selfPkg: typeof selfPkgT = JSON.parse( + await fs.readFile(process.cwd() + '/package.json', 'utf-8'), +); const iArrayToArray = (array: IArray = []): T[] => { return Array().concat(array); @@ -26,10 +25,9 @@ const sortKeys: (keyof SubscriptionConfig)[] = [ ]; export const writeConfig = async (fp: string, config: SubscriptionConfig) => { - const filePath = relativePath(fp); const newConfig: SubscriptionConfig = { ...config }; const oldConfig: SubscriptionConfig = JSON.parse( - await fs.readFile(filePath, 'utf-8').catch(() => `{}`), + await fs.readFile(fp, 'utf-8').catch(() => `{}`), ); newConfig.version = oldConfig.version ?? 0; @@ -50,11 +48,11 @@ export const writeConfig = async (fp: string, config: SubscriptionConfig) => { JSON.stringify(Object.fromEntries(map.entries()), void 0, 2), 'utf-8', ); - await fs.writeFile(filePath, buffer); + await fs.writeFile(fp, buffer); const newPkg = { ...selfPkg, version: `0.0.` + newConfig.version }; await fs.writeFile( - relativePath('../package.json'), + process.cwd() + '/package.json', JSON.stringify(newPkg, void 0, 2) + `\n`, ); @@ -144,7 +142,7 @@ export const checkConfig = (newConfig: SubscriptionConfig) => { }; export const updateReadMeMd = async (newConfig: SubscriptionConfig) => { - const mdTemplate = await fs.readFile(relativePath('../Template.md'), 'utf-8'); + const mdTemplate = await fs.readFile(process.cwd() + '/Template.md', 'utf-8'); const appListText = newConfig.apps .map((app) => { const appMdText = `### [${app.id}](/src/apps/${app.id}.ts) - ${app.name}\n`; @@ -216,5 +214,5 @@ export const updateReadMeMd = async (newConfig: SubscriptionConfig) => { ) .replace(`--APP_LIST--`, appListText); - await fs.writeFile(relativePath(`../README.md`), readMeMdText); + await fs.writeFile(process.cwd() + '/README.md', readMeMdText); }; diff --git a/src/types.ts b/src/types.ts index acde2186..693ca6b6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -67,6 +67,11 @@ type GroupConfig = { * 控制规则默认情况下是启用还是禁用, 默认启用 */ enable?: boolean; + /** + * string => { matches: string } + * + * string[] => { matches: string }[] + */ rules?: IArray; /** * 当前 规则/规则组 的快照链接, 最好填上, 增强订阅可维护性 @@ -145,3 +150,7 @@ export type SubscriptionConfig = { export const defineSubsConfig = (config: SubscriptionConfig) => { return JSON.stringify(config, undefined, 2); }; + +export const defineAppConfig = (config: AppConfig) => { + return config; +}; diff --git a/tsconfig.json b/tsconfig.json index c3e0a767..3abdc475 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "target": "ESNext", "lib": ["ESNext"], "module": "ESNext", - "moduleResolution": "Node", + "moduleResolution": "Bundler", "resolveJsonModule": true, "declaration": true, "declarationMap": true, @@ -13,9 +13,5 @@ "strict": true, "skipLibCheck": true }, - "include": [ - "./src/**/*.{ts,js,mjs,cjs}", - "./scripts/**/*.ts", - "./types/**/*.ts" - ] + "include": ["./src/**/*.ts", "./scripts/**/*.ts", "./types/**/*.ts"] }