mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 16:45:16 +00:00
Add links support
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { RequestHandler } from "../entities/RequestHandler";
|
||||
import { UserHelper } from "../helpers/UserHelper";
|
||||
import { PostsHelper } from "../helpers/PostsHelper";
|
||||
import { Post, PostVisibilityLevel, PostKind, PostAccessLevel, PostPageKind, PostFile } from "../entities/Post";
|
||||
import { Post, PostVisibilityLevel, PostKind, PostAccessLevel, PostPageKind, PostFile, PostLink } from "../entities/Post";
|
||||
import { MoviesController } from "./MoviesController";
|
||||
import { MoviesHelper } from "../helpers/MoviesHelper";
|
||||
import { SurveyHelper } from "../helpers/SurveyHelper";
|
||||
@ -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, check_youtube_id } from "../utils/StringUtils";
|
||||
import { check_string_before_insert, check_youtube_id, checkURL } from "../utils/StringUtils";
|
||||
import { pathUserData } from "../utils/UserDataUtils";
|
||||
import { statSync } from "fs";
|
||||
import { lookup } from "mime-types";
|
||||
@ -215,6 +215,22 @@ export class PostsController {
|
||||
|
||||
break;
|
||||
|
||||
|
||||
// Web links
|
||||
case PostKind.POST_KIND_WEBLINK:
|
||||
|
||||
const url = h.postURL("url");
|
||||
|
||||
// For now, for safety, we do not fetch page content
|
||||
newPost.link = new PostLink({
|
||||
url: url,
|
||||
title: undefined,
|
||||
description: undefined,
|
||||
image: undefined
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
h.error(500, "Unsupported kind of post!");
|
||||
|
Reference in New Issue
Block a user