forked from NotNet/gluestick
clean up avatar url allowed code
This commit is contained in:
parent
f9f28810a2
commit
c0b8ee2427
1 changed files with 4 additions and 4 deletions
|
@ -5,11 +5,11 @@ import { redirect, useRouter } from "next/navigation";
|
|||
import { ensureJpg } from "@/image";
|
||||
|
||||
function avatarUrlAllowed(url: URL): boolean {
|
||||
let notGithub = url.hostname !== "avatars.githubusercontent.com";
|
||||
let notDiscord = url.hostname !== "cdn.discordapp.com";
|
||||
let github = url.hostname === "avatars.githubusercontent.com";
|
||||
let discord = url.hostname === "cdn.discordapp.com";
|
||||
|
||||
if (!notDiscord && !url.pathname.startsWith("/avatars")) return false;
|
||||
return !(notGithub && notDiscord);
|
||||
if (discord && !url.pathname.startsWith("/avatars")) return false;
|
||||
return github || discord;
|
||||
}
|
||||
|
||||
export default async function Page({
|
||||
|
|
Loading…
Reference in a new issue