Modify GitHub Content via Cloudflare Worker ghproxy

Preface

Previously we implemented ghproxy to analyze and modify the content of GitHub scripts, wrapping all GitHub links with ghproxy
I just had an idea, what else can ghproxy's content modification achieve?

Approach

Suppose there is a very popular one-click script that contains AFF links for VPS and VPN, as well as a download link for the sing-box zip package
(I made up an example)
bash <(curl -fsSL https://github.com/crazypeace/ghproxy/raw/refs/heads/main/fake/test-install.sh)


Based on the existing ghproxy worker.js file, developed for GPT
This is a Cloudflare Worker JS script
Add the following processing:

1. In the processing of .sh file content, add the following effect to link processing

When the link contains racknerd and aff=,
replace the number after aff= with 54321

When the link contains justmysocks and aff=,
replace the number after aff= with 98765

2. Before performing fetch on the destination url, add the following processing
When the path is https://github.com/SagerNet/sing-box/releases/download/v1.12.15/sing-box-1.12.15-windows-amd64.zip,
change to fetch https://github.com/XTLS/Xray-core/releases/download/v25.12.8/Xray-windows-64.zip and return the data

The result has been uploaded to Github

Test

In the image below,
on the left is the "normal" ghproxy, using https://ghproxy.lvedong.eu.org/ as an example
bash <(curl -fsSL https://ghproxy.lvedong.eu.org/https://github.com/crazypeace/ghproxy/raw/refs/heads/main/fake/test-install.sh)
on the right is the "tampered" ghproxy, using https://ghproxy-fake.lvedong.eu.org/ as an example
bash <(curl -fsSL https://ghproxy-fake.lvedong.eu.org/https://github.com/crazypeace/ghproxy/raw/refs/heads/main/fake/test-install.sh)
You can see that the aff link has been modified

The result of extracting the downloaded zip file is also different


Summary

ghproxy should still be controlled in your own hands

========

Postscript

This time (2026-1-11) for GPT development I used
Comments