mirror of
https://github.com/skidoodle/erettsegi-browser.git
synced 2025-02-15 05:39:15 +01:00
pdf proxy
This commit is contained in:
parent
6c591adb09
commit
15c1caf41f
4 changed files with 61 additions and 7 deletions
|
@ -14,8 +14,11 @@ export default async function handler(
|
|||
return res.status(400).json({ error: `Hiányzó paraméter: ${MissingParam}` })
|
||||
}
|
||||
|
||||
const domain = link.split('/')[2]
|
||||
if (domain !== 'dload-oktatas.educatio.hu') {
|
||||
const secure = req.headers['x-forwarded-proto'] === 'https'
|
||||
const protocol = secure ? 'https' : 'http'
|
||||
const address = req.headers.host
|
||||
|
||||
if (!link.startsWith(`${protocol}://${address}`)) {
|
||||
return res.status(400).json({ error: 'Érvénytelen link' })
|
||||
}
|
||||
|
||||
|
@ -24,6 +27,6 @@ export default async function handler(
|
|||
const status = response.status
|
||||
res.status(200).json({ status })
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Hiányzó paraméterek:' })
|
||||
res.status(500).json({ error: 'Internal Server Error' })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue