From 3cbaa9df38b3298d86124ae33b9f2925fbbc8e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=BD=E5=90=A7=EF=BC=8C=E4=BD=A0=E6=83=B3=E8=AF=B4?= =?UTF-8?q?=E5=95=A5?= Date: Tue, 5 Dec 2023 08:17:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0README.md=20=E5=92=8C=20?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=91=BD=E4=BB=A4=E8=A1=8C=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E5=8A=A0=E8=BD=BD=E6=89=A9=E5=B1=95?= =?UTF-8?q?=20(#193)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update * test install firefox * test install firefox * test install firefox * test install firefox * test install firefox * update * update * test * test * test * test * test * test * test * test * 查询firefox 安抓选项 * 查询firefox 安抓选项 * 查询firefox 安抓选项 * 查询firefox 安抓选项 * 查询firefox 安抓选项 * 查询firefox 安装选项 * 查询firefox 安装选项 * workflow show var folder * fix workflow error * workflow show firefox version * workflow show firefox version * workflow show firefox version * workflow show firefox version * workflow show firefox version * workflow show firefox version * workflow show firefox version * workflow show firefox version * workflow show browser version * workflow show browser version * workflow show browser version * 完善命令行启动chromium 和 firefox * 完善命令行启动chromium 和 firefox * 完善命令行启动chromium 和 firefox * 完善命令行启动chromium 和 firefox * 完善命令行启动chromium 和 firefox * 完善命令行启动chromium 和 firefox * 完善命令行启动chromium 和 firefox * 完善命令行启动chromium 和 firefox * 完善命令行启动chromium 和 firefox * 完善命令行启动chromium 和 firefox * update README.md * update README.md * update README.md * update README.md * update README.md * update README.md * update release-archive.sh * update README.md * 改进打包,排除与扩展无关的文件 * 优化打包 * 调整与扩展辅助脚本 * auto test chromium * auto test * update toos/README.md * update chromium-auto-test.sh * update chromium-auto-test.sh --- .github/workflows/linux-x86_64.yaml | 42 ++++++-- .github/workflows/macos-x86_64.yml | 33 ++++++- .github/workflows/windows-x86_64.yml | 97 ++++++++++++++----- .gitignore | 2 +- CHANGELOG-v2-x.x.x.md | 2 +- Privacy.md | 5 +- README.md | 6 +- .../RAEDME.md | 0 .../auth.json | 0 .../rules_advance_redirect_1.json | 0 .../rules_advance_redirect_2.json | 0 .../{example-no-use => example}/CORS.json | 0 .../{example-no-use => example}/README.md | 0 .../cdn.sstatic.net-stackoverflow.com.json | 0 .../commondatastorage.googleapis.com.json | 0 ...gerrit-googlesource.proxy.ustclug.org.json | 0 .../golang.org.json | 0 .../imgur.com-stackoverflow.com.json | 0 .../no-url-redirect.json | 0 .../no_use/public-cdn.geekzu.org.json | 0 .../provider/no_use/public-cdn.haah.net.json | 0 .../provider/public-cdn.loli.net.json | 0 .../provider/public-cdn.sevencdn.com.json | 0 .../provider/public-cdn.sourcegcdn.com.json | 0 .../provider/public-cdn.ustclug.org.json | 0 .../remove-referer-for-blog.json | 0 .../rules_append_header_1.json | 0 .../rules_block_request.json | 0 .../rules_cdn_jsdelivr_net_redirect.json | 0 .../rules_domain_replace.json | 0 .../rules_jquery_redirect.json | 0 extension/tools/update-auth.py | 6 +- extension/tools/update-auth.sh | 2 +- extension/tools/update-domain.sh | 2 +- extension/tools/update-punycode.sh | 2 +- release-archive-v3.sh | 5 +- release-archive.sh | 8 +- tools/README.md | 2 + tools/chromium-auto-test.sh | 10 +- tools/chromium.sh | 14 ++- tools/download-firefox-latest-stable.sh | 5 +- tools/download-firefox.sh | 20 ++-- tools/firefox-web-ext.sh | 41 ++++---- tools/firefox.sh | 26 +++-- {extension/tools => tools}/update-library.sh | 20 ++-- 45 files changed, 243 insertions(+), 107 deletions(-) rename extension/rules/{advance-no-use => example-advance}/RAEDME.md (100%) rename extension/rules/{advance-no-use => example-advance}/auth.json (100%) rename extension/rules/{advance-no-use => example-advance}/rules_advance_redirect_1.json (100%) rename extension/rules/{advance-no-use => example-advance}/rules_advance_redirect_2.json (100%) rename extension/rules/{example-no-use => example}/CORS.json (100%) rename extension/rules/{example-no-use => example}/README.md (100%) rename extension/rules/{example-no-use => example}/cdn.sstatic.net-stackoverflow.com.json (100%) rename extension/rules/{example-no-use => example}/commondatastorage.googleapis.com.json (100%) rename extension/rules/{example-no-use => example}/gerrit-googlesource.proxy.ustclug.org.json (100%) rename extension/rules/{example-no-use => example}/golang.org.json (100%) rename extension/rules/{example-no-use => example}/imgur.com-stackoverflow.com.json (100%) rename extension/rules/{example-no-use => example}/no-url-redirect.json (100%) rename extension/rules/{example-no-use => example}/provider/no_use/public-cdn.geekzu.org.json (100%) rename extension/rules/{example-no-use => example}/provider/no_use/public-cdn.haah.net.json (100%) rename extension/rules/{example-no-use => example}/provider/public-cdn.loli.net.json (100%) rename extension/rules/{example-no-use => example}/provider/public-cdn.sevencdn.com.json (100%) rename extension/rules/{example-no-use => example}/provider/public-cdn.sourcegcdn.com.json (100%) rename extension/rules/{example-no-use => example}/provider/public-cdn.ustclug.org.json (100%) rename extension/rules/{example-no-use => example}/remove-referer-for-blog.json (100%) rename extension/rules/{example-no-use => example}/rules_append_header_1.json (100%) rename extension/rules/{example-no-use => example}/rules_block_request.json (100%) rename extension/rules/{example-no-use => example}/rules_cdn_jsdelivr_net_redirect.json (100%) rename extension/rules/{example-no-use => example}/rules_domain_replace.json (100%) rename extension/rules/{example-no-use => example}/rules_jquery_redirect.json (100%) rename {extension/tools => tools}/update-library.sh (85%) diff --git a/.github/workflows/linux-x86_64.yaml b/.github/workflows/linux-x86_64.yaml index 379a6a9f..7465f8b8 100644 --- a/.github/workflows/linux-x86_64.yaml +++ b/.github/workflows/linux-x86_64.yaml @@ -9,7 +9,7 @@ env: jobs: linux-x86_64: - if: github.ref == 'refs/heads/dev' || github.ref_name == 'dev' + if: 1 runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -54,30 +54,60 @@ jobs: sudo apt install -y supervisor socat + - name: Cache Chromium + uses: actions/cache@v3 + with: + path: | + install-build-deps.py + ${{ github.workspace }}/var/chrome-linux.zip + ${{ github.workspace }}/var/chrome-linux + key: ${{ runner.os }}-x86_64-chromium + - name: Prepare Chromium Run Environment run: | set -x - - curl https://chromium.googlesource.com/chromium/src/+/refs/heads/main/build/install-build-deps.sh?format=TEXT | base64 --decode > install-build-deps.sh - curl https://chromium.googlesource.com/chromium/src/+/refs/heads/main/build/install-build-deps.py?format=TEXT | base64 --decode > install-build-deps.py + # curl https://chromium.googlesource.com/chromium/src/+/refs/heads/main/build/install-build-deps.sh?format=TEXT | base64 --decode > install-build-deps.sh + test -f install-build-deps.py || curl https://chromium.googlesource.com/chromium/src/+/refs/heads/main/build/install-build-deps.py?format=TEXT | base64 --decode > install-build-deps.py sudo python3 install-build-deps.py - name: Download Chromium run: | set -x - bash tools/download-chromium.sh + if [ ! -f ${{ github.workspace }}/var/chrome-linux.zip ] ; then + bash tools/download-chromium.sh + fi + + - name: Cache Firefox + uses: actions/cache@v3 + with: + path: | + ${{ github.workspace }}/var/firefox.tar.bz2 + ${{ github.workspace }}/var/firefox/ + key: ${{ runner.os }}-x86_64-firefox - name: Download Firefox shell: bash run: | set -x - bash tools/download-firefox.sh + if [ ! -f ${{ github.workspace }}/var/firefox.tar.bz2 ] ; then + bash tools/download-firefox.sh + fi + + - name: show browser version + shell: bash + run: | + ls -lha var/ + var/chrome-linux/chrome --version + var/firefox/firefox --version - name: Chromium Load Extension run: | set -x # bash tools/chromium.sh --xvfb # bash tools/chromium.sh --headless + nohup bash tools/chromium.sh --xvfb & + sleep 15 + bash tools/chromium-auto-test.sh - name: Firefox Load Extension run: | diff --git a/.github/workflows/macos-x86_64.yml b/.github/workflows/macos-x86_64.yml index a4261891..a15734bc 100644 --- a/.github/workflows/macos-x86_64.yml +++ b/.github/workflows/macos-x86_64.yml @@ -7,7 +7,7 @@ env: jobs: macos-x86_64: - if: github.ref == 'refs/heads/dev' || github.ref_name == 'dev' + if: 1 runs-on: macos-latest steps: - uses: actions/checkout@v3 @@ -44,13 +44,40 @@ jobs: run: | set -x + - name: Cache Chromium + uses: actions/cache@v3 + with: + path: | + ${{ github.workspace }}/var/chrome-mac.zip + ${{ github.workspace }}/var/chrome-mac + key: ${{ runner.os }}-x86_64-chromium + - name: Download Chromium run: | set -x - bash tools/download-chromium.sh + if [ ! -f ${{ github.workspace }}/var/chrome-mac.zip ] ; then + bash tools/download-chromium.sh + fi + + - name: Cache Firefox + uses: actions/cache@v3 + with: + path: | + ${{ github.workspace }}/var/firefox.dmg + ${{ github.workspace }}/var/firefox/ + key: ${{ runner.os }}-x86_64-firefox - name: Download Firefox shell: bash run: | set -x - bash tools/download-firefox.sh + if [ ! -f ${{ github.workspace }}/var/firefox.dmg ] ; then + bash tools/download-firefox.sh + fi + + - name: show browser version + shell: bash + run: | + ls -lha var/ + var/chrome-mac/Chromium.app/Contents/MacOS/Chromium --version + var/firefox/Firefox.app/Contents/MacOS/firefox --version diff --git a/.github/workflows/windows-x86_64.yml b/.github/workflows/windows-x86_64.yml index 4a60be0d..5e63a20d 100644 --- a/.github/workflows/windows-x86_64.yml +++ b/.github/workflows/windows-x86_64.yml @@ -7,7 +7,7 @@ env: jobs: windows: - if: github.ref == 'refs/heads/dev' || github.ref_name == 'dev' + if: 1 runs-on: windows-latest steps: - name: Prepare git @@ -25,45 +25,92 @@ jobs: run: | ipconfig /all + - name: Cache Chromium + uses: actions/cache@v3 + with: + path: | + ${{ github.workspace }}\var\chrome-win.zip + ${{ github.workspace }}\var\chrome-win + key: ${{ runner.os }}-x86_64-chromium + - name: Download Chromium shell: bash run: | set -x - bash tools/download-chromium.sh + if [ ! -f var/chrome-win.zip ] ; then + bash tools/download-chromium.sh + fi + + - name: Cache Firefox + uses: actions/cache@v3 + with: + path: | + ${{ github.workspace }}\var\firefox.exe + key: ${{ runner.os }}-x86_64-firefox - name: Download Firefox shell: bash run: | set -x - bash tools/download-firefox.sh - - # https://www.msys2.org/docs/ci/ - # https://github.com/marketplace/actions/setup-msys2 - - uses: msys2/setup-msys2@v2 - with: - msystem: UCRT64 - update: true - install: git mingw-w64-ucrt-x86_64-gcc + if [ ! -f var/firefox.exe ] ; then + bash tools/download-firefox.sh + fi - - name: CI-Build - shell: msys2 {0} + - name: install firefox + shell: cmd + run: | + DIR + ECHO %CD% + + :: msiexec /package /qn "%CD%\var\firefox.msi" + :: var\firefox.exe /? + :: start var\firefox.exe /S + + :: 静默安装 firefox + var\firefox.exe /A /S + timeout /T 30 /NOBREAK + + :: show firefox install directory + DIR "C:\Program Files\Mozilla Firefox" + + :: show firefox version + "C:\Program Files\Mozilla Firefox\firefox.exe" --version + + - name: show browser version + shell: cmd run: | - echo 'Running in MSYS2!' - - echo "C:\\msys64\\usr\\bin" >> $GITHUB_PATH - echo "C:\\msys64\\mingw64\\bin" >> $GITHUB_PATH - echo "PKG_CONFIG_PATH=/mingw64/lib/pkgconfig" >> $GITHUB_ENV - - - name: test powershell use msys2 - shell: powershell - run: msys2 -c 'uname -a' + DIR var + :: var\chrome-win\chrome.exe --version + "C:\Program Files\Mozilla Firefox\firefox.exe" --version - - name: test cmd use msys2 - shell: cmd - run: msys2 -c 'uname -a' + # https://www.msys2.org/docs/ci/ + # https://github.com/marketplace/actions/setup-msys2 +# - uses: msys2/setup-msys2@v2 +# with: +# msystem: UCRT64 +# update: false +# install: git mingw-w64-ucrt-x86_64-gcc +# +# - name: CI-Build +# shell: msys2 {0} +# run: | +# echo 'Running in MSYS2!' +# +# echo "C:\\msys64\\usr\\bin" >> $GITHUB_PATH +# echo "C:\\msys64\\mingw64\\bin" >> $GITHUB_PATH +# echo "PKG_CONFIG_PATH=/mingw64/lib/pkgconfig" >> $GITHUB_ENV +# +# - name: test powershell use msys2 +# shell: powershell +# run: msys2 -c 'uname -a' +# +# - name: test cmd use msys2 +# shell: cmd +# run: msys2 -c 'uname -a' - name: Test shell: cmd run: | + REM change CHCP to UTF-8 @chcp 65001>nul echo foo=bar >> %GITHUB_OUTPUT% diff --git a/.gitignore b/.gitignore index b30336aa..032b5b8f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ extension/tools/git-clean-file-history.sh extension/tools/local-deploy.sh extension/web-backup/ -extension/rules/example-no-use/backup/ +extension/rules/example/backup/ tools/download-chromium-extension-backup.sh diff --git a/CHANGELOG-v2-x.x.x.md b/CHANGELOG-v2-x.x.x.md index 599e1c1c..73570083 100644 --- a/CHANGELOG-v2-x.x.x.md +++ b/CHANGELOG-v2-x.x.x.md @@ -6,7 +6,7 @@ ## [公共 CDN 静态资源库](public-cdn.md) -## CHANGELOG for v2 0.10.17 [2023-02-09 13:01:00 +0800] +## CHANGELOG for v2 0.10.17 [2023-12-05 00:49:00 +0800] > 1. 格式化代码 diff --git a/Privacy.md b/Privacy.md index 95e1b4cf..9328ad49 100644 --- a/Privacy.md +++ b/Privacy.md @@ -4,7 +4,7 @@ The following privacy notice shall provide you with a general overview about the ## What kind of personal data do we process? -While using our products: Library Sniffer (automatically, except for Issue Reporter) +While using our products: ReplaceGoogleCDN (automatically, except for Issue Reporter) 1. Extension updates, subscription downloads, emergency notifications: Browser versionExtension versionOperating systemDate of last updateIP addressAdditionally, you may manually submit the following information about a webpage using the Issue Reporter: Browser build, if anyURLURL of referred webpage, if any, and webpage that opened the given pageBlockable itemsMatching filtersActive filter listsAccess to browser settings and installed plug-insEnabled extensions (voluntary) @@ -14,7 +14,8 @@ While using our products: Library Sniffer (automatically, except for Issue Repor 1. Event tracking: App and/or extension versionDemographic data (gender, age)Device typeWhich platforms you are usingLocation data based on your IP address (country)Button clicks and/or navigation patternsScreens shown -## How do we collect data? +## How do we collect data? (We Do not collect data) + List of techniques and tools we use for data collection. diff --git a/README.md b/README.md index 9fc72b31..bf5b80bd 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,9 @@ ## 原理 -> 默认未启用的规则, 如需启用请到扩展选项页自行打开 +> 借助浏览器提供的API,实现请求地址重定向 。[浏览器 V2 API ](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest), [浏览器 V3 API ](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest) + +> > 默认未启用的规则, 如需启用请到扩展选项页自行打开 此插件/扩展可以将以下的 cdn 资源替换为国内的: @@ -146,7 +148,7 @@ https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN-v3.zip ``` -## [declarative_net_reques 配置示例](extension/rules/README.md) +## [declarative_net_reques 规则配置示例](extension/rules/README.md) ## [测试用例](test/README.md) diff --git a/extension/rules/advance-no-use/RAEDME.md b/extension/rules/example-advance/RAEDME.md similarity index 100% rename from extension/rules/advance-no-use/RAEDME.md rename to extension/rules/example-advance/RAEDME.md diff --git a/extension/rules/advance-no-use/auth.json b/extension/rules/example-advance/auth.json similarity index 100% rename from extension/rules/advance-no-use/auth.json rename to extension/rules/example-advance/auth.json diff --git a/extension/rules/advance-no-use/rules_advance_redirect_1.json b/extension/rules/example-advance/rules_advance_redirect_1.json similarity index 100% rename from extension/rules/advance-no-use/rules_advance_redirect_1.json rename to extension/rules/example-advance/rules_advance_redirect_1.json diff --git a/extension/rules/advance-no-use/rules_advance_redirect_2.json b/extension/rules/example-advance/rules_advance_redirect_2.json similarity index 100% rename from extension/rules/advance-no-use/rules_advance_redirect_2.json rename to extension/rules/example-advance/rules_advance_redirect_2.json diff --git a/extension/rules/example-no-use/CORS.json b/extension/rules/example/CORS.json similarity index 100% rename from extension/rules/example-no-use/CORS.json rename to extension/rules/example/CORS.json diff --git a/extension/rules/example-no-use/README.md b/extension/rules/example/README.md similarity index 100% rename from extension/rules/example-no-use/README.md rename to extension/rules/example/README.md diff --git a/extension/rules/example-no-use/cdn.sstatic.net-stackoverflow.com.json b/extension/rules/example/cdn.sstatic.net-stackoverflow.com.json similarity index 100% rename from extension/rules/example-no-use/cdn.sstatic.net-stackoverflow.com.json rename to extension/rules/example/cdn.sstatic.net-stackoverflow.com.json diff --git a/extension/rules/example-no-use/commondatastorage.googleapis.com.json b/extension/rules/example/commondatastorage.googleapis.com.json similarity index 100% rename from extension/rules/example-no-use/commondatastorage.googleapis.com.json rename to extension/rules/example/commondatastorage.googleapis.com.json diff --git a/extension/rules/example-no-use/gerrit-googlesource.proxy.ustclug.org.json b/extension/rules/example/gerrit-googlesource.proxy.ustclug.org.json similarity index 100% rename from extension/rules/example-no-use/gerrit-googlesource.proxy.ustclug.org.json rename to extension/rules/example/gerrit-googlesource.proxy.ustclug.org.json diff --git a/extension/rules/example-no-use/golang.org.json b/extension/rules/example/golang.org.json similarity index 100% rename from extension/rules/example-no-use/golang.org.json rename to extension/rules/example/golang.org.json diff --git a/extension/rules/example-no-use/imgur.com-stackoverflow.com.json b/extension/rules/example/imgur.com-stackoverflow.com.json similarity index 100% rename from extension/rules/example-no-use/imgur.com-stackoverflow.com.json rename to extension/rules/example/imgur.com-stackoverflow.com.json diff --git a/extension/rules/example-no-use/no-url-redirect.json b/extension/rules/example/no-url-redirect.json similarity index 100% rename from extension/rules/example-no-use/no-url-redirect.json rename to extension/rules/example/no-url-redirect.json diff --git a/extension/rules/example-no-use/provider/no_use/public-cdn.geekzu.org.json b/extension/rules/example/provider/no_use/public-cdn.geekzu.org.json similarity index 100% rename from extension/rules/example-no-use/provider/no_use/public-cdn.geekzu.org.json rename to extension/rules/example/provider/no_use/public-cdn.geekzu.org.json diff --git a/extension/rules/example-no-use/provider/no_use/public-cdn.haah.net.json b/extension/rules/example/provider/no_use/public-cdn.haah.net.json similarity index 100% rename from extension/rules/example-no-use/provider/no_use/public-cdn.haah.net.json rename to extension/rules/example/provider/no_use/public-cdn.haah.net.json diff --git a/extension/rules/example-no-use/provider/public-cdn.loli.net.json b/extension/rules/example/provider/public-cdn.loli.net.json similarity index 100% rename from extension/rules/example-no-use/provider/public-cdn.loli.net.json rename to extension/rules/example/provider/public-cdn.loli.net.json diff --git a/extension/rules/example-no-use/provider/public-cdn.sevencdn.com.json b/extension/rules/example/provider/public-cdn.sevencdn.com.json similarity index 100% rename from extension/rules/example-no-use/provider/public-cdn.sevencdn.com.json rename to extension/rules/example/provider/public-cdn.sevencdn.com.json diff --git a/extension/rules/example-no-use/provider/public-cdn.sourcegcdn.com.json b/extension/rules/example/provider/public-cdn.sourcegcdn.com.json similarity index 100% rename from extension/rules/example-no-use/provider/public-cdn.sourcegcdn.com.json rename to extension/rules/example/provider/public-cdn.sourcegcdn.com.json diff --git a/extension/rules/example-no-use/provider/public-cdn.ustclug.org.json b/extension/rules/example/provider/public-cdn.ustclug.org.json similarity index 100% rename from extension/rules/example-no-use/provider/public-cdn.ustclug.org.json rename to extension/rules/example/provider/public-cdn.ustclug.org.json diff --git a/extension/rules/example-no-use/remove-referer-for-blog.json b/extension/rules/example/remove-referer-for-blog.json similarity index 100% rename from extension/rules/example-no-use/remove-referer-for-blog.json rename to extension/rules/example/remove-referer-for-blog.json diff --git a/extension/rules/example-no-use/rules_append_header_1.json b/extension/rules/example/rules_append_header_1.json similarity index 100% rename from extension/rules/example-no-use/rules_append_header_1.json rename to extension/rules/example/rules_append_header_1.json diff --git a/extension/rules/example-no-use/rules_block_request.json b/extension/rules/example/rules_block_request.json similarity index 100% rename from extension/rules/example-no-use/rules_block_request.json rename to extension/rules/example/rules_block_request.json diff --git a/extension/rules/example-no-use/rules_cdn_jsdelivr_net_redirect.json b/extension/rules/example/rules_cdn_jsdelivr_net_redirect.json similarity index 100% rename from extension/rules/example-no-use/rules_cdn_jsdelivr_net_redirect.json rename to extension/rules/example/rules_cdn_jsdelivr_net_redirect.json diff --git a/extension/rules/example-no-use/rules_domain_replace.json b/extension/rules/example/rules_domain_replace.json similarity index 100% rename from extension/rules/example-no-use/rules_domain_replace.json rename to extension/rules/example/rules_domain_replace.json diff --git a/extension/rules/example-no-use/rules_jquery_redirect.json b/extension/rules/example/rules_jquery_redirect.json similarity index 100% rename from extension/rules/example-no-use/rules_jquery_redirect.json rename to extension/rules/example/rules_jquery_redirect.json diff --git a/extension/tools/update-auth.py b/extension/tools/update-auth.py index 71b7b67f..c1a13de2 100644 --- a/extension/tools/update-auth.py +++ b/extension/tools/update-auth.py @@ -5,8 +5,8 @@ def get_auth_data(): auth = dict() - print(project_dir+'/rules/advance-no-use/auth.json') - with open(project_dir+'/rules/advance-no-use/auth.json', mode='r', encoding='utf-8') as f: + print(project_dir+'/rules/example-advance/auth.json') + with open(project_dir+'/rules/example-advance/auth.json', mode='r', encoding='utf-8') as f: content = f.read() res = json.loads(content) print(res) @@ -17,7 +17,7 @@ def get_auth_data(): def set_auth(all_auth, latest_auth): - with(open(project_dir+'/rules/advance-no-use/auth-latest.json', mode='w')) as f: + with(open(project_dir+'/rules/example-advance/auth-latest.json', mode='w')) as f: # f.writelines(json.dumps(all_auth)) print(all_auth[0]['action']['requestHeaders']) for item in enumerate(all_auth[0]['action']['requestHeaders']): diff --git a/extension/tools/update-auth.sh b/extension/tools/update-auth.sh index f5fef85e..c4f69506 100644 --- a/extension/tools/update-auth.sh +++ b/extension/tools/update-auth.sh @@ -13,7 +13,7 @@ __ROOT__=$( echo ${__ROOT__} -cd ${__ROOT__}/rules/advance-no-use/ +cd ${__ROOT__}/rules/example-advance/ if test -f auth.json; then des_line_number=$(grep -n 'x-auth-token' auth.json | awk -F ":" '{print $1}') diff --git a/extension/tools/update-domain.sh b/extension/tools/update-domain.sh index d8737bf4..f46d91bf 100644 --- a/extension/tools/update-domain.sh +++ b/extension/tools/update-domain.sh @@ -13,7 +13,7 @@ __ROOT__=$( echo ${__ROOT__} -cd ${__ROOT__}/rules/advance-no-use/ +cd ${__ROOT__}/rules/example-advance/ if test -f auth.json; then des_line_number=$(grep -n 'requestDomains' auth.json | awk -F ":" '{print $1}') diff --git a/extension/tools/update-punycode.sh b/extension/tools/update-punycode.sh index d2ec0986..471c3923 100644 --- a/extension/tools/update-punycode.sh +++ b/extension/tools/update-punycode.sh @@ -27,7 +27,7 @@ old_punycode='_xn--3px_' new_punycode='_xn--fiq_' -nums=$(grep -rl "$old_punycode" ${__ROOT__}/rules/advance/*.json | wc -l) +nums=$(grep -rl "$old_punycode" ${__ROOT__}/rules/example-advance/*.json | wc -l) if test $nums -gt 0; then diff --git a/release-archive-v3.sh b/release-archive-v3.sh index b8382841..c65cc684 100644 --- a/release-archive-v3.sh +++ b/release-archive-v3.sh @@ -29,8 +29,9 @@ zip -r ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip . \ -x "node_modules/*" \ -x "tools/*" \ -x "_metadata/*" \ - -x "rules/advance-no-use/*" \ - -x "rules/example-no-use/backup/*" \ + -x "rules/example-advance/*" \ + -x "rules/example/*" \ + -x "background-page.html" \ -x "screenshot/*" \ -x "test/*" \ -x "web/*" \ diff --git a/release-archive.sh b/release-archive.sh index f8bf0876..c567f9d8 100644 --- a/release-archive.sh +++ b/release-archive.sh @@ -7,12 +7,15 @@ __DIR__=$( ) cd ${__DIR__} +test -d extension/_metadata/ && rm -rf extension/_metadata/ + mkdir -p dist/ cd ${__DIR__}/dist test -f ReplaceGoogleCDN-v2.zip && rm -f ReplaceGoogleCDN-v2.zip test -f ReplaceGoogleCDN-v3.zip && rm -f ReplaceGoogleCDN-v3.zip + cd ${__DIR__}/extension # 打包 manifest v3 支持chromium 内核系列 @@ -23,8 +26,9 @@ zip -r ../dist/ReplaceGoogleCDN-v3.zip . \ -x "node_modules/*" \ -x "tools/*" \ -x "_metadata/*" \ - -x "rules/advance-no-use/*" \ - -x "rules/example-no-use/backup/*" \ + -x "rules/example-advance/*" \ + -x "rules/example/*" \ + -x "background-page.html" \ -x "screenshot/*" \ -x "test/*" \ -x "web/*" \ diff --git a/tools/README.md b/tools/README.md index 33ddac2c..e76bce85 100644 --- a/tools/README.md +++ b/tools/README.md @@ -3,6 +3,8 @@ 1. [轻松测试 Web API 与浏览器的兼容情况](https://caniuse.com/) 1. [html5test](https://html5test.com/) 1. [Features Detection](https://browserleaks.com/features) +1. [浏览器请求重定向 V2 API ](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest) +1. [浏览器请求重定向 V3 API ](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest) ## 打包工具 v3 mainifest 兼容 firefox diff --git a/tools/chromium-auto-test.sh b/tools/chromium-auto-test.sh index eba40d19..970ace29 100644 --- a/tools/chromium-auto-test.sh +++ b/tools/chromium-auto-test.sh @@ -15,15 +15,17 @@ __PROJECT__=$( cd ${__DIR__} - - # 自动测试 # 浏览器日志位于 nohup.out 文件 -nohup sh ${__PROJECT__}/tools/chromium.sh & -sleep 10 +# 参考: https://chromedevtools.github.io/devtools-protocol/ +# 显示CDP 可用参数 curl http://localhost:9222/json/protocol + +curl http://localhost:9222/json/version + +exit 0 curl http://127.0.0.1:9222/json/new?https://stackoverflow.com/tags/socat/hot?filter=all curl http://127.0.0.1:9222/json/new?https://patrickhlauke.github.io/recaptcha/ curl http://127.0.0.1:9222/json/new?https://cdn.jsdelivr.net/ diff --git a/tools/chromium.sh b/tools/chromium.sh index d368a3c6..0ae3af5b 100644 --- a/tools/chromium.sh +++ b/tools/chromium.sh @@ -18,8 +18,7 @@ HEADLESS_MODE='' while [ $# -gt 0 ]; do case "$1" in --xvfb) - XVFB_COMMAND='xvfb-run -s -terminate -screen 0 1920x1080x24 -e /dev/stdout --auto-servernum ' - XVFB_COMMAND='' + XVFB_COMMAND='xvfb-run --auto-servernum -e /dev/stdout -s "-terminate -screen 0 1920x1080x24" ' ;; --xwfb) XVFB_COMMAND='xwfb-run ' @@ -57,7 +56,7 @@ case $OS in "MINGW64_NT") # set chrome_user_data_dir='C:\Users\%username%\Local" "Settings\Temp\chrome-user-data' # IF NOT EXIST %chrome_user_data_dir% MD %chrome_user_data_dir% - CHROMIUM='chrome-win\\chrome.exe' + CHROMIUM='chrome-win/chrome.exe' ;; *) echo 'current script no support !' @@ -76,6 +75,9 @@ cd ${__PROJECT__}/var extensions=${__PROJECT__}/extension +cat > run-chromium.sh < run-firefox.sh <&2 exit 1 fi -# test -d temp && rm -rf temp -# example use proxy download source code # 使用代理下载源码 # bash update-library.sh --proxy http://127.0.0.1:1080 @@ -33,17 +35,17 @@ while [ $# -gt 0 ]; do shift $(($# > 0 ? 1 : 0)) done -mkdir -p temp -cd ${__DIR__}/temp +mkdir -p ${__PROJECT__}/var/tmp/ +cd ${__PROJECT__}/var/tmp/ -VENDOR=${__DIR__}/../third_party/ +VENDOR=${__PROJECT__}/extension/third_party/ test -d frontend-utils/.git || git clone -b main https://github.com/jingjingxyk/frontend-utils.git --depth=1 --progress mkdir -p ${VENDOR}/jingjingxyk/frontend-utils cp -f frontend-utils/utils.js ${VENDOR}/jingjingxyk/frontend-utils/utils.js -cd ${__DIR__}/temp +cd ${__PROJECT__}/var/tmp/ JSON_VERSION=v0.17.8 test -d svelte-jsoneditor/.git || git clone -b ${JSON_VERSION} https://github.com/josdejong/svelte-jsoneditor.git --depth=1 --progress @@ -56,6 +58,4 @@ mkdir -p ${VENDOR}/josdejong/svelte-jsoneditor/main cp -rf package-vanilla/* ${VENDOR}/josdejong/svelte-jsoneditor/main -cd ${__DIR__}/ - -test -d temp && rm -rf temp +cd ${__PROJECT__}/var/tmp/