api: remove onDemand mention and slight clean up

This commit is contained in:
wukko 2024-05-16 10:19:07 +06:00
parent e4646a9ff3
commit a70fc840dc
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -58,17 +58,19 @@ export function runAPI(express, app, gitCommit, gitBranch, __dirname) {
app.use('/api/json', apiLimiter);
app.use('/api/stream', apiLimiterStream);
app.use('/api/onDemand', apiLimiter);
app.use((req, res, next) => {
try { decodeURIComponent(req.path) } catch (e) { return res.redirect('/') }
try {
decodeURIComponent(req.path)
} catch {
return res.redirect('/')
}
next();
})
app.use('/api/json', express.json({
verify: (req, res, buf) => {
const acceptHeader = String(req.header('Accept')) === "application/json";
if (acceptHeader) {
if (String(req.header('Accept')) === "application/json") {
if (buf.length > 720) throw new Error();
JSON.parse(buf);
} else {