diff --git a/src/worker.js b/src/worker.js index 7799892..0fbd27a 100644 --- a/src/worker.js +++ b/src/worker.js @@ -1,17 +1,21 @@ export default { - async fetch(request, env, ctx) { + 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`); - } + if ('/' === url.pathname) { + return new Response(`curl -fsSL ${url.origin}/install.sh | sh - +iwr ${url.origin}/install.ps1 -useb | iex + +pnpm config get registry +pnpm config set registry https://registry.npmmirror.com +`); + } 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)'); + 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); - }, + }, };