From 0bdb8713bc03fac8f1303afd139039b1da9164ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=84=86=E8=96=AF=E9=A5=BC?= Date: Sun, 10 Nov 2024 23:29:25 +0800 Subject: [PATCH] refactor: modkit Update modkit.dev.config.ts --- modkit.dev.config.ts | 94 ++++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 39 deletions(-) diff --git a/modkit.dev.config.ts b/modkit.dev.config.ts index 963284c..ce8b0de 100644 --- a/modkit.dev.config.ts +++ b/modkit.dev.config.ts @@ -21,47 +21,63 @@ export default defineConfig({ date: new Date().toLocaleString("zh-CN"), }, }, - content: { - rule: [ - "DOMAIN,gateway.icloud.com,{{{Proxy}}}", - { - type: "RULE-SET", - assetKey: "News.list", - policyName: { - custom: "{{{Proxy}}}", + content: ({ pluginName }) => { + const content: ModuleContent = { + rule: [], + script: [ + { + name: "📰 News.v1.configs.request", + type: "http-request", + pattern: "^https?://news(-todayconfig)?-edge.apple.com/v1/configs", + requiresBody: true, + scriptKey: "request", + injectArgument: true, }, - description: "📰 News", - }, - ], - script: [ - { - name: "📰 News.v1.configs.request", - type: "http-request", - pattern: "^https?://news(-todayconfig)?-edge.apple.com/v1/configs", - requiresBody: true, - scriptKey: "request", - injectArgument: true, - }, - { - name: "📰 News.analyticseventsv2.async.request", - type: "http-request", - pattern: "^https?://news(-sports)?-events.apple.com/analyticseventsv2/async", - requiresBody: true, - scriptKey: "request", - injectArgument: true, - }, - { - name: "📰 News.v1.search.request", - type: "http-request", - pattern: "^https?://news-client-search.apple.com/v1/search", - requiresBody: false, - scriptKey: "request", - injectArgument: true, + { + name: "📰 News.analyticseventsv2.async.request", + type: "http-request", + pattern: "^https?://news(-sports)?-events.apple.com/analyticseventsv2/async", + requiresBody: true, + scriptKey: "request", + injectArgument: true, + }, + { + name: "📰 News.v1.search.request", + type: "http-request", + pattern: "^https?://news-client-search.apple.com/v1/search", + requiresBody: false, + scriptKey: "request", + injectArgument: true, + }, + ], + mitm: { + hostname: ["news-edge.apple.com", "news-todayconfig-edge.apple.com", "news-events.apple.com", "news-sports-events.apple.com", "news-client.apple.com", "news-client-search.apple.com"], }, - ], - mitm: { - hostname: ["news-edge.apple.com", "news-todayconfig-edge.apple.com", "news-events.apple.com", "news-sports-events.apple.com", "news-client.apple.com", "news-client-search.apple.com"], - }, + }; + switch (pluginName) { + case "surge": + content.rule.push("DOMAIN,gateway.icloud.com,{{{Proxy}}} //☁️ iCloud"); + content.rule.push({ + type: "RULE-SET", + assetKey: "News.list", + policyName: { + custom: "{{{Proxy}}}", + }, + description: "📰 News", + }); + break; + case "loon": + content.rule.push("# > iCloud"); + content.rule.push("DOMAIN,gateway.icloud.com,PROXY"); + content.rule.push("# > News"); + content.rule.push("DOMAIN,news-edge.apple.com,PROXY"); + content.rule.push("DOMAIN,news-events.apple.com,PROXY"); + content.rule.push("DOMAIN,apple.comscoreresearch.com,PROXY"); + content.rule.push("# News+ Audio"); + content.rule.push("URL-REGEX,^https?:\/\/news-assets\.apple\.com\/(audio-narrative|podcast\/audio)\/.*,PROXY"); + break; + }; + return content; }, arguments: [ {