From b812cb1c3802a25f18266ad0615f1dbd839ccfcd Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 29 Dec 2025 19:48:55 -0500 Subject: [PATCH 1/2] Fix downloading plugins on 127.0.0.1 --- handleRequest.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handleRequest.ts b/handleRequest.ts index ff3472a..4b19dfe 100644 --- a/handleRequest.ts +++ b/handleRequest.ts @@ -137,12 +137,12 @@ async function resolvePluginOrSchemaUrl(url: URL) { function getAccessControlAllowOrigin(request: Request) { const origin = request.headers.get("origin"); - return origin != null && isAllowedLocalHostname(new URL(origin).hostname) + return origin != null && isLocalHostname(new URL(origin).hostname) ? origin : "https://dprint.dev"; } -function isAllowedLocalHostname(hostname: string) { +function isLocalHostname(hostname: string) { return hostname === "localhost" || hostname === "127.0.0.1"; } @@ -158,7 +158,7 @@ function shouldDirectlyServeFile(request: Request) { } const hostname = new URL(origin).hostname; - return hostname === "localhost" || hostname === "dprint.dev"; + return isLocalHostname(hostname) || hostname === "dprint.dev"; } function createRedirectResponse(location: string) { From 067204055ef1adb7751c8e297278bcd756ebf591 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 29 Dec 2025 19:50:49 -0500 Subject: [PATCH 2/2] update --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dcab4dd..8311655 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,8 @@ jobs: with: deno-version: v2.x - name: Run tests + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: deno test --allow-env --allow-read=. --allow-net=api.github.com,0.0.0.0,localhost - name: Deploy to Deno Deploy uses: denoland/deployctl@v1