1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-20 08:35:17 +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

@ -13,7 +13,7 @@ import { GroupsAccessLevel } from "../entities/Group";
import { GroupsHelper } from "../helpers/GroupsHelper";
import { time } from "../utils/DateUtils";
import { findKey } from "../utils/ArrayUtils";
import { check_string_before_insert } from "../utils/StringUtils";
import { check_string_before_insert, check_youtube_id } from "../utils/StringUtils";
import { pathUserData } from "../utils/UserDataUtils";
import { statSync } from "fs";
import { lookup } from "mime-types";
@ -185,6 +185,25 @@ export class PostsController {
break;
// YouTube posts
case PostKind.POST_KIND_YOUTUBE:
const youtubeID = h.postString("youtube_id");
if(!check_youtube_id(youtubeID))
h.error(400, "Invalid YouTube ID!");
newPost.file = new PostFile({
path: youtubeID,
size: 0,
type: "youtube"
})
break;