mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 16:45:16 +00:00
Add PDF support
This commit is contained in:
@ -204,7 +204,7 @@ export class PostsController {
|
||||
|
||||
|
||||
|
||||
// Personnal movies
|
||||
// Personnal movies posts
|
||||
case PostKind.POST_KIND_MOVIE:
|
||||
const movieID = h.postInt("movieID");
|
||||
|
||||
@ -216,7 +216,7 @@ export class PostsController {
|
||||
break;
|
||||
|
||||
|
||||
// Web links
|
||||
// Web links posts
|
||||
case PostKind.POST_KIND_WEBLINK:
|
||||
|
||||
const url = h.postURL("url");
|
||||
@ -231,6 +231,24 @@ export class PostsController {
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
// PDF posts
|
||||
case PostKind.POST_KIND_PDF:
|
||||
|
||||
if(!h.hasFile("pdf"))
|
||||
h.error(401, "Missing PDF in 'pdf'!");
|
||||
|
||||
const pdf_path = await h.savePostFile("pdf", "post_pdf", "pdf", "application/pdf");
|
||||
|
||||
newPost.file = new PostFile({
|
||||
path: pdf_path,
|
||||
type: <string>lookup(pathUserData(pdf_path, true)),
|
||||
size: statSync(pathUserData(pdf_path, true)).size
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
h.error(500, "Unsupported kind of post!");
|
||||
|
Reference in New Issue
Block a user