Generate public urls for media.discordapp.net too

This commit is contained in:
Cadence Ember 2024-09-15 00:34:53 +12:00
commit ae9acbcc52
3 changed files with 38 additions and 33 deletions

View file

@ -121,9 +121,9 @@ function timestampToSnowflakeInexact(timestamp) {
/** @param {string} url */
function getPublicUrlForCdn(url) {
const match = url.match(/https:\/\/cdn.discordapp.com\/attachments\/([0-9]+)\/([0-9]+)\/([-A-Za-z0-9_.,]+)/)
const match = url.match(/https:\/\/(cdn|media)\.discordapp\.(?:com|net)\/attachments\/([0-9]+)\/([0-9]+)\/([-A-Za-z0-9_.,]+)/)
if (!match) return url
return `${reg.ooye.bridge_origin}/download/discordcdn/${match[1]}/${match[2]}/${match[3]}`
return `${reg.ooye.bridge_origin}/download/discord${match[1]}/${match[2]}/${match[3]}/${match[4]}`
}
module.exports.getPermissions = getPermissions