mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

blink: use meta for redirect (#8031)

* try using meta

* color scheme

* revert test change

* escape

authored by hailey.at and committed by

GitHub 52429b65 0e658dbd

+16 -3
+2
bskylink/package.json
··· 9 9 }, 10 10 "dependencies": { 11 11 "@atproto/common": "^0.4.0", 12 + "@types/escape-html": "^1.0.4", 12 13 "body-parser": "^1.20.2", 13 14 "cors": "^2.8.5", 15 + "escape-html": "^1.0.3", 14 16 "express": "^4.19.2", 15 17 "http-terminator": "^3.2.0", 16 18 "kysely": "^0.27.3",
+8 -2
bskylink/src/routes/redirect.ts
··· 1 1 import assert from 'node:assert' 2 2 3 3 import {DAY, SECOND} from '@atproto/common' 4 + import escapeHTML from 'escape-html' 4 5 import {Express} from 'express' 5 6 6 7 import {AppContext} from '../context.js' ··· 40 41 } 41 42 42 43 res.setHeader('Cache-Control', `max-age=${(7 * DAY) / SECOND}`) 43 - res.setHeader('Location', url.href) 44 - return res.status(301).end() 44 + res.type('html') 45 + res.status(200) 46 + 47 + const escaped = escapeHTML(url.href) 48 + return res.send( 49 + `<html><head><meta http-equiv="refresh" content="0; URL='${escaped}'" /><style>:root { color-scheme: light dark; }</style></head></html>`, 50 + ) 45 51 }), 46 52 ) 47 53 }
+6 -1
bskylink/yarn.lock
··· 69 69 dependencies: 70 70 "@types/node" "*" 71 71 72 + "@types/escape-html@^1.0.4": 73 + version "1.0.4" 74 + resolved "https://registry.yarnpkg.com/@types/escape-html/-/escape-html-1.0.4.tgz#dc7c166b76c7b03b27e32f80edf01d91eb5d9af2" 75 + integrity sha512-qZ72SFTgUAZ5a7Tj6kf2SHLetiH5S6f8G5frB2SPQ3EyF02kxdyBFf4Tz4banE3xCgGnKgWLt//a6VuYHKYJTg== 76 + 72 77 "@types/node@*": 73 78 version "20.14.2" 74 79 resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.2.tgz#a5f4d2bcb4b6a87bffcaa717718c5a0f208f4a18" ··· 276 281 resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" 277 282 integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== 278 283 279 - escape-html@~1.0.3: 284 + escape-html@^1.0.3, escape-html@~1.0.3: 280 285 version "1.0.3" 281 286 resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" 282 287 integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==