Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tools #207

Closed
wants to merge 17 commits into from
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ max_line_length = 120

[*.{html,xml}]
indent_size = 4
indent_style = space

[*.{sh,bash}]
indent_size = 2
indent_style = space
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ tools/blocked-domain.py
tools/web/proxy.pac
dist
var
bin
2 changes: 1 addition & 1 deletion CHANGELOG-v3-x.x.x.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# v3

## v3 0.11.0 [2024-07-17 14:49:00 +0800]
## v3 0.12.0 [2024-07-17 14:49:00 +0800]

1. 移除无效、不可用的候选项地址 [不可用的 资源库 详情](public-cdn.md)
2. 更新 README.md
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
| 12 | `developer.android.com` | `developer.android.google.cn` | - | - |
| 13 | `source.android.com` | `source.android.google.cn` | - | - |
| 14 | `www.gstatic.com` | `www.gstatic.cn` | - | - |
| 15 | `lh3.googleusercontent.com` | `source.android.google.cn` | - | - |
| 15 | `lh3.googleusercontent.com` | - | - | - |
| 16 | `cdn.sstatic.net` | `sstatic.net` | - | - |

## 扩展选项页使用简述
Expand Down
48 changes: 28 additions & 20 deletions release-archive-v3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,26 @@ __DIR__=$(
cd "$(dirname "$0")"
pwd
)
cd ${__DIR__}
__PROJECT__=${__DIR__}

cd ${__PROJECT__}

mkdir -p ${__DIR__}/var/
mkdir -p ${__DIR__}/dist/
mkdir -p ${__PROJECT__}/var/
mkdir -p ${__PROJECT__}/dist/



## 打包 chromium 扩展

test -f ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip && rm -f ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip
test -f ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-chromium.zip && rm -f ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-chromium.zip

cd ${__DIR__}/
cd ${__PROJECT__}

test -d ${__DIR__}/extension/_metadata && rm -rf ${__DIR__}/extension/_metadata
test -d ${__PROJECT__}/extension/_metadata && rm -rf ${__PROJECT__}/extension/_metadata

cd ${__DIR__}/extension
cd ${__PROJECT__}/extension
# 打包 manifest v3 支持chromium 内核系列
zip -r ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip . \
zip -r ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-chromium.zip . \
-x ".git/*" \
-x ".idea/*" \
-x "_metadata/*" \
Expand All @@ -40,34 +42,40 @@ zip -r ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip . \
-x "third_party/highlightjs/*" \
-x "third_party/webrtc/*"

cd ${__DIR__}/
cd ${__PROJECT__}


zip -u ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip ./README.md
zip -u ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip ./Privacy.md
zip -u ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip ./LICENSE
zip -u ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-chromium.zip ./README.md
zip -u ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-chromium.zip ./Privacy.md
zip -u ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-chromium.zip ./LICENSE




## 打包 firefox 扩展

test -f ${__DIR__}/dist/ReplaceGoogleCDN-v3-firefox.zip && rm -f ${__DIR__}/dist/ReplaceGoogleCDN-v3-firefox.zip
test -f ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-firefox.zip && rm -f ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-firefox.zip

test -d ${__PROJECT__}/var/extension-tmp/ && rm -rf ${__PROJECT__}/var/extension-tmp/

mkdir -p ${__PROJECT__}/var/extension-tmp/rules/

cp -rf ${__PROJECT__}/extension/rules/*.json ${__PROJECT__}/var/extension-tmp/rules/
cp -rf ${__PROJECT__}/extension/icons ${__PROJECT__}/var/extension-tmp/
cp -rf ${__PROJECT__}/extension/background-page.html ${__PROJECT__}/var/extension-tmp/
cp -rf ${__PROJECT__}/extension/js/ ${__PROJECT__}/var/extension-tmp/

mkdir -p ${__DIR__}/var/extension-tmp/rules/

cp -rf ${__DIR__}/extension/rules/*.json ${__DIR__}/var/extension-tmp/rules/
cp -rf ${__DIR__}/extension/icons ${__DIR__}/var/extension-tmp/

rm -f ${__DIR__}/var/extension-tmp/rules/rules_remove_content_security_policy_header_test.json
rm -f ${__DIR__}/var/extension-tmp/rules/rules-default-domains-helper.json
rm -f ${__PROJECT__}/var/extension-tmp/rules/rules_remove_content_security_policy_header_test.json
rm -f ${__PROJECT__}/var/extension-tmp/rules/rules-default-domains-helper.json

python3 tools/update-v3-manifest.py firefox



cd ${__DIR__}/var/extension-tmp/
zip -r ${__DIR__}/dist/ReplaceGoogleCDN-v3-firefox.zip .
cd ${__PROJECT__}/var/extension-tmp/
zip -r ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-firefox.zip .

cd ${__DIR__}/

Expand Down
33 changes: 0 additions & 33 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,3 @@ https://github.com/jingjingxyk/extension-v3-test/blob/main/rules/rules_block_req
https://github.com/jingjingxyk/extension-v3-test/blob/main/rules/rules_redirect_extra.json?raw=true
https://github.com/jingjingxyk/extension-v3-test/blob/main/rules/rules_remove_content_security_policy_header.json?raw=true
```

## 扩展选项页,同步服务器端规则例子三 (覆盖静态默认规则候选项)

> 载入规则,优先级高的规则生效

```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/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


# 镜像地址

https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN/rules/mirrors/ajax.googleapis.com.json?raw=true
https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN/rules/mirrors/cdn.jsdelivr.net.json?raw=true
https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN/rules/mirrors/fonts.googleapis.com.json?raw=true
https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN/rules/mirrors/themes.googleusercontent.com.json?raw=true
https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN/rules/mirrors/code.jquery.com.json?raw=true
https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN/rules/mirrors/fonts.gstatic.com.json?raw=true
https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN/rules/mirrors/translate.googleapis.com.json?raw=true
https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN/rules/mirrors/cdnjs.cloudflare.com.json?raw=true
https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN/rules/mirrors/code.jquery.com-ui.json?raw=true
https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN/rules/mirrors/gravatar.com.json?raw=true
https://www.jingjingxyk.com/chromium-extension/ReplaceGoogleCDN/rules/mirrors/www.gstatic.com.json?raw=true
```
20 changes: 15 additions & 5 deletions tools/chromium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ cat > run-chromium.sh <<EOF
set -x
${XVFB_COMMAND} ${__PROJECT__}/var/${CHROMIUM} \
--user-data-dir=$USER_DATA \
--proxy-pac-url="http://127.0.0.1:65530/proxy.pac" \
--enable-remote-extensions \
--enable-extensions \
--load-extension="$extensions" \
--auto-open-devtools-for-tabs \
--enable-logging=stderr --v=1 \
--remote-debugging-port=9222 ${HEADLESS_MODE} \
--disable-encryption --disable-machine-id \
Expand All @@ -96,6 +96,16 @@ bash run-chromium.sh










exit 0


# chrome://version
# 全屏
# --start-fullscreen
Expand All @@ -110,15 +120,15 @@ bash run-chromium.sh
# 使用 代理 方式三
#--proxy-server="SOCKS5://127.0.0.1:2000"

# --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE 127.0.0.1"
# --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE 127.0.0.1"

# --flag-switches-begin \
# --disable-features=SameSiteByDefaultCookies,CookiesWithoutSameSiteMustBeSecure,ProcessPerSiteUpToMainFrameThreshold \
# --enable-features=VaapiVideoDecodeLinuxGL \
# --enable-features=PlatformHEVCDecoderSupport \
# --flag-switches-end \
# --disable-extensions-except=

# --disable-extensions-except=
# --auto-open-devtools-for-tabs


:<<'EOF'
Expand Down Expand Up @@ -146,4 +156,4 @@ EOF
# "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --flag-switches-begin --flag-switches-end -enable-logging=stderr --v=1

# chromium自定义启动参数 和 启用远程调试
# https://www.cnblogs.com/jingjingxyk/p/16577987.html
# https://www.cnblogs.com/jingjingxyk/p/16577987.html
3 changes: 3 additions & 0 deletions tools/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ test -d ${__PROJECT__}/../ReplaceGoogleCDN-v3 && rm -rf ${__PROJECT__}/../Replac
mv ${__PROJECT__}/dist/ReplaceGoogleCDN-v3 ${__PROJECT__}/../





exit 0

cd ${__PROJECT__}
Expand Down
5 changes: 3 additions & 2 deletions tools/download-chromium-extension.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ while [ $# -gt 0 ]; do
--proxy)
export HTTP_PROXY="$2"
export HTTPS_PROXY="$2"
export NO_PROXY="127.0.0.1,localhost,127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16,198.18.0.0/15,169.254.0.0/16"
export NO_PROXY="${NO_PROXY},localhost,.npmmirror.com,.aliyuncs.com,.taobao.org,.tsinghua.edu.cn,.ustc.edu.cn,.aliyun.com"
NO_PROXY="127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16"
NO_PROXY="${NO_PROXY},::1/128,fe80::/10,fd00::/8,ff00::/8"
export NO_PROXY="${NO_PROXY},localhost"
;;
*) ;;
esac
Expand Down
7 changes: 4 additions & 3 deletions tools/download-chromium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ while [ $# -gt 0 ]; do
--proxy)
export HTTP_PROXY="$2"
export HTTPS_PROXY="$2"
export NO_PROXY="127.0.0.1,localhost,127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16,198.18.0.0/15,169.254.0.0/16"
export NO_PROXY="${NO_PROXY},localhost,.npmmirror.com,.aliyuncs.com,.taobao.org,.tsinghua.edu.cn,.ustc.edu.cn,.aliyun.com"
NO_PROXY="127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16"
NO_PROXY="${NO_PROXY},::1/128,fe80::/10,fd00::/8,ff00::/8"
export NO_PROXY="${NO_PROXY},localhost"
;;
--mirror)
WITH_MIRROR="$2"
Expand Down Expand Up @@ -118,4 +119,4 @@ if [ -n "$DOWNLOAD_CHROMIUM_URL" ] ;then
esac
else
echo ' please check DOWNLOAD_CHROMIUM_URL !'
fi
fi
7 changes: 4 additions & 3 deletions tools/download-firefox-latest-stable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ while [ $# -gt 0 ]; do
--proxy)
export HTTP_PROXY="$2"
export HTTPS_PROXY="$2"
export NO_PROXY="127.0.0.1,localhost,127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16,198.18.0.0/15,169.254.0.0/16"
export NO_PROXY="${NO_PROXY},localhost,.npmmirror.com,.aliyuncs.com,.taobao.org,.tsinghua.edu.cn,.ustc.edu.cn,.aliyun.com"
NO_PROXY="127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16"
NO_PROXY="${NO_PROXY},::1/128,fe80::/10,fd00::/8,ff00::/8"
export NO_PROXY="${NO_PROXY},localhost"
;;
*)
;;
Expand All @@ -38,7 +39,7 @@ cd ${__PROJECT__}/var/

OS=$(uname -s)
ARCH=$(uname -m)
echo "${OS}_${ARCH}"
echo "${OS}-${ARCH}"


case $OS in
Expand Down
7 changes: 4 additions & 3 deletions tools/download-firefox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ while [ $# -gt 0 ]; do
--proxy)
export HTTP_PROXY="$2"
export HTTPS_PROXY="$2"
export NO_PROXY="127.0.0.1,localhost,127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16,198.18.0.0/15,169.254.0.0/16"
export NO_PROXY="${NO_PROXY},localhost,.npmmirror.com,.aliyuncs.com,.taobao.org,.tsinghua.edu.cn,.ustc.edu.cn,.aliyun.com"
NO_PROXY="127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16"
NO_PROXY="${NO_PROXY},::1/128,fe80::/10,fd00::/8,ff00::/8"
export NO_PROXY="${NO_PROXY},localhost"
;;
*)
;;
Expand Down Expand Up @@ -51,7 +52,7 @@ OS=$(uname -s)
ARCH=$(uname -m)
echo "${OS}_${ARCH}"

FIREFOX_VERSION=129.0b4
FIREFOX_VERSION=129.0b9

if [ -n "$1" ]; then
FIREFOX_VERSION="$1"
Expand Down
2 changes: 1 addition & 1 deletion tools/firefox-web-ext.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ bash release-archive-v3.sh
cp -f ${__PROJECT__}/tools/prefs.js $profile_folder

# 进入扩展所在目录
cd ${__PROJECT__}/var/extension-tmp/
cd ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-firefox/

# reference https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#web-ext-run

Expand Down
Loading
Loading