You've already forked AstralRinth
forked from didirus/AstralRinth
Change editor to comply with domain rules MOD-537 (#118)
* insert link rules * change error message
This commit is contained in:
@@ -460,7 +460,7 @@ function validateURL() {
|
||||
}
|
||||
|
||||
function cleanUrl(input: string): string {
|
||||
let url
|
||||
let url: URL
|
||||
|
||||
// Attempt to validate and parse the URL
|
||||
try {
|
||||
@@ -479,6 +479,12 @@ function cleanUrl(input: string): string {
|
||||
url.protocol = 'https:'
|
||||
}
|
||||
|
||||
// Block certain domains for compliance
|
||||
const blockedDomains = ['forgecdn', 'cdn.discordapp', 'media.discordapp']
|
||||
if (blockedDomains.some((domain) => url.hostname.includes(domain))) {
|
||||
throw new Error('Invalid URL. This domain is not allowed.')
|
||||
}
|
||||
|
||||
return url.toString()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user