From c0b8ee242724494950548691064128a0ce65dfdb Mon Sep 17 00:00:00 2001 From: slice Date: Wed, 26 Apr 2023 18:22:56 -0700 Subject: [PATCH] clean up avatar url allowed code --- src/app/register/page.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/register/page.tsx b/src/app/register/page.tsx index 4c76191..b7a6b8c 100644 --- a/src/app/register/page.tsx +++ b/src/app/register/page.tsx @@ -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({