From 20b967820c9ab061d5fdc3139d36bf46328d0d72 Mon Sep 17 00:00:00 2001 From: wenfer Date: Tue, 30 Jul 2024 14:15:05 +0800 Subject: [PATCH] Update index.js --- src/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 37d63151..28275b57 100644 --- a/src/index.js +++ b/src/index.js @@ -17,7 +17,7 @@ const routes = { "ecr.qiuyuan.workers.dev": "https://public.ecr.aws", // staging - "docker-staging.libcuda.so": dockerHub, + "docker-staging.qiuyuan.workers.dev": dockerHub, }; function routeByHosts(host) { @@ -30,6 +30,10 @@ function routeByHosts(host) { return ""; } +import DOCS from './help.html' + + + async function handleRequest(request) { const url = new URL(request.url); const upstream = routeByHosts(url.hostname); @@ -45,6 +49,15 @@ async function handleRequest(request) { } const isDockerHub = upstream == dockerHub; const authorization = request.headers.get("Authorization"); + // return docs + if (url.pathname === "/") { + return new Response(DOCS, { + status: 200, + headers: { + "content-type": "text/html" + } + }); + } if (url.pathname == "/v2/") { const newUrl = new URL(upstream + "/v2/"); const headers = new Headers();