Skip to content

Commit

Permalink
Fix getting paste's admin page
Browse files Browse the repository at this point in the history
  • Loading branch information
kLiHz authored and SharzyL committed Mar 25, 2024
1 parent 48edbed commit c494bb3
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ async function handleGet(request, env, ctx) {
return Response.redirect(env.FAVICON)
}

const staticPageContent = getStaticPage(url.pathname, env)
// return the editor for admin URL
const staticPageContent = getStaticPage((passwd.length > 0) ? "/" : url.pathname, env)
if (staticPageContent) {
// access to all static pages requires auth
const authResponse = verifyAuth(request, env)
Expand All @@ -181,14 +182,6 @@ async function handleGet(request, env, ctx) {
})
}

// return the editor for admin URL
if (passwd.length > 0) {
const item = await env.PB.get('index')
return new Response(item, {
headers: { "content-type": "text/html;charset=UTF-8" }
})
}

const mime = url.searchParams.get("mime") || getType(ext) || "text/plain"

const disp = url.searchParams.has("a") ? "attachment" : "inline"
Expand Down

0 comments on commit c494bb3

Please sign in to comment.