diff --git a/experimental-features/v2/tools/use-advanced.sh b/experimental-features/v2/tools/use-advanced.sh index f48a2eb8..9225feeb 100644 --- a/experimental-features/v2/tools/use-advanced.sh +++ b/experimental-features/v2/tools/use-advanced.sh @@ -2,18 +2,20 @@ set -exu -__DIR__=$(cd "$(dirname "$0")";pwd) +__DIR__=$( + cd "$(dirname "$0")" + pwd +) cd ${__DIR__} __ROOT__=$( cd ${__DIR__}/../../../ pwd ) -cd ${__ROOT__} +cd ${__ROOT__} mkdir -p ${__ROOT__}/var/tmp/v2/js/ - test -f ${__ROOT__}/var/tmp/v2/js/background-default.js || cp -f ${__ROOT__}/extension-v2/js/background.js ${__ROOT__}/var/tmp/v2/js/background-default.js -cp -f ${__ROOT__}/experimental-features/v2/js/background-advance.js ${__ROOT__}/extension-v2/js/background.js \ No newline at end of file +cp -f ${__ROOT__}/experimental-features/v2/js/background-advance.js ${__ROOT__}/extension-v2/js/background.js diff --git a/experimental-features/v2/tools/use-default.sh b/experimental-features/v2/tools/use-default.sh index 90e6a793..6e4abcc7 100644 --- a/experimental-features/v2/tools/use-default.sh +++ b/experimental-features/v2/tools/use-default.sh @@ -2,16 +2,18 @@ set -exu -__DIR__=$(cd "$(dirname "$0")";pwd) +__DIR__=$( + cd "$(dirname "$0")" + pwd +) cd ${__DIR__} __ROOT__=$( cd ${__DIR__}/../../../ pwd ) -cd ${__ROOT__} +cd ${__ROOT__} mkdir -p ${__ROOT__}/var/tmp/v2/js/ - -test -f ${__ROOT__}/var/tmp/v2/js/background-default.js && cp -f ${__ROOT__}/var/tmp/v2/js/background-default.js ${__ROOT__}/extension-v2/js/background.js \ No newline at end of file +test -f ${__ROOT__}/var/tmp/v2/js/background-default.js && cp -f ${__ROOT__}/var/tmp/v2/js/background-default.js ${__ROOT__}/extension-v2/js/background.js diff --git a/experimental-features/v3/tools/update-auth.sh b/experimental-features/v3/tools/update-auth.sh index c4f69506..71e9017b 100644 --- a/experimental-features/v3/tools/update-auth.sh +++ b/experimental-features/v3/tools/update-auth.sh @@ -12,7 +12,6 @@ __ROOT__=$( ) echo ${__ROOT__} - cd ${__ROOT__}/rules/example-advance/ if test -f auth.json; then diff --git a/experimental-features/v3/tools/update-domain.sh b/experimental-features/v3/tools/update-domain.sh index f46d91bf..19bef38c 100644 --- a/experimental-features/v3/tools/update-domain.sh +++ b/experimental-features/v3/tools/update-domain.sh @@ -12,13 +12,12 @@ __ROOT__=$( ) echo ${__ROOT__} - cd ${__ROOT__}/rules/example-advance/ if test -f auth.json; then des_line_number=$(grep -n 'requestDomains' auth.json | awk -F ":" '{print $1}') - current_value=$(sed -n "${des_line_number}p" auth.json ) - current_value=$(echo $current_value | sed 's/[\s|\t|\"]//g') + current_value=$(sed -n "${des_line_number}p" auth.json) + current_value=$(echo $current_value | sed 's/[\s|\t|\"]//g') # 字符串截取模式匹配 current_value=${current_value#requetDomain} current_value=${current_value#: [} @@ -28,9 +27,9 @@ if test -f auth.json; then new_value='proxy.domain-example.com' - nums=`grep -rl "$current_value" *.json | wc -l` - if test $nums -gt 0 ; then - sed -i "s/${current_value}/${new_value}/g" `grep -rl "$current_value" *.json ` + nums=$(grep -rl "$current_value" *.json | wc -l) + if test $nums -gt 0; then + sed -i "s/${current_value}/${new_value}/g" $(grep -rl "$current_value" *.json) fi fi diff --git a/experimental-features/v3/tools/update-punycode.sh b/experimental-features/v3/tools/update-punycode.sh index 511bddc7..1fe91957 100644 --- a/experimental-features/v3/tools/update-punycode.sh +++ b/experimental-features/v3/tools/update-punycode.sh @@ -21,12 +21,10 @@ echo ${__ROOT__} # 交互式 # CHARSET=UTF-8 idn --punycode-encode - old_punycode='_xn--3px_' new_punycode='_xn--fiq_' - 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 e980a857..844d5398 100644 --- a/release-archive-v3.sh +++ b/release-archive-v3.sh @@ -12,8 +12,6 @@ cd ${__PROJECT__} mkdir -p ${__PROJECT__}/var/ mkdir -p ${__PROJECT__}/dist/ - - ## 打包 chromium 扩展 test -f ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-chromium.zip && rm -f ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-chromium.zip @@ -44,14 +42,10 @@ zip -r ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-chromium.zip . \ cd ${__PROJECT__} - 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 ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-firefox.zip && rm -f ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-firefox.zip @@ -60,20 +54,16 @@ test -d ${__PROJECT__}/var/extension-tmp/ && rm -rf ${__PROJECT__}/var/extension 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/js/ - - +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/js/ 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 ${__PROJECT__}/var/extension-tmp/ zip -r ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-firefox.zip . @@ -83,11 +73,9 @@ zip -u ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-firefox.zip ./README.md zip -u ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-firefox.zip ./Privacy.md zip -u ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-firefox.zip ./LICENSE - # 为了兼容 上一版的打包结果 cp -f ${__PROJECT__}/dist/ReplaceGoogleCDN-v3-chromium.zip ${__PROJECT__}/dist/ReplaceGoogleCDN-v3.zip - # 查看打包结果 cd ${__PROJECT__}/dist/ diff --git a/tools/chromium-auto-test.sh b/tools/chromium-auto-test.sh index a4c84616..36065d2a 100644 --- a/tools/chromium-auto-test.sh +++ b/tools/chromium-auto-test.sh @@ -14,7 +14,6 @@ __PROJECT__=$( cd ${__DIR__} - # 自动测试 # 浏览器日志位于 nohup.out 文件 @@ -26,7 +25,7 @@ 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/ -curl http://127.0.0.1:9222/json/new?https://developers.google.com/ +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/ +curl http://127.0.0.1:9222/json/new?https://developers.google.com/ diff --git a/tools/chromium.sh b/tools/chromium.sh index 8fc6befe..c880cc7c 100644 --- a/tools/chromium.sh +++ b/tools/chromium.sh @@ -18,21 +18,20 @@ HEADLESS_MODE='' while [ $# -gt 0 ]; do case "$1" in --xvfb) - XVFB_COMMAND='xvfb-run --auto-servernum -e /dev/stdout -s "-terminate -screen 0 1920x1080x24" ' + XVFB_COMMAND='xvfb-run --auto-servernum -e /dev/stdout -s "-terminate -screen 0 1920x1080x24" ' ;; --xwfb) - XVFB_COMMAND='xwfb-run ' + XVFB_COMMAND='xwfb-run ' ;; --headless) - HEADLESS_MODE='--headless --disable-gpu ' - ;; - *) + HEADLESS_MODE='--headless --disable-gpu ' ;; + *) ;; + esac shift $(($# > 0 ? 1 : 0)) done - OS=$(uname -s) ARCH=$(uname -m) echo "$OS" @@ -46,22 +45,22 @@ CHROMIUM='' case $OS in "Linux") - UUID=$(cat /proc/sys/kernel/random/uuid) - CHROMIUM='chrome-linux/chrome' + UUID=$(cat /proc/sys/kernel/random/uuid) + CHROMIUM='chrome-linux/chrome' ;; "Darwin") - UUID=$(uuidgen) - CHROMIUM='chrome-mac/Chromium.app/Contents/MacOS/Chromium' + UUID=$(uuidgen) + CHROMIUM='chrome-mac/Chromium.app/Contents/MacOS/Chromium' ;; "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' + # 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' + ;; +*) + echo 'current script no support !' + exit 0 ;; - *) - echo 'current script no support !' - exit 0 - ;; esac test -d /tmp/${UUID} || mkdir -p /tmp/${UUID} @@ -74,8 +73,7 @@ cd ${__PROJECT__}/var #扩展所在目录 extensions=${__PROJECT__}/extension - -cat > run-chromium.sh <run-chromium.sh < 0 ? 1 : 0)) done @@ -46,77 +46,76 @@ done ## LAST_CHANGE xml format LASTCHANGE_URL=https://commondatastorage.googleapis.com/chromium-browser-snapshots/ -if [ -z "$WITH_MIRROR" ] ; then +if [ -z "$WITH_MIRROR" ]; then + case $OS in + "Linux") + LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2FLAST_CHANGE?alt=media" + REVISION=$(curl -s -S $LASTCHANGE_URL) + echo "latest revision is $REVISION" + DOWNLOAD_CHROMIUM_URL="https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/$REVISION/chrome-linux.zip" + ;; + "Darwin") + LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Mac%2FLAST_CHANGE?alt=media" + REVISION=$(curl -s -S $LASTCHANGE_URL) + echo "latest revision is $REVISION" + DOWNLOAD_CHROMIUM_URL="https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/$REVISION/chrome-mac.zip" + ;; + 'MINGW64_NT'* | 'MSYS_NT'*) + LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Win_x64%2FLAST_CHANGE?alt=media" + REVISION=$(curl -s -S $LASTCHANGE_URL) + echo "latest revision is $REVISION" + DOWNLOAD_CHROMIUM_URL="https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/$REVISION/chrome-win.zip" + ;; + esac +else + if [ "$WITH_MIRROR" = 'china' ]; then + # 默认来源于 https://registry.npmmirror.com/-/binary/chromium-browser-snapshots/ + test -d ${__PROJECT__}/var/venv || bash ${__PROJECT__}/tools/python3-env-init.sh + . venv/bin/activate + cd ${__DIR__} case $OS in "Linux") - LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2FLAST_CHANGE?alt=media" - REVISION=$(curl -s -S $LASTCHANGE_URL) - echo "latest revision is $REVISION" - DOWNLOAD_CHROMIUM_URL="https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/$REVISION/chrome-linux.zip" + DOWNLOAD_CHROMIUM_URL=$(python3 get-latest-chromium-version-main.py linux) ;; "Darwin") - LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Mac%2FLAST_CHANGE?alt=media" - REVISION=$(curl -s -S $LASTCHANGE_URL) - echo "latest revision is $REVISION" - DOWNLOAD_CHROMIUM_URL="https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/$REVISION/chrome-mac.zip" + DOWNLOAD_CHROMIUM_URL=$(python3 get-latest-chromium-version-main.py darwin) ;; - 'MINGW64_NT'* | 'MSYS_NT'*) - LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Win_x64%2FLAST_CHANGE?alt=media" - REVISION=$(curl -s -S $LASTCHANGE_URL) - echo "latest revision is $REVISION" - DOWNLOAD_CHROMIUM_URL="https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/$REVISION/chrome-win.zip" + *) + DOWNLOAD_CHROMIUM_URL=$(python3 get-latest-chromium-version-main.py win) ;; esac -else - if [ "$WITH_MIRROR" = 'china' ] ;then - # 默认来源于 https://registry.npmmirror.com/-/binary/chromium-browser-snapshots/ - test -d ${__PROJECT__}/var/venv || bash ${__PROJECT__}/tools/python3-env-init.sh - . venv/bin/activate - cd ${__DIR__} - case $OS in - "Linux") - DOWNLOAD_CHROMIUM_URL=$(python3 get-latest-chromium-version-main.py linux) - ;; - "Darwin") - DOWNLOAD_CHROMIUM_URL=$(python3 get-latest-chromium-version-main.py darwin) - ;; - *) - DOWNLOAD_CHROMIUM_URL=$(python3 get-latest-chromium-version-main.py win) - ;; - esac - fi + fi fi - cd ${__PROJECT__}/var/ -if [ -n "$DOWNLOAD_CHROMIUM_URL" ] ;then - case $OS in - "Linux") - test -f chrome-linux.zip && rm -rf chrome-linux.zip - test -d chrome-linux && rm -rf chrome-linux - curl -L -O $DOWNLOAD_CHROMIUM_URL +if [ -n "$DOWNLOAD_CHROMIUM_URL" ]; then + case $OS in + "Linux") + test -f chrome-linux.zip && rm -rf chrome-linux.zip + test -d chrome-linux && rm -rf chrome-linux + curl -L -O $DOWNLOAD_CHROMIUM_URL - unzip chrome-linux.zip - ;; - "Darwin") - test -f chrome-mac.zip && rm -rf chrome-mac.zip - test -d chrome-mac && rm -rf chrome-mac - curl -L -O $DOWNLOAD_CHROMIUM_URL - unzip chrome-mac.zip - ;; + unzip chrome-linux.zip + ;; + "Darwin") + test -f chrome-mac.zip && rm -rf chrome-mac.zip + test -d chrome-mac && rm -rf chrome-mac + curl -L -O $DOWNLOAD_CHROMIUM_URL + unzip chrome-mac.zip + ;; - 'MINGW64_NT'* | 'MSYS_NT'*) - test -f chrome-win.zip && rm -rf chrome-win.zip - test -d chrome-win && rm -rf chrome-win - curl -L -O $DOWNLOAD_CHROMIUM_URL - unzip chrome-win.zip - ;; - *) - echo 'no match OS' - exit 0 - ;; - esac + 'MINGW64_NT'* | 'MSYS_NT'*) + test -f chrome-win.zip && rm -rf chrome-win.zip + test -d chrome-win && rm -rf chrome-win + curl -L -O $DOWNLOAD_CHROMIUM_URL + unzip chrome-win.zip + ;; + *) + echo 'no match OS' + exit 0 + ;; + esac else - echo ' please check DOWNLOAD_CHROMIUM_URL !' + echo ' please check DOWNLOAD_CHROMIUM_URL !' fi diff --git a/tools/download-firefox-latest-stable.sh b/tools/download-firefox-latest-stable.sh index 03902486..243bad00 100644 --- a/tools/download-firefox-latest-stable.sh +++ b/tools/download-firefox-latest-stable.sh @@ -13,14 +13,14 @@ __PROJECT__=$( while [ $# -gt 0 ]; do case "$1" in --proxy) - export HTTP_PROXY="$2" - export HTTPS_PROXY="$2" - 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" - ;; - *) + export HTTP_PROXY="$2" + export HTTPS_PROXY="$2" + 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 shift $(($# > 0 ? 1 : 0)) done @@ -41,7 +41,6 @@ OS=$(uname -s) ARCH=$(uname -m) echo "${OS}-${ARCH}" - case $OS in "Linux") curl -Lo firefox.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US" @@ -57,7 +56,7 @@ case $OS in # 将应用程序拷贝到指定目录 mkdir -p ${__PROJECT__}/var/Firefox - cp -rf /private/${TMP_MOUNT_POINT}/Firefox.app ${__PROJECT__}/var/Firefox + cp -rf /private/${TMP_MOUNT_POINT}/Firefox.app ${__PROJECT__}/var/Firefox ls -lh ${__PROJECT__}/var/Firefox/ ;; @@ -66,6 +65,3 @@ case $OS in curl -Lo firefox.exe "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=en-US" ;; esac - - - diff --git a/tools/download-firefox.sh b/tools/download-firefox.sh index ba9e1073..50620639 100644 --- a/tools/download-firefox.sh +++ b/tools/download-firefox.sh @@ -13,14 +13,14 @@ __PROJECT__=$( while [ $# -gt 0 ]; do case "$1" in --proxy) - export HTTP_PROXY="$2" - export HTTPS_PROXY="$2" - 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,.npmmirror.com" - ;; - *) + export HTTP_PROXY="$2" + export HTTPS_PROXY="$2" + 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,.npmmirror.com" ;; + *) ;; + esac shift $(($# > 0 ? 1 : 0)) done @@ -46,8 +46,6 @@ cd ${__PROJECT__}/var/ # firefox 114 支持 DNS over HTTPS ;WebTransport默认启用 # https://www.mozilla.org/en-US/firefox/113.0/releasenotes/ - - OS=$(uname -s) ARCH=$(uname -m) echo "${OS}_${ARCH}" @@ -90,7 +88,7 @@ case $OS in # 将应用程序拷贝到指定目录 mkdir -p ${__PROJECT__}/var/firefox - cp -rf /private/${TMP_MOUNT_POINT}/Firefox.app ${__PROJECT__}/var/firefox + cp -rf /private/${TMP_MOUNT_POINT}/Firefox.app ${__PROJECT__}/var/firefox ls -lh ${__PROJECT__}/var/firefox/ ;; @@ -101,6 +99,3 @@ case $OS in curl -Lo firefox.exe ${DOWNLOAD_FIREFOX_URL} ;; esac - - - diff --git a/tools/firefox-web-ext.sh b/tools/firefox-web-ext.sh index 5be2dc6a..d1eba05c 100644 --- a/tools/firefox-web-ext.sh +++ b/tools/firefox-web-ext.sh @@ -31,28 +31,24 @@ case $OS in FIREFOX='/Applications/Firefox.app/Contents/MacOS/firefox' # 自定义 启动目录 FIREFOX="${__PROJECT__}/var/firefox/Firefox.app/Contents/MacOS/firefox" - ;; + ;; 'MINGW64_NT'* | 'MSYS_NT'*) # FIREFOX="C:\Program Files\Mozilla Firefox\firefox.exe" exit 0 ;; *) - echo 'current script no support !' - exit 0 -;; + echo 'current script no support !' + exit 0 + ;; esac - profile_folder="/tmp/${UUID}" mkdir -p $profile_folder - - mkdir -p ${__PROJECT__}/var/ cd ${__PROJECT__}/var/ - # python3 ${__PROJECT__}/tools/update-manifest.py firefox ## 生成支持firefox 的扩展 @@ -75,7 +71,6 @@ bash release-archive-v3.sh # 支持 ResourceType # https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/ResourceType - # 它使用 user.js 中的相应设置覆盖 prefs.js 中的任何设置。 cp -f ${__PROJECT__}/tools/prefs.js $profile_folder @@ -96,5 +91,4 @@ npx web-ext run \ # --devtools \ # --browser-console \ - exit 0 diff --git a/tools/firefox.sh b/tools/firefox.sh index 2bc61c54..b5f2bab7 100644 --- a/tools/firefox.sh +++ b/tools/firefox.sh @@ -19,16 +19,16 @@ HEADLESS_MODE='' while [ $# -gt 0 ]; do case "$1" in --xvfb) - XVFB_COMMAND='xvfb-run --auto-servernum -e /dev/stdout -s "-terminate -screen 0 1920x1080x24" ' + XVFB_COMMAND='xvfb-run --auto-servernum -e /dev/stdout -s "-terminate -screen 0 1920x1080x24" ' ;; --xwfb) - XVFB_COMMAND='xwfb-run ' + XVFB_COMMAND='xwfb-run ' ;; --headless) - HEADLESS_MODE='-headless ' - ;; - *) + HEADLESS_MODE='-headless ' ;; + *) ;; + esac shift $(($# > 0 ? 1 : 0)) done @@ -50,28 +50,24 @@ case $OS in FIREFOX='/Applications/Firefox.app/Contents/MacOS/firefox' # 自定义 启动目录 FIREFOX="${__PROJECT__}/var/firefox/Firefox.app/Contents/MacOS/firefox" - ;; + ;; 'MINGW64_NT'* | 'MSYS_NT'*) # FIREFOX="C:\Program Files\Mozilla Firefox\firefox.exe" exit 0 ;; *) - echo 'current script no support !' - exit 0 -;; + echo 'current script no support !' + exit 0 + ;; esac - profile_folder="/tmp/${UUID}" mkdir -p $profile_folder - mkdir -p ${__PROJECT__}/var/ cd ${__PROJECT__}/var/ - - # python3 ${__PROJECT__}/tools/update-manifest.py firefox # firefox web extension @@ -91,13 +87,12 @@ cd ${__PROJECT__}/var/ # 支持 ResourceType # https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/ResourceType - # 它使用 user.js 中的相应设置覆盖 prefs.js 中的任何设置。 cp -f ${__PROJECT__}/tools/prefs.js $profile_folder # 启动firefox 实例 -cat > run-firefox.sh <run-firefox.sh <