Skip to content

Commit

Permalink
更新README.md 和 完善命令行模式浏览器加载扩展 (#193)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jingjingxyk authored Dec 5, 2023
1 parent 3082035 commit 3cbaa9d
Show file tree
Hide file tree
Showing 45 changed files with 243 additions and 107 deletions.
42 changes: 36 additions & 6 deletions .github/workflows/linux-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down
33 changes: 30 additions & 3 deletions .github/workflows/macos-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
97 changes: 72 additions & 25 deletions .github/workflows/windows-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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%
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG-v2-x.x.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. 格式化代码
Expand Down
5 changes: 3 additions & 2 deletions Privacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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.

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 资源替换为国内的:

Expand Down Expand Up @@ -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)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions extension/tools/update-auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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']):
Expand Down
2 changes: 1 addition & 1 deletion extension/tools/update-auth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down
2 changes: 1 addition & 1 deletion extension/tools/update-domain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down
2 changes: 1 addition & 1 deletion extension/tools/update-punycode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions release-archive-v3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/*" \
Expand Down
8 changes: 6 additions & 2 deletions release-archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 内核系列
Expand All @@ -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/*" \
Expand Down
Loading

0 comments on commit 3cbaa9d

Please sign in to comment.