From 3b804f60ebd628b6aabab06b6ca7862db34c61b7 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Fri, 2 Aug 2024 20:27:58 +0800 Subject: [PATCH] update script --- .github/workflows/build.yml | 2 -- .github/workflows/macos-aarch64.yml | 2 +- CHANGELOG-v3-x.x.x.md | 20 +++++------ extension/options_ui/README.md | 44 ++++++++++++------------- release-archive-v3.sh | 2 +- tools/chromium-auto-test.sh | 2 +- tools/chromium.sh | 4 +-- tools/deploy.sh | 3 +- tools/download-chromium-extension.sh | 2 +- tools/download-chromium.sh | 2 +- tools/download-firefox-extension.sh | 2 +- tools/download-firefox-latest-stable.sh | 2 +- tools/download-firefox.sh | 2 +- tools/firefox-web-ext.sh | 13 ++++++-- tools/firefox.sh | 7 ++-- tools/format-code.sh | 2 +- tools/python3-env-init.sh | 2 +- tools/update-library.sh | 2 +- tools/web-server.sh | 2 +- 19 files changed, 64 insertions(+), 53 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbf95d8a..5e149d41 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,5 +89,3 @@ jobs: artifact: "dist/ReplaceGoogleCDN-v3.zip" keys: ${{ secrets.SUBMIT_KEYS }} # 使用参考 https://github.com/PlasmoHQ/bpp.git - - diff --git a/.github/workflows/macos-aarch64.yml b/.github/workflows/macos-aarch64.yml index 898d1e8d..3b033358 100644 --- a/.github/workflows/macos-aarch64.yml +++ b/.github/workflows/macos-aarch64.yml @@ -1,6 +1,6 @@ name: macos-aarch64 -on: [ push, pull_request ] +on: [push, pull_request] env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} diff --git a/CHANGELOG-v3-x.x.x.md b/CHANGELOG-v3-x.x.x.md index 21b66abb..9aff9354 100644 --- a/CHANGELOG-v3-x.x.x.md +++ b/CHANGELOG-v3-x.x.x.md @@ -21,13 +21,13 @@ 2. 变更: 将辅助工具迁移到扩展目录外 3. 变更: 将高级功能脚本、规则移动到 `experimental-features` 目录 , - 部分实验脚本迁移到 [extension-v3-test](https://github.com/jingjingxyk/extension-v3-test.git) 仓库 + 部分实验脚本迁移到 [extension-v3-test](https://github.com/jingjingxyk/extension-v3-test.git) 仓库 ## 0.10.31 [2023-12-02 22:01:00 +0800] 1. 新增: 对 firefox - 提供基础版功能,暂不提供高级功能。详情: [NDR 正则表达式 未定版 ](https://github.com/w3c/webextensions/issues/344) + 提供基础版功能,暂不提供高级功能。详情: [NDR 正则表达式 未定版 ](https://github.com/w3c/webextensions/issues/344) 1. 变更: 精简打包命令 1. 变更: 使用 prettier 格式化代码 @@ -40,8 +40,8 @@ 3. 新增: 准备发布 v3 1.0.0 版本 4. 变更: - 修改规则`developer.android.com`,`developers.google.com`,`source.android.com`,`developers.google.com`,`source.android.com` - 默认不启用 + 修改规则`developer.android.com`,`developers.google.com`,`source.android.com`,`developers.google.com`,`source.android.com` + 默认不启用 5. 变更: 准备归档不属于扩展的目录和文件(进行中) 6. 变更: 移除 2 种不支持的规则类型 `"webtransport"`,`"webbundle"` ,实现兼容 firefox @@ -214,13 +214,13 @@ 1. 新增 公共 CDN 静态资源库 中科大 `rules/README.md` 2. 修改屏蔽 `content-security-policy`功能,新增 4 - 个屏蔽选项 ` ["cross-origin-embedder-policy", "cross-origin-opener-policy", "cross-origin-opener-policy-report-only","cross-origin-embedder-policy-report-only"]` + 个屏蔽选项 ` ["cross-origin-embedder-policy", "cross-origin-opener-policy", "cross-origin-opener-policy-report-only","cross-origin-embedder-policy-report-only"]` 3. 新增 移除`CSP`的请求地址 `githubusercontent.com` 4. 新增 `cdnjs.cloudflare.com` 替换规则 `rules-cdnjs-cloudflare-com-redirect.json`,默认未启用 5. test 环境 修改功能: github.com 地址替换后 PAJX - 报错,添加解决方案 `extension/test/extension-v3-test/js/content-scripts/github.js` + 报错,添加解决方案 `extension/test/extension-v3-test/js/content-scripts/github.js` 6. test 环境 新增功能: 自定义规则第一版雏形 `extension/test/extension-v3-test/index.html` @@ -231,21 +231,21 @@ 1. test 环境 新增功能: service-worker `sw.js` 小工具,解决因域名地址替换导致出现的问题;比如 github PJAX 错误 2. test 环境 新增功能: service-worker `sw.js` - 小工具中 `extension/test/extension-v3-test/js/tools/self-define-browser-editor.js` 浏览器当作记事本使用 + 小工具中 `extension/test/extension-v3-test/js/tools/self-define-browser-editor.js` 浏览器当作记事本使用 3. test 环境 新增功能: service-worker `sw.js` 小工具中 `extension/test/extension-v3-test/js/tools/myscript-tools.js` - 开启"上帝"模式,可编辑网页 + 开启"上帝"模式,可编辑网页 4. test 环境 新增功能: service-worker `sw.js` 小工具中 `extension/test/extension-v3-test/js/tools/myscript-tools.js` - 查看网页引入的所有域名 + 查看网页引入的所有域名 5. 新增 `code.query.com` jquery 地址替换 6. 解决 0.10.1 版本中 `第9 , 10条不能共用问题` 7. 删除 0.10.1 版本中 高级玩法 `excludedInitiatorDomains` - 错误配置位于 `rules/rules_advance_redirect_2.json : "excludedInitiatorDomains":[] ` + 错误配置位于 `rules/rules_advance_redirect_2.json : "excludedInitiatorDomains":[] ` 8. maxcdn.bootstrapcdn.com 替换为 lib.baomitu.com diff --git a/extension/options_ui/README.md b/extension/options_ui/README.md index 7c53ddd8..5a383a14 100644 --- a/extension/options_ui/README.md +++ b/extension/options_ui/README.md @@ -104,28 +104,28 @@ chrome.declarativeNetRequest.updateDynamicRules( ## 固定规则编号 -| 规则 ID | URI | 备注 | -| :-----: | :------------------------------------------: | :--------: | -| 1 | ajax.googleapis.com | 启用 | -| 2 | fonts.googleapis.com | 启用 | -| 3 | themes.googleusercontent.com | 启用 | -| 4 | fonts.gstatic.com | 启用 | -| 5 | secure.gravatar.com | 启用 | -| 6 | maxcdn.bootstrapcdn.com/bootstrap | 启用 | -| 7 | code.jquery.com/jquery-(version)(suffix) | 启用 | -| 8 | code.jquery.com/ui/(prefix)(version)(suffix) | 启用 | -| 9 | cdnjs.cloudflare.com | 默认未启用 | -| 10 | cdn.jsdelivr.net | 启用 | -| 11 | translate.googleapis.com | 默认未启用 | -| 12 | www.gstatic.com | 默认未启用 | -| 13 | developer.android.com | 默认未启用 | -| 14 | lh3.googleusercontent.com | 默认未启用 | -| 15 | cdn.sstatic.net | 默认未启用 | -| 16 | imgur.com | 默认未启用 | -| 17 | developers.google.com | 默认未启用 | -| 18 | source.android.com | 默认未启用 | -| 19 | www.google.com/recaptcha/api.js | 启用 | -| 9999 | supper-priority-override-rule | 默认未启用 | +| 规则 ID | URI | 备注 | +|:-----:|:--------------------------------------------:|:-----:| +| 1 | ajax.googleapis.com | 启用 | +| 2 | fonts.googleapis.com | 启用 | +| 3 | themes.googleusercontent.com | 启用 | +| 4 | fonts.gstatic.com | 启用 | +| 5 | secure.gravatar.com | 启用 | +| 6 | maxcdn.bootstrapcdn.com/bootstrap | 启用 | +| 7 | code.jquery.com/jquery-(version)(suffix) | 启用 | +| 8 | code.jquery.com/ui/(prefix)(version)(suffix) | 启用 | +| 9 | cdnjs.cloudflare.com | 默认未启用 | +| 10 | cdn.jsdelivr.net | 启用 | +| 11 | translate.googleapis.com | 默认未启用 | +| 12 | www.gstatic.com | 默认未启用 | +| 13 | developer.android.com | 默认未启用 | +| 14 | lh3.googleusercontent.com | 默认未启用 | +| 15 | cdn.sstatic.net | 默认未启用 | +| 16 | imgur.com | 默认未启用 | +| 17 | developers.google.com | 默认未启用 | +| 18 | source.android.com | 默认未启用 | +| 19 | www.google.com/recaptcha/api.js | 启用 | +| 9999 | supper-priority-override-rule | 默认未启用 | > 默认未启用的规则,如何启用? > diff --git a/release-archive-v3.sh b/release-archive-v3.sh index bb775c2f..e980a857 100644 --- a/release-archive-v3.sh +++ b/release-archive-v3.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu __DIR__=$( diff --git a/tools/chromium-auto-test.sh b/tools/chromium-auto-test.sh index 970ace29..a4c84616 100644 --- a/tools/chromium-auto-test.sh +++ b/tools/chromium-auto-test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu diff --git a/tools/chromium.sh b/tools/chromium.sh index 6673704a..8fc6befe 100644 --- a/tools/chromium.sh +++ b/tools/chromium.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu __DIR__=$( @@ -61,7 +61,7 @@ case $OS in *) echo 'current script no support !' exit 0 - ;; + ;; esac test -d /tmp/${UUID} || mkdir -p /tmp/${UUID} diff --git a/tools/deploy.sh b/tools/deploy.sh index 255a37c7..a1091404 100644 --- a/tools/deploy.sh +++ b/tools/deploy.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu __DIR__=$( @@ -13,6 +13,7 @@ __PROJECT__=$( cd ${__PROJECT__} bash release-archive.sh +bash release-archive-v3.sh cd ${__PROJECT__} diff --git a/tools/download-chromium-extension.sh b/tools/download-chromium-extension.sh index 2971277c..c3b0275e 100644 --- a/tools/download-chromium-extension.sh +++ b/tools/download-chromium-extension.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [ ! "$BASH_VERSION" ]; then echo "Please do not use BASH to run this script ($0), just execute it directly" 1>&2 diff --git a/tools/download-chromium.sh b/tools/download-chromium.sh index 2b81dd80..6196d9f9 100644 --- a/tools/download-chromium.sh +++ b/tools/download-chromium.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu __DIR__=$( diff --git a/tools/download-firefox-extension.sh b/tools/download-firefox-extension.sh index 3fe8466b..79013ce3 100644 --- a/tools/download-firefox-extension.sh +++ b/tools/download-firefox-extension.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -ex __DIR__=$( diff --git a/tools/download-firefox-latest-stable.sh b/tools/download-firefox-latest-stable.sh index 04c80fce..03902486 100644 --- a/tools/download-firefox-latest-stable.sh +++ b/tools/download-firefox-latest-stable.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -ex __DIR__=$( diff --git a/tools/download-firefox.sh b/tools/download-firefox.sh index e522078f..ba9e1073 100644 --- a/tools/download-firefox.sh +++ b/tools/download-firefox.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -ex __DIR__=$( diff --git a/tools/firefox-web-ext.sh b/tools/firefox-web-ext.sh index ef04a46b..5be2dc6a 100644 --- a/tools/firefox-web-ext.sh +++ b/tools/firefox-web-ext.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu @@ -42,14 +42,22 @@ case $OS in ;; esac + profile_folder="/tmp/${UUID}" mkdir -p $profile_folder + + +mkdir -p ${__PROJECT__}/var/ +cd ${__PROJECT__}/var/ + + +# python3 ${__PROJECT__}/tools/update-manifest.py firefox + ## 生成支持firefox 的扩展 bash release-archive-v3.sh - # firefox web extension # https://github.com/mdn/webextensions-examples.git @@ -72,6 +80,7 @@ bash release-archive-v3.sh cp -f ${__PROJECT__}/tools/prefs.js $profile_folder # 进入扩展所在目录 + cd ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-firefox/ # reference https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#web-ext-run diff --git a/tools/firefox.sh b/tools/firefox.sh index 7f6884ad..2bc61c54 100644 --- a/tools/firefox.sh +++ b/tools/firefox.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu @@ -71,6 +71,9 @@ mkdir -p ${__PROJECT__}/var/ cd ${__PROJECT__}/var/ + +# python3 ${__PROJECT__}/tools/update-manifest.py firefox + # firefox web extension # https://github.com/mdn/webextensions-examples.git @@ -124,4 +127,4 @@ bash run-firefox.sh # CommandLineOptions -# https://wiki.mozilla.org/Firefox/CommandLineOptions \ No newline at end of file +# https://wiki.mozilla.org/Firefox/CommandLineOptions diff --git a/tools/format-code.sh b/tools/format-code.sh index 4800a9d4..2548c825 100644 --- a/tools/format-code.sh +++ b/tools/format-code.sh @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/usr/bin/env bash set -exu diff --git a/tools/python3-env-init.sh b/tools/python3-env-init.sh index 24ee7828..ef132b34 100644 --- a/tools/python3-env-init.sh +++ b/tools/python3-env-init.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu __DIR__=$( diff --git a/tools/update-library.sh b/tools/update-library.sh index 31929a49..185d9ee2 100644 --- a/tools/update-library.sh +++ b/tools/update-library.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu __DIR__=$( diff --git a/tools/web-server.sh b/tools/web-server.sh index 1b669ae6..f35c2ebd 100644 --- a/tools/web-server.sh +++ b/tools/web-server.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu __DIR__=$(