Skip to content

Commit

Permalink
v3 版本 对firefox 提供基础功能支持 (#192)
Browse files Browse the repository at this point in the history
* test

* update firefox version

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* test github action

* update

* update

* test

* update download-firefix.sh

* update

* update

* 使用 prettier 格式化代码

* 调整打包脚本

* update changelog

* update README.md

* update

* update CHANGELOG

* update

* update tools/README.md

* update tools/README.md

* update tools/README.md

* update changelog

* update changelog

* update CHANGELOG

* fix format code error

* update firefox-web-ext.sh

* update firefox-web-ext.sh

* update firefox-web-ext.sh

* update update-v3-manifest.py

* update update-v3-manifest.py

* update build.yaml

* update action config

* update action config

* update action config

* 测试 headless 模式

* update

* update

* update

* update
  • Loading branch information
jingjingxyk authored Dec 4, 2023
1 parent 0c857f2 commit 3082035
Show file tree
Hide file tree
Showing 36 changed files with 579 additions and 210 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ jobs:
uname -m
uname -r
node -v
- name: Build v2
- name: Build
run: |
bash release-archive-v2.sh
bash release-archive.sh
ls -lah dist
- name: production artifacts v2
uses: actions/upload-artifact@v3
with:
Expand All @@ -38,17 +40,27 @@ jobs:
path: |
dist/ReplaceGoogleCDN-v2.zip
- name: production artifacts v3
uses: actions/upload-artifact@v3
with:
name: replace-google-cdn-v3
retention-days: 7
path: |
dist/ReplaceGoogleCDN-v3.zip
- name: Build v3
run: |
bash release-archive-v3.sh
ls -lah dist
- name: production artifacts v3 chromium
uses: actions/upload-artifact@v3
with:
name: replace-google-cdn-v3-chromium
retention-days: 7
path: |
dist/ReplaceGoogleCDN-v3-chromium.zip
- name: production artifacts v3 firefox
uses: actions/upload-artifact@v3
with:
Expand All @@ -63,6 +75,7 @@ jobs:
with:
artifact: "dist/ReplaceGoogleCDN-v2.zip"
keys: ${{ secrets.SUBMIT_KEYS }}

- name: Browser Plugin Publish v3
if: 0
uses: PlasmoHQ/bpp@v3
Expand All @@ -77,5 +90,6 @@ jobs:
with:
files: |
dist/ReplaceGoogleCDN-v2.zip
dist/ReplaceGoogleCDN-v3.zip
dist/ReplaceGoogleCDN-v3-chromium.zip
dist/ReplaceGoogleCDN-v3-firefox.zip
86 changes: 86 additions & 0 deletions .github/workflows/linux-x86_64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: linux-x86_64

on:
push:
pull_request:

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

jobs:
linux-x86_64:
if: github.ref == 'refs/heads/dev' || github.ref_name == 'dev'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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: 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
sudo python3 install-build-deps.py
- name: Download Chromium
run: |
set -x
bash tools/download-chromium.sh
- name: Download Firefox
shell: bash
run: |
set -x
bash tools/download-firefox.sh
- name: Chromium Load Extension
run: |
set -x
# bash tools/chromium.sh --xvfb
# bash tools/chromium.sh --headless
- name: Firefox Load Extension
run: |
set -x
# bash tools/firefox.sh --xvfb
# bash tools/firefox.sh --headless
56 changes: 56 additions & 0 deletions .github/workflows/macos-x86_64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: macos-x86_64

on: [push, pull_request]

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

jobs:
macos-x86_64:
if: github.ref == 'refs/heads/dev' || github.ref_name == 'dev'
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Prepare build environment
run: |
env
echo $HOME
brew config
brew install wget curl
softwareupdate --list --verbose
ls -lh $(xcrun --show-sdk-path)
ifconfig
export IPV6=$(ifconfig en0 | grep "inet6 " | grep -v "inet6 fe80:" | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p')
export IPV4=$(ifconfig en0 | 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
echo ${{ env.BRANCH_NAME }}
echo ${{ github.actor }}
echo ${{ github.repository }}
echo ${{ github.repository_owner }}
echo ${{ github.head_ref }}
echo ${{ github.ref_name }}
- name: Prepare Chromium Run Environment
run: |
set -x
- name: Download Chromium
run: |
set -x
bash tools/download-chromium.sh
- name: Download Firefox
shell: bash
run: |
set -x
bash tools/download-firefox.sh
69 changes: 69 additions & 0 deletions .github/workflows/windows-x86_64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: windows-x86_64

on: [push, pull_request]

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

jobs:
windows:
if: github.ref == 'refs/heads/dev' || github.ref_name == 'dev'
runs-on: windows-latest
steps:
- name: Prepare git
run: |
git config --global core.autocrlf false
git config --global core.eol lf
env
ipconfig
uname -a
pwd
ipconfig /all
- uses: actions/checkout@v3
- name: Prepare Chromium Run Environment
run: |
ipconfig /all
- name: Download Chromium
shell: bash
run: |
set -x
bash tools/download-chromium.sh
- 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

- 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: |
@chcp 65001>nul
echo foo=bar >> %GITHUB_OUTPUT%
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
**/.git
**/.svn
**/.hg
**/node_modules
node_modules
extension.zip
.idea/
Expand All @@ -16,6 +20,7 @@ extension/third_party/
extension/web-backup
extension/manifest-backup.json
tools/web/proxy.pac
tools/tools/prefs-latest.js

dist
var
4 changes: 4 additions & 0 deletions CHANGELOG-v2-x.x.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

## [公共 CDN 静态资源库](public-cdn.md)

## CHANGELOG for v2 0.10.17 [2023-02-09 13:01:00 +0800]

> 1. 格式化代码
## CHANGELOG for v2 0.10.16 [2023-02-09 13:01:00 +0800]

> 1. v2 版本 修改 高级用法分离出去,精简默认代码
Expand Down
9 changes: 5 additions & 4 deletions CHANGELOG-v3-x.x.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

## [测试用例](/test/README.md)

## [拨测工具](/tools/net-detect.md)
## CHANGELOG for v3 0.10.31 [2023-12-02 22:01:00 +0800]

## [公共 CDN 静态资源库](public-cdn.md)

## [一个完整的 测试环境例子 可用于查看 chromium 的源码 ](https://github.com/jingjingxyk/extension-v3-test)
> 1. 新增: 对 firefox 提供基础版功能,暂不提供高级功能。详情: [NDR 正则表达式 未定版 ](https://github.com/w3c/webextensions/issues/344)
> 1. 变更: 精简打包命令
> 1. 变更: 使用 prettier 格式化代码
> 1. 新增: github action workflows 实现命令行下载浏览器 并加载扩展,运行无界面加载扩展 (非headless 模式)
## CHANGELOG for v3 0.10.30 [2023-09-02 11:01:00 +0800]

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@

## 扩展选项页使用简述

1. <strong>点击扩展图标-自动打开扩展选项页</strong>
1. [扩展选项配置原理](extension/options_ui/README.md)
1. <strong>双击扩展图标-自动打开扩展选项配置页面</strong>
1. [扩展选项配置页面原理](extension/options_ui/README.md)

## v3 功能变更记录[`CHANGELOG-v3-x.x.x`](CHANGELOG-v3-x.x.x.md)

Expand Down Expand Up @@ -77,9 +77,11 @@

## 打包命令

> 构建结果位于 dist 目录
```shell

bash release-archive-v2.sh
bash release-archive.sh

bash release-archive-v3.sh

Expand Down
4 changes: 2 additions & 2 deletions extension-v2/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# 启用同时支持 chromium 和 firefox
# v2版本同时支持 chromium 和 firefox

## 发现 v2 版本功能齐全,具有 WebUI 的的扩展 [HeaderEditor](https://github.com/FirefoxBar/HeaderEditor.git)

## v2 版本扩展支持 chromium 内核版本 49

## v2 版本 与 v3 最大的区别:

> V3 版本不允许通过 javascript 脚本 动态 http 的修改请求头和响应头
> V3 版本不允许使用 javascript 脚本 动态修改 HTTP 请求头和响应头
## [WebExtensions incognito](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/incognito)
4 changes: 2 additions & 2 deletions extension-v2/js/background-advance.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ let need_replace_cdn_urls = [
"www.gravatar.com",
"maxcdn.bootstrapcdn.com",
"github.com",
"www.google.com",
"www.google.com"
];

let cdn_urls = need_replace_cdn_urls.map((currentValue, index, arr) => {
Expand All @@ -218,7 +218,7 @@ let opensource_google_urls = [
"*://summerofcode.withgoogle.com/*",
"*://cs.opensource.google/*", //Google Open Source
"*://opensource.googleblog.com/*",
"*://opensource.google/*",
"*://opensource.google/*"
];

// 高级玩法测试域名组
Expand Down
4 changes: 2 additions & 2 deletions extension-v2/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const remove_csp_item = [
"cross-origin-embedder-policy",
"cross-origin-opener-policy",
"cross-origin-opener-policy-report-only",
"cross-origin-embedder-policy-report-only",
"cross-origin-embedder-policy-report-only"
];

/**
Expand All @@ -42,7 +42,7 @@ const remove_csp_urls = [
"*://developers.redhat.com/*",
"*://*.githubusercontent.com/*",
"*://pub.dev/*",
"*://stackoverflow.com/*",
"*://stackoverflow.com/*"
];

/**
Expand Down
Loading

0 comments on commit 3082035

Please sign in to comment.