From ba73e43725d9b1a0f7bc558276bd994843f4afc0 Mon Sep 17 00:00:00 2001 From: ashley Date: Wed, 11 Sep 2024 20:24:49 +0000 Subject: [PATCH] add new stuff :3 --- html/video-error.ejs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/html/video-error.ejs b/html/video-error.ejs index c495d607..39f61c8b 100644 --- a/html/video-error.ejs +++ b/html/video-error.ejs @@ -1,4 +1,22 @@ -<%- include('./layouts/error.ejs', { - error: "Video Error", - description: `${err_reason}` +<% + function isValidYouTubeID(v) { + return /^[a-zA-Z0-9_-]{11}$/.test(v); + } + + function isLetterSpam(v) { + return /^(.)\1+$/.test(v); + } + + let reason; + + if (!isValidYouTubeID(v) || isLetterSpam(v)) { + reason = "Video not found :c"; + } else { + reason = "this helps protect our community."; + } +%> + +<%- include('./layouts/error-video.ejs', { + error: "oops - loading failed :c", + description: `${reason}` }) %>