Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
wenfer authored Jul 30, 2024
1 parent 946ecb0 commit 20b9678
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -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();
Expand Down

0 comments on commit 20b9678

Please sign in to comment.