1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2026-01-07 14:01:13 +00:00

Save proxied media with shortcode as filename

This commit is contained in:
Cadence Ember
2022-07-27 19:46:57 +12:00
parent 7237ebf8d4
commit 48c6e4a8a6
4 changed files with 13 additions and 11 deletions

View File

@@ -49,7 +49,7 @@ async function proxyResource(url, suggestedHeaders = {}, refreshCallback = null)
module.exports = [
{
route: "/imageproxy", methods: ["GET"], code: async (input) => {
route: "/imageproxy(/.*)?", methods: ["GET"], code: async (input) => {
const verifyResult = verifyURL(input.url)
if (verifyResult.status !== "ok") return verifyResult.value
if (!["png", "jpg", "webp"].some(ext => verifyResult.url.pathname.endsWith(ext))) return [400, "URL extension is not allowed"]
@@ -119,7 +119,7 @@ module.exports = [
}
},
{
route: "/videoproxy", methods: ["GET"], code: async (input) => {
route: "/videoproxy(/.*)?", methods: ["GET"], code: async (input) => {
const verifyResult = verifyURL(input.url)
if (verifyResult.status !== "ok") return verifyResult.value
const url = verifyResult.url