mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 04:08:39 +01:00
22 lines
431 B
Text
22 lines
431 B
Text
<%
|
|
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}`
|
|
}) %>
|