explain
This commit is contained in:
parent
da61426fc9
commit
eec06c1a24
|
|
@ -78,6 +78,7 @@ app.on("GET", ["/js/:path{.+}", "/shared/:path{.+}"], async c => {
|
||||||
// app routes
|
// app routes
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// inject browser-nav.js into NOSE apps when loaded in a NOSE iframe
|
||||||
app.use("*", async (c, next) => {
|
app.use("*", async (c, next) => {
|
||||||
await next()
|
await next()
|
||||||
|
|
||||||
|
|
@ -92,7 +93,6 @@ app.use("*", async (c, next) => {
|
||||||
|
|
||||||
const secFetchDest = c.req.header('Sec-Fetch-Dest')
|
const secFetchDest = c.req.header('Sec-Fetch-Dest')
|
||||||
const isIframe = secFetchDest === 'iframe'
|
const isIframe = secFetchDest === 'iframe'
|
||||||
|
|
||||||
if (!isIframe) return
|
if (!isIframe) return
|
||||||
|
|
||||||
const originalBody = await c.res.text()
|
const originalBody = await c.res.text()
|
||||||
|
|
@ -105,7 +105,6 @@ app.use("*", async (c, next) => {
|
||||||
modifiedBody = originalBody.replace('<body>', `<body>\n${shimScript}`)
|
modifiedBody = originalBody.replace('<body>', `<body>\n${shimScript}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return modified response
|
|
||||||
c.res = new Response(modifiedBody, {
|
c.res = new Response(modifiedBody, {
|
||||||
status: c.res.status,
|
status: c.res.status,
|
||||||
headers: c.res.headers
|
headers: c.res.headers
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user