Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/chrome-extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: chrome-extension

on:
pull_request:
paths:
- 'assets/apps_script/Code.gs'
- 'chrome-extension/**'
- '.github/workflows/chrome-extension.yml'
push:
branches:
- main
paths:
- 'assets/apps_script/Code.gs'
- 'chrome-extension/**'
- '.github/workflows/chrome-extension.yml'

permissions:
contents: read

jobs:
bundled-code-sync:
name: bundled Code.gs stays in sync
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Compare Apps Script source with extension fallback
run: |
if ! cmp -s assets/apps_script/Code.gs chrome-extension/Code.gs; then
echo "::error file=chrome-extension/Code.gs::chrome-extension/Code.gs must match assets/apps_script/Code.gs. Update the bundled fallback whenever the canonical Apps Script changes."
diff -u assets/apps_script/Code.gs chrome-extension/Code.gs || true
exit 1
fi

auth-key-smoke-test:
name: auth key smoke test
runs-on: ubuntu-latest
needs: bundled-code-sync

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install test dependencies
working-directory: chrome-extension
run: npm install

- name: Install Playwright browser
working-directory: chrome-extension
run: npx playwright install --with-deps chromium

- name: Run extension smoke tests
working-directory: chrome-extension
run: xvfb-run npm run test:smoke
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,23 @@ permissions:
# and more importantly keeps target/ warm via the rust-cache action.

jobs:
verify-chrome-extension-codegs-sync:
name: verify chrome-extension Code.gs sync
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Compare Apps Script source with extension fallback
run: |
if ! cmp -s assets/apps_script/Code.gs chrome-extension/Code.gs; then
echo "::error file=chrome-extension/Code.gs::chrome-extension/Code.gs must match assets/apps_script/Code.gs. Update the bundled fallback whenever the canonical Apps Script changes."
diff -u assets/apps_script/Code.gs chrome-extension/Code.gs || true
exit 1
fi

build:
needs: verify-chrome-extension-codegs-sync
strategy:
fail-fast: false
matrix:
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
- 🖥️ **Works on** Mac, Windows, Linux, Android, OpenWRT routers
- 🦊 **Any browser or app** that supports HTTP proxy or SOCKS5

## Community helpers

- **[mhrv-helper-extension](https://github.com/ardalan-ab/mhrv-helper-extension)** (Chrome, maintained by [@ardalan-ab](https://github.com/ardalan-ab)) — optional helper to generate an `AUTH_KEY`, copy `Code.gs`, and a `config.json` snippet for Apps Script mode. [How to use (English)](https://github.com/ardalan-ab/mhrv-helper-extension/blob/main/HOW_TO_USE.md) · [راهنمای فارسی](https://github.com/ardalan-ab/mhrv-helper-extension/blob/main/HOW_TO_USE.fa.md).

## How it works (the simple picture)

```
Expand Down Expand Up @@ -74,6 +78,8 @@ ISPs can't read inside encrypted HTTPS. They only see the address — `www.googl
11. Google shows a **Deployment ID** (a long random string). **Copy it** — you'll need it in Step 3.

> **Tip:** if you ever update `Code.gs` later, don't make a new deployment. Edit the code, then go to **Deploy → Manage deployments → ✏️ → Version: New version → Deploy**. The Deployment ID stays the same.
>
> **Optional:** use the community [Chrome extension](https://github.com/ardalan-ab/mhrv-helper-extension) — see [How to use](https://github.com/ardalan-ab/mhrv-helper-extension/blob/main/HOW_TO_USE.md) (English) or [راهنمای فارسی](https://github.com/ardalan-ab/mhrv-helper-extension/blob/main/HOW_TO_USE.fa.md).

### Step 2 — Download mhrv-rs

Expand Down Expand Up @@ -198,6 +204,10 @@ Most of the Rust code in this port was written with [Anthropic's Claude](https:/
- 🖥️ **روی** مک، ویندوز، لینوکس، اندروید، روتر OpenWRT کار می‌کند
- 🦊 **هر مرورگر یا برنامه‌ای** که از HTTP proxy یا SOCKS5 پشتیبانی کند

## ابزارهای جامعه

- **[mhrv-helper-extension](https://github.com/ardalan-ab/mhrv-helper-extension)** (کروم، نگهداری [@ardalan-ab](https://github.com/ardalan-ab)) — افزونهٔ اختیاری برای تولید `AUTH_KEY`، کپی `Code.gs` و قطعهٔ `config.json` در حالت Apps Script. [راهنمای فارسی](https://github.com/ardalan-ab/mhrv-helper-extension/blob/main/HOW_TO_USE.fa.md) · [How to use (English)](https://github.com/ardalan-ab/mhrv-helper-extension/blob/main/HOW_TO_USE.md).

## چطور کار می‌کند (تصویر ساده)

```
Expand Down Expand Up @@ -244,6 +254,8 @@ ISP داخل HTTPS رمزشده را نمی‌تواند بخواند. فقط آ
۱۱. گوگل یک **Deployment ID** نشانت می‌دهد (یک رشتهٔ تصادفی طولانی). **کپی‌اش کن** — در مرحلهٔ ۳ لازم داری.

> **نکته:** اگر بعداً `Code.gs` را به‌روزرسانی کنی، Deployment جدید نساز. کد را ویرایش کن، بعد **Deploy → Manage deployments → ✏️ → Version: New version → Deploy**. Deployment ID همان قبلی می‌ماند.
>
> **اختیاری:** افزونهٔ اختیاری کروم [mhrv-helper-extension](https://github.com/ardalan-ab/mhrv-helper-extension) — [راهنمای فارسی](https://github.com/ardalan-ab/mhrv-helper-extension/blob/main/HOW_TO_USE.fa.md) · [How to use (English)](https://github.com/ardalan-ab/mhrv-helper-extension/blob/main/HOW_TO_USE.md).

### مرحلهٔ ۲ — دانلود mhrv-rs

Expand Down
36 changes: 36 additions & 0 deletions chrome-extension/.github/workflows/sync-codegs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Runs when this folder is the Git repository root (e.g. ardalan-ab/mhrv-helper-extension).
# In the main monorepo, use .github/workflows/chrome-extension.yml instead (same cmp logic).

name: Code.gs sync with upstream

on:
push:
branches: [main, master]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
bundled-matches-upstream-main:
name: bundled Code.gs matches upstream main
runs-on: ubuntu-latest
steps:
- name: Check out extension repository
uses: actions/checkout@v4

- name: Fetch canonical Code.gs from main project (main branch)
run: |
curl -fsSL \
'https://raw.githubusercontent.com/therealaleph/MasterHttpRelayVPN-RUST/main/assets/apps_script/Code.gs' \
-o /tmp/upstream-Code.gs

- name: Compare with bundled Code.gs
run: |
if ! cmp -s Code.gs /tmp/upstream-Code.gs; then
echo "::error::Bundled Code.gs differs from therealaleph/MasterHttpRelayVPN-RUST main (assets/apps_script/Code.gs). Copy the upstream file into this repo and commit."
diff -u /tmp/upstream-Code.gs Code.gs || true
exit 1
fi
echo "OK: bundled Code.gs matches upstream main."
29 changes: 29 additions & 0 deletions chrome-extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
*.codex
node_modules
test-results
playwright-report
dist
dist-ssr
*.local
*.env
*.env.*.local
!.env.example
!.env.*.example
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
Loading
Loading