Files
proxy-get.pnpm.io/src/worker.js

18 lines
682 B
JavaScript

export default {
async fetch(request, env, ctx) {
const url = new URL(request.url);
console.log('url :>> ', url);
if ("/" === url.pathname) {
return new Response(`curl -fsSL ${url.origin}/install.sh | sh -
iwr ${url.origin}/install.ps1 -useb | iex`);
}
let response = await fetch(`http://get.pnpm.io${url.pathname}`);
let text = await response.text();
text = text.replace(/https:\/\/github.com/g, "https://gh-cf.oo1.dev/https://github.com");
text=text.replace('Downloading pnpm from GitHub','Downloading pnpm from GitHub (via Cloudflare)');
text=text.replace('Downloading pnpm','Downloading pnpm (via Cloudflare)');
return new Response(text);
},
};