Skip to content

Commit

Permalink
为添加文档做准备,更新辅助脚本 (#213)
Browse files Browse the repository at this point in the history
* add docs

* with pnpm

* update download-firefox.sh

* update download-firefox.sh

* update download-firefox.sh

* update download-firefox.sh

* update download-firefox.sh

* 更新辅助脚本

* add linux arm64 github ci
  • Loading branch information
jingjingxyk authored Mar 3, 2025
1 parent cd70246 commit 3b5c862
Show file tree
Hide file tree
Showing 16 changed files with 293 additions and 23 deletions.
119 changes: 119 additions & 0 deletions .github/workflows/linux-aarch64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: linux-aarch64

on:
push:
pull_request:

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
linux-aarch64:
if: 0
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Prepare Source Code
run: |
echo $PATH
env
docker info
id -u
id -g
who
cat /etc/os-release
hostnamectl
uname -s
uname -m
uname -r
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
cat /proc/cpuinfo | grep "cpu cores" | uniq
cat /proc/cpuinfo| grep "processor"| wc -l
lscpu
export IPV6=$(ip -6 address show | grep inet6 | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p')
export IPV4=$(ip -4 address show | grep inet | grep -v 127.0.0 | awk '{print $2}' | cut -d'/' -f1 | sed -n '1p')
echo $IPV4
echo $IPV6
echo "X_IPV6=${IPV6}" >> $GITHUB_ENV
echo "X_IPV4=${IPV4}" >> $GITHUB_ENV
sudo apt install -y jq curl
echo ${{ env.BRANCH_NAME }}
echo ${{ github.actor }}
echo ${{ github.repository }}
echo ${{ github.repository_owner }}
echo ${{ github.head_ref }}
echo ${{ github.ref_name }}
# sudo sed -i "[email protected]@azure.archive.ubuntu.com@g" /etc/apt/sources.list
# sudo sed -i "[email protected]@azure.archive.ubuntu.com@g" /etc/apt/sources.list
sudo apt install -y supervisor socat
- name: Cache Chromium
uses: actions/cache@v4
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
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
# 解决中文显示问题
sudo apt-get install -y locales fonts-wqy-zenhei
sudo localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
- name: Download Chromium
run: |
set -x
if [ ! -f ${{ github.workspace }}/var/chrome-linux.zip ] ; then
bash tools/download-chromium.sh
fi
- name: Cache Firefox
uses: actions/cache@v4
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
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: |
set -x
# bash tools/firefox.sh --xvfb
# bash tools/firefox.sh --headless
3 changes: 3 additions & 0 deletions .github/workflows/linux-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ jobs:
# 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
# 解决中文显示问题
sudo apt-get install -y locales fonts-wqy-zenhei
sudo localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
- name: Download Chromium
run: |
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG-v3-x.x.x.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# v3

## 1.0.0 [2025-03-04 15:52:00 +0800]

1. 添加文档

## 0.12.1 [2024-08-02 16:14:00 +0800]

1. 修复打包扩展bug
Expand Down
7 changes: 7 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 文档

请求地址重定向 工具文档

## 实现原理

借助浏览器提供的API,实现请求地址重定向
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"icons": {
"128": "icons/128.png"
},
"description": "将 Google CDN 替换为国内镜像 v3 更新日期:2024-08-02",
"description": "将 Google CDN 替换为国内镜像 v3 更新日期:2025-03-03",
"background": {
"service_worker": "js/background.js",
"type": "module"
Expand Down
23 changes: 23 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
theme:
name: material
features:
- navigation.tabs
- navigation.tabs.sticky
- navigation.instant
- navigation.instant.progress
- navigation.expand
- navigation.path
- navigation.top
site_name: DOCS
site_url: ""

plugins:
- search
- offline

nav:
- index.md
- base:
- base/index.md
- advance:
- advance/index.md
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
"chromium-test": "bash tools/chromium.sh"
},
"devDependencies": {
"@types/chrome": "^0.0.253",
"prettier": "^3.1.0",
"typescript": "^5.3.2",
"web-ext": "^7.9.0"
"@types/chrome": "^0.0.307",
"npm-check": "^6.0.1",
"pnpm": "^10.5.2",
"prettier": "^3.5.3",
"typescript": "^5.8.2",
"web-ext": "^8.4.0"
}
}
4 changes: 3 additions & 1 deletion tools/chromium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ 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" \
--no-sandbox \
--enable-remote-extensions \
--enable-extensions \
--load-extension="$extensions" \
Expand All @@ -87,8 +87,10 @@ ${XVFB_COMMAND} ${__PROJECT__}/var/${CHROMIUM} \
--disable-encryption --disable-machine-id \
--start-maximized \
about:blank
EOF

# --proxy-pac-url="http://127.0.0.1:65530/proxy.pac" \
bash run-chromium.sh

exit 0
Expand Down
1 change: 1 addition & 0 deletions tools/download-chromium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ done
# Download Chromium
## https://www.chromium.org/getting-involved/download-chromium/#downloading-old-builds-of-chrome-chromium
## https://commondatastorage.googleapis.com/chromium-browser-snapshots/
## https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html

## LAST_CHANGE xml format
LASTCHANGE_URL=https://commondatastorage.googleapis.com/chromium-browser-snapshots/
Expand Down
11 changes: 6 additions & 5 deletions tools/download-firefox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ OS=$(uname -s)
ARCH=$(uname -m)
echo "${OS}_${ARCH}"

FIREFOX_VERSION=129.0b9
FIREFOX_VERSION=136.0b9

if [ -n "$1" ]; then
FIREFOX_VERSION="$1"
Expand All @@ -62,11 +62,12 @@ DOWNLOAD_FIREFOX_URL_PREFIX=https://archive.mozilla.org/pub/firefox/releases

case $OS in
"Linux")
test -f firefox.tar.bz2 && rm -rf firefox.tar.bz2
test -f firefox.tar.xz && rm -rf firefox.tar.xz
test -d firefox && rm -rf firefox
DOWNLOAD_FIREFOX_URL=${DOWNLOAD_FIREFOX_URL_PREFIX}/${FIREFOX_VERSION}/linux-${ARCH}/en-US/firefox-${FIREFOX_VERSION}.tar.bz2
curl -Lo firefox.tar.bz2 ${DOWNLOAD_FIREFOX_URL}
tar -jxvf firefox.tar.bz2
DOWNLOAD_FIREFOX_URL=${DOWNLOAD_FIREFOX_URL_PREFIX}/${FIREFOX_VERSION}/linux-${ARCH}/en-US/firefox-${FIREFOX_VERSION}.tar.xz
curl -Lo firefox.tar.xz ${DOWNLOAD_FIREFOX_URL}
xz -d firefox.tar.xz
tar -xvf firefox.tar
;;
"Darwin")
FIREFOX_DMG_FILE=firefox.dmg
Expand Down
29 changes: 29 additions & 0 deletions tools/npm-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -exu

__DIR__=$(
cd "$(dirname "$0")"
pwd
)
cd ${__DIR__}

__PROJECT__=$(readlink -f ${__DIR__}/../)

cd ${__PROJECT__}

if [[ ! -f ${__PROJECT__}/bin/runtime/node/bin/node ]]; then
bash tools/setup-nodejs-runtime.sh --mirror china
fi

export PATH=${__PROJECT__}/bin/runtime/node/bin:$PATH

# npm install pnpm npm-check -save-dev --registry=https://registry.npmmirror.com

npx pnpm install --registry=https://registry.npmmirror.com

exit 0

# npm install pnpm npm-check --dev --registry=https://registry.npmmirror.com

npx npm-check-updates -u
30 changes: 30 additions & 0 deletions tools/python3-init-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)

__PROJECT__=$(
cd ${__DIR__}/../
pwd
)

# docker pull squidfunk/mkdocs-material

mkdir -p ${__PROJECT__}/var/
cd ${__PROJECT__}/var/

. venv/bin/activate

cd ${__PROJECT__}/

mkdocs --help
# mkdocs new .
mkdocs build --help
mkdocs build -d dist/docs/
mkdocs serve -f mkdocs.yml



26 changes: 26 additions & 0 deletions tools/python3-venv-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)

__PROJECT__=$(
cd ${__DIR__}/../
pwd
)

mkdir -p ${__PROJECT__}/var/
cd ${__PROJECT__}/var/

python3 -m venv venv

. venv/bin/activate

cd ${__PROJECT__}/tools/

pip3 install mkdocs-material -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install playwright -i https://pypi.tuna.tsinghua.edu.cn/simple

pip3 freeze >requirements.txt
File renamed without changes.
43 changes: 33 additions & 10 deletions tools/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
certifi==2023.7.22
charset-normalizer==2.1.0
greenlet==2.0.2
idna==3.3
pika==1.3.1
playwright==1.35.0
pyee==9.0.4
requests==2.28.1
typing_extensions==4.7.1
urllib3==1.26.11
babel==2.17.0
backrefs==5.8
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
colorama==0.4.6
ghp-import==2.1.0
greenlet==3.1.1
idna==3.10
Jinja2==3.1.5
Markdown==3.7
MarkupSafe==3.0.2
mergedeep==1.3.4
mkdocs==1.6.1
mkdocs-get-deps==0.2.0
mkdocs-material==9.6.7
mkdocs-material-extensions==1.3.1
packaging==24.2
paginate==0.5.7
pathspec==0.12.1
platformdirs==4.3.6
playwright==1.50.0
pyee==12.1.1
Pygments==2.19.1
pymdown-extensions==10.14.3
python-dateutil==2.9.0.post0
PyYAML==6.0.2
pyyaml_env_tag==0.1
requests==2.32.3
six==1.17.0
typing_extensions==4.12.2
urllib3==2.3.0
watchdog==6.0.0
4 changes: 2 additions & 2 deletions tools/setup-nodejs-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ case $ARCH in
;;
esac

APP_VERSION='v20.15.1'
APP_VERSION='v22.14.0'
APP_NAME='node'
VERSION='v20.15.1'
VERSION='v22.14.0'

mkdir -p bin/runtime
mkdir -p var/runtime
Expand Down

0 comments on commit 3b5c862

Please sign in to comment.