blink: use meta for redirect (#8031)

* try using meta

* color scheme

* revert test change

* escape
This commit is contained in:
Hailey
2025-03-20 15:08:54 -07:00
committed by GitHub
parent 0e658dbdfd
commit 52429b651f
3 changed files with 16 additions and 3 deletions
+8 -2
View File
@@ -1,6 +1,7 @@
import assert from 'node:assert'
import {DAY, SECOND} from '@atproto/common'
import escapeHTML from 'escape-html'
import {Express} from 'express'
import {AppContext} from '../context.js'
@@ -40,8 +41,13 @@ export default function (ctx: AppContext, app: Express) {
}
res.setHeader('Cache-Control', `max-age=${(7 * DAY) / SECOND}`)
res.setHeader('Location', url.href)
return res.status(301).end()
res.type('html')
res.status(200)
const escaped = escapeHTML(url.href)
return res.send(
`<html><head><meta http-equiv="refresh" content="0; URL='${escaped}'" /><style>:root { color-scheme: light dark; }</style></head></html>`,
)
}),
)
}