1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-20 16:45:16 +00:00

Add support for YouTube posts

This commit is contained in:
2020-01-04 18:52:58 +01:00
parent 43a429e106
commit 6edf39d971
2 changed files with 38 additions and 1 deletions

View File

@ -57,4 +57,22 @@ export function removeHTMLNodes(input : string) : string {
*/
export function check_string_before_insert(s: string) : boolean {
return s.trim().length >= 3;
}
/**
* Check the validity of a YouTube ID
*
* @param s The id to check
*/
export function check_youtube_id(s: string) : boolean {
return s.length >= 5
&& !s.includes("/")
&& !s.includes("\\")
&& !s.includes("@")
&& !s.includes("&")
&& !s.includes("?")
&& !s.includes(".")
&& !s.includes("'")
&& !s.includes("\"")
}