diff --git a/.gitignore b/.gitignore index 17d926cc..d8c0d69d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ extension/test/nohup.out extension/tools/git-clean-file-history.sh extension/tools/local-deploy.sh extension/tools/web/proxy.pac +extension/tools/download-chromium-extension-backup.sh extension/third_party/ !extension/third_party/README.md @@ -25,6 +26,5 @@ extension/third_party/ dist extension/manifest-backup.json - - -extension/web-backup/ \ No newline at end of file +extension/web-backup/ +extension/rules/mirrors/backup/ \ No newline at end of file diff --git a/extension/rules/README.md b/extension/rules/README.md index 84e8c1d6..72ff900f 100644 --- a/extension/rules/README.md +++ b/extension/rules/README.md @@ -7,7 +7,7 @@ ## 公共 CDN 静态资源库 -1. [前端 CDNJS 库及 Google Fonts、Ajax 和 Gravatar 国内加速服务 http://css.loli.net](https://u.sb/css-cdn/) +1. [烧饼博客 前端 CDNJS 库及 Google Fonts、Ajax 和 Gravatar 国内加速服务](https://u.sb/css-cdn/) 1. [360 奇舞团](https://cdn.baomitu.com/) 1. [又拍云](http://jscdn.upai.com/) 1. [BootCDN](https://www.bootcdn.cn/) @@ -22,6 +22,8 @@ 1. [CDNJS 南方科技大学](https://mirrors.sustech.edu.cn/help/cdnjs.html) 1. [CDNJS mirror list ](https://mirrorz.org/list/cdnjs) 1. [公共 CDN 静态资源加速服务 7ED Services ](https://www.7ed.net/start/public-cdn.html) +1. [辉哥博客&蓝易云安全](https://www.haah.net/archives/7885.html) +1. [AHDark](https://www.sourcegcdn.com/) 1. [中科大反向代理列表如下:](https://mirrors.ustc.edu.cn/) > ajax.googleapis.com ajax.proxy.ustclug.org @@ -36,20 +38,10 @@ 1. [declarativeNetRequest](https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/) -## 高级玩法 - -> 使用时,请把 `proxy.domain.com` 更换为你自己的域名 - -> 固定地址替换 `rules_advance_redirect_1.json` - -> 动态地址替换 `rules_advance_redirect_2.json` - -> 移除 content-security-policy `rules_remove_content_security_policy_header.json` - -> 阻止请求 `rules_block_request.json` - ## manifeset.json 参考 declarative_net_request 配置 +> chromium 内核版本需要大于 87 + ```json { "declarative_net_request": { @@ -79,6 +71,18 @@ } ``` +## 高级玩法(默认不启用) + +> 使用时,请把 `proxy.domain.com` 更换为你自己的域名 + +> 固定地址替换 `rules_advance_redirect_1.json` + +> 动态地址替换 `rules_advance_redirect_2.json` + +> 移除 content-security-policy `rules_remove_content_security_policy_header.json` + +> 阻止请求 `rules_block_request.json` + ### 指定匹配域名 > https://github.com -> https://github-com.proxy.domain.com diff --git a/extension/rules/mirrors/no-url-redirect.json b/extension/rules/example-no-use/no-url-redirect.json similarity index 100% rename from extension/rules/mirrors/no-url-redirect.json rename to extension/rules/example-no-use/no-url-redirect.json diff --git a/extension/rules/mirrors/README.md b/extension/rules/mirrors/README.md index e0a636ec..5a4b68fe 100644 --- a/extension/rules/mirrors/README.md +++ b/extension/rules/mirrors/README.md @@ -7,10 +7,20 @@ ```text https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/ajax.googleapis.com.json?raw=true +https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/cdn.jsdelivr.net.json?raw=true https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/fonts.googleapis.com.json?raw=true -https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/gravatar.com.json?raw=true -https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/cdnjs.cloudflare.com.json?raw=true -https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/fonts.gstatic.com.json?raw=true +https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/imgur-stackoverflow.com.json?raw=true https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/themes.googleusercontent.com.json?raw=true +https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/code.jquery.com.json?raw=true +https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/fonts.gstatic.com.json?raw=true +https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/translate.googleapis.com.json?raw=true +https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/cdnjs.cloudflare.com.json?raw=true +https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/code.jquery.com-ui.json?raw=true +https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/gravatar.com.json?raw=true +https://github.com/justjavac/ReplaceGoogleCDN/blob/master/extension/rules/mirrors/www.gstatic.com.json?raw=true ``` + +## 规则编写的参考文档 + +1. [图片镜像缓存服务—防盗链图片、imgur 等国内无法访问图片的解决方案](https://funletu.com/10538/.html) diff --git a/extension/rules/mirrors/ajax.googleapis.com.json b/extension/rules/mirrors/ajax.googleapis.com.json index 0ed81963..18ff2523 100644 --- a/extension/rules/mirrors/ajax.googleapis.com.json +++ b/extension/rules/mirrors/ajax.googleapis.com.json @@ -1,7 +1,7 @@ [ { "id": 1, - "priority": 1, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -33,6 +33,7 @@ ] } }, + { "id": 2, "priority": 100, @@ -70,7 +71,7 @@ { "id": 3, - "priority": 199, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -99,9 +100,10 @@ ] } }, + { "id": 4, - "priority": 198, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -130,9 +132,10 @@ ] } }, + { "id": 5, - "priority": 300, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -161,9 +164,45 @@ ] } }, + { "id": 6, - "priority": 401, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "gajax.cdn.haah.net" + } + } + }, + "condition": { + "urlFilter": "ajax.googleapis.com", + "requestDomains": ["ajax.googleapis.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + }, + + { + "id": 7, + "priority": 90, "action": { "type": "redirect", "redirect": { @@ -192,9 +231,10 @@ ] } }, + { - "id": 6, - "priority": 402, + "id": 8, + "priority": 90, "action": { "type": "redirect", "redirect": { @@ -223,9 +263,10 @@ ] } }, + { - "id": 6, - "priority": 403, + "id": 9, + "priority": 90, "action": { "type": "redirect", "redirect": { @@ -254,9 +295,10 @@ ] } }, + { - "id": 7, - "priority": 408, + "id": 10, + "priority": 90, "action": { "type": "redirect", "redirect": { @@ -285,9 +327,10 @@ ] } }, + { - "id": 8, - "priority": 409, + "id": 11, + "priority": 90, "action": { "type": "redirect", "redirect": { @@ -316,9 +359,10 @@ ] } }, + { - "id": 9, - "priority": 410, + "id": 12, + "priority": 90, "action": { "type": "redirect", "redirect": { diff --git a/extension/rules/mirrors/cdn.jsdelivr.net.json b/extension/rules/mirrors/cdn.jsdelivr.net.json new file mode 100644 index 00000000..6fcc94f4 --- /dev/null +++ b/extension/rules/mirrors/cdn.jsdelivr.net.json @@ -0,0 +1,106 @@ +[ + { + "id": 1, + "priority": 1, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "fastly.jsdelivr.net" + } + } + }, + "condition": { + "urlFilter": "cdn.jsdelivr.net", + "requestDomains": ["cdn.jsdelivr.net"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + }, + + { + "id": 2, + "priority": 1, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "js.cdn.haah.net" + } + } + }, + "condition": { + "urlFilter": "cdn.jsdelivr.net", + "requestDomains": ["cdn.jsdelivr.net"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + }, + + { + "id": 3, + "priority": 1, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "gcore.jsdelivr.net" + } + } + }, + "condition": { + "urlFilter": "cdn.jsdelivr.net", + "requestDomains": ["cdn.jsdelivr.net"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + } +] diff --git a/extension/rules/mirrors/cdnjs.cloudflare.com.json b/extension/rules/mirrors/cdnjs.cloudflare.com.json index 257530ee..24658093 100644 --- a/extension/rules/mirrors/cdnjs.cloudflare.com.json +++ b/extension/rules/mirrors/cdnjs.cloudflare.com.json @@ -30,9 +30,10 @@ ] } }, + { "id": 2, - "priority": 99, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -61,9 +62,10 @@ ] } }, + { "id": 3, - "priority": 298, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -92,9 +94,80 @@ ] } }, + { "id": 4, - "priority": 300, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "cdnjs.cdn.haah.net" + } + } + }, + "condition": { + "urlFilter": "cdnjs.cloudflare.com", + "requestDomains": ["cdnjs.cloudflare.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + }, + + { + "id": 5, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "cdnjs.sourcegcdn.com" + } + } + }, + "condition": { + "urlFilter": "cdnjs.cloudflare.com", + "requestDomains": ["cdnjs.cloudflare.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + }, + + { + "id": 6, + "priority": 90, "action": { "type": "redirect", "redirect": { diff --git a/extension/rules/mirrors/code.jquery.com-ui.json b/extension/rules/mirrors/code.jquery.com-ui.json index f089bf17..6ab0cca7 100644 --- a/extension/rules/mirrors/code.jquery.com-ui.json +++ b/extension/rules/mirrors/code.jquery.com-ui.json @@ -1,7 +1,7 @@ [ { "id": 1, - "priority": 1, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -33,7 +33,7 @@ { "id": 2, - "priority": 1, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -62,9 +62,10 @@ ] } }, + { "id": 3, - "priority": 993, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -93,9 +94,10 @@ ] } }, + { "id": 4, - "priority": 1, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -126,7 +128,7 @@ }, { "id": 5, - "priority": 1, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -157,7 +159,7 @@ }, { "id": 5, - "priority": 1, + "priority": 100, "action": { "type": "redirect", "redirect": { diff --git a/extension/rules/mirrors/code.jquery.com.json b/extension/rules/mirrors/code.jquery.com.json index 42fc4dbf..f24b60fb 100644 --- a/extension/rules/mirrors/code.jquery.com.json +++ b/extension/rules/mirrors/code.jquery.com.json @@ -1,7 +1,7 @@ [ { "id": 1, - "priority": 1, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -30,9 +30,10 @@ ] } }, + { "id": 2, - "priority": 1, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -61,9 +62,10 @@ ] } }, + { "id": 3, - "priority": 991, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -92,9 +94,10 @@ ] } }, + { "id": 4, - "priority": 992, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -123,9 +126,10 @@ ] } }, + { "id": 5, - "priority": 993, + "priority": 101, "action": { "type": "redirect", "redirect": { diff --git a/extension/rules/mirrors/fonts.googleapis.com.json b/extension/rules/mirrors/fonts.googleapis.com.json index e88aba9e..ff83b09a 100644 --- a/extension/rules/mirrors/fonts.googleapis.com.json +++ b/extension/rules/mirrors/fonts.googleapis.com.json @@ -33,9 +33,10 @@ ] } }, + { "id": 2, - "priority": 99, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -67,9 +68,10 @@ ] } }, + { "id": 3, - "priority": 199, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -101,9 +103,10 @@ ] } }, + { "id": 4, - "priority": 199, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -134,5 +137,75 @@ "other" ] } + }, + + { + "id": 5, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "gfont.cdn.haah.net" + } + } + }, + "condition": { + "urlFilter": "fonts.googleapis.com", + "requestDomains": ["fonts.googleapis.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + }, + + { + "id": 6, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "fonts.sourcegcdn.com" + } + } + }, + "condition": { + "urlFilter": "fonts.googleapis.com", + "requestDomains": ["fonts.googleapis.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } } ] diff --git a/extension/rules/mirrors/fonts.gstatic.com.json b/extension/rules/mirrors/fonts.gstatic.com.json index daf84109..8ca3f124 100644 --- a/extension/rules/mirrors/fonts.gstatic.com.json +++ b/extension/rules/mirrors/fonts.gstatic.com.json @@ -1,7 +1,7 @@ [ { "id": 1, - "priority": 1, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -33,6 +33,7 @@ ] } }, + { "id": 2, "priority": 100, @@ -64,9 +65,10 @@ ] } }, + { "id": 3, - "priority": 102, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -97,5 +99,40 @@ "other" ] } + }, + + { + "id": 4, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "gstatic.cdn.haah.net" + } + } + }, + "condition": { + "urlFilter": "fonts.gstatic.com", + "requestDomains": ["fonts.gstatic.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } } ] diff --git a/extension/rules/mirrors/gravatar.com.json b/extension/rules/mirrors/gravatar.com.json index 0d238e73..a34c8272 100644 --- a/extension/rules/mirrors/gravatar.com.json +++ b/extension/rules/mirrors/gravatar.com.json @@ -1,7 +1,7 @@ [ { "id": 1, - "priority": 1, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -38,9 +38,10 @@ ] } }, + { "id": 2, - "priority": 1, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -77,6 +78,7 @@ ] } }, + { "id": 3, "priority": 100, @@ -115,5 +117,85 @@ "other" ] } + }, + + { + "id": 4, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "gravatar.cdn.haah.net" + } + } + }, + "condition": { + "urlFilter": "gravatar.com", + "requestDomains": [ + "secure.gravatar.com", + "www.gravatar.com", + "cn.gravatar.com", + "en.gravatar.com" + ], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + }, + + { + "id": 5, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "avatar.sourcegcdn.com" + } + } + }, + "condition": { + "urlFilter": "gravatar.com", + "requestDomains": [ + "secure.gravatar.com", + "www.gravatar.com", + "cn.gravatar.com", + "en.gravatar.com" + ], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } } ] diff --git a/extension/rules/mirrors/imgur-stackoverflow.com.json b/extension/rules/mirrors/imgur-stackoverflow.com.json new file mode 100644 index 00000000..d4e78803 --- /dev/null +++ b/extension/rules/mirrors/imgur-stackoverflow.com.json @@ -0,0 +1,167 @@ +[ + { + "id": 1, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "regexSubstitution": "https://images.weserv.nl/?url=\\1" + } + }, + "condition": { + "regexFilter": "(.*?)", + "requestDomains": ["imgur.com"], + "initiatorDomains": ["stackoverflow.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + }, + + { + "id": 2, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "regexSubstitution": "https://img.noobzone.ru/getimg.php?url=\\2" + } + }, + "condition": { + "regexFilter": "(http[s]{0,1}://)(.*?)", + "requestDomains": ["imgur.com"], + "initiatorDomains": ["stackoverflow.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + }, + { + "id": 3, + "priority": 100, + "action": { + "type": "modifyHeaders", + "requestHeaders": [ + { + "header": "referer", + "operation": "remove" + } + ] + }, + "condition": { + "urlFilter": "img.noobzone.ru/getimg.php", + "requestDomains": ["img.noobzone.ru"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + }, + + { + "id": 4, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "regexSubstitution": "https://pic1.xuehuaimg.com/proxy/\\2" + } + }, + "condition": { + "regexFilter": "(http[s]{0,1}://)(.*?)", + "requestDomains": ["imgur.com"], + "initiatorDomains": ["stackoverflow.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + }, + + { + "id": 5, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "regexSubstitution": "https://search.pstatic.net/common?src=\\1" + } + }, + "condition": { + "regexFilter": "(.*?)", + "requestDomains": ["imgur.com"], + "initiatorDomains": ["stackoverflow.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + } +] diff --git a/extension/rules/mirrors/themes.googleusercontent.com.json b/extension/rules/mirrors/themes.googleusercontent.com.json index 57ef3a3c..f9413cc4 100644 --- a/extension/rules/mirrors/themes.googleusercontent.com.json +++ b/extension/rules/mirrors/themes.googleusercontent.com.json @@ -1,7 +1,7 @@ [ { "id": 1, - "priority": 1, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -33,6 +33,7 @@ ] } }, + { "id": 2, "priority": 100, @@ -64,9 +65,10 @@ ] } }, + { "id": 3, - "priority": 101, + "priority": 100, "action": { "type": "redirect", "redirect": { @@ -97,5 +99,40 @@ "other" ] } + }, + + { + "id": 4, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "gtheme.cdn.haah.net" + } + } + }, + "condition": { + "urlFilter": "themes.googleusercontent.com", + "requestDomains": ["themes.googleusercontent.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } } ] diff --git a/extension/rules/mirrors/translate.googleapis.com.json b/extension/rules/mirrors/translate.googleapis.com.json new file mode 100644 index 00000000..559cc2bf --- /dev/null +++ b/extension/rules/mirrors/translate.googleapis.com.json @@ -0,0 +1,36 @@ +[ + { + "id": 1, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "gtranslate.cdn.haah.net" + } + } + }, + "condition": { + "urlFilter": "translate.googleapis.com", + "requestDomains": ["translate.googleapis.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + } +] diff --git a/extension/rules/mirrors/www.gstatic.com.json b/extension/rules/mirrors/www.gstatic.com.json new file mode 100644 index 00000000..929946dc --- /dev/null +++ b/extension/rules/mirrors/www.gstatic.com.json @@ -0,0 +1,71 @@ +[ + { + "id": 1, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "wgstatic.cdn.haah.net" + } + } + }, + "condition": { + "urlFilter": "www.gstatic.com", + "requestDomains": ["www.gstatic.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + }, + + { + "id": 2, + "priority": 100, + "action": { + "type": "redirect", + "redirect": { + "transform": { + "scheme": "https", + "host": "www.gstatic.cn" + } + } + }, + "condition": { + "urlFilter": "www.gstatic.com", + "requestDomains": ["www.gstatic.com"], + "resourceTypes": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "font", + "object", + "xmlhttprequest", + "ping", + "csp_report", + "media", + "websocket", + "webtransport", + "webbundle", + "other" + ] + } + } +] diff --git a/extension/test/README.md b/extension/test/README.md index dadf1f22..99c599f6 100644 --- a/extension/test/README.md +++ b/extension/test/README.md @@ -5,7 +5,7 @@ 1. [stackoverflow 打开 `https://stackoverflow.com/tags/socat/hot?filter=all` 查看结果](https://stackoverflow.com/tags/socat/hot?filter=all) 1. [Google reCAPTCHA 打开 `https://patrickhlauke.github.io/recaptcha/` 查看结果](https://patrickhlauke.github.io/recaptcha/) 1. [ `pub.dev` 域名下 `fonts.googleapis.com` 无法地址重定向; 打开 `https://pub.dev/` 查看结果](https://pub.dev/) -1. [`cdn.jsdelivr.net` 替换为 `fastly.jsdelivr.net` 打开 `https://cdn.jsdelivr.net/` 查看结果 ](https://cdn.jsdelivr.net/) +1. [`cdn.jsdelivr.net` 替换为 `fastly.jsdelivr.net` 打开 `https://cdn.jsdelivr.net/` 查看结果 ](https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js) 1. [`cdnjs.cloudflare.com` 替换为 `cdnjs.loli.net` 打开 `https://cdnjs.cloudflare.com/` 查看结果 ](https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.1.2/reveal.min.css) 1. [`developers.google.com` 替换为 `developers.google.cn` 打开 `https://developers.google.com/` 查看结果 ](https://developers.google.com) 1. [`code.jquery.com/jquery-` 替换为 `lib.baomitu.com/jquery/` 打开 `https://releases.jquery.com/` 查看结果 ](https://releases.jquery.com/) diff --git a/extension/tools/update-to-latest-extension.sh b/extension/tools/update-to-latest-extension.sh new file mode 100644 index 00000000..3568f35b --- /dev/null +++ b/extension/tools/update-to-latest-extension.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -exu + +__DIR__=$(cd "$(dirname "$0")";pwd) +cd ${__DIR__} + +# 下载扩展 + +mkdir -p temp +cd ${__DIR__}/temp + +test -f ReplaceGoogleCDN-v3.zip && rm -rf ReplaceGoogleCDN-v3.zip +curl -LO https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN-v3.zip + +test -d ReplaceGoogleCDN-v3 && rm -rf ReplaceGoogleCDN-v3 +unzip -d ReplaceGoogleCDN-v3 ReplaceGoogleCDN-v3.zip