Add Discovery Videos feature
Let users upload videos, tag them with one or more entries, and watch them from a new Discovery Videos page. Backend: - Add Video and VideoEntry models and relations - Add video controller and /video routes - Add video thumbnail generation service (ffmpeg-static) - Add video upload storage location and config Frontend: - Add DiscoveryVideosPage with sidebar link and route - Add AddVideoDialog, VideoDropzone, EntryMultiSelect, VideoCard and VideoPlayerDialog components - Add discoveryVideos API client and useDiscoveryVideos hook - Add format helpers, video types and normalizers - Add skeleton for the page Docs: - Document the feature in docs-vault
This commit is contained in:
1 parent
4d88747649
commit
eb3a12f6cb
41 files changed
+2163
-15
No files matched your search
@@ -1,4 +1,5 @@
|
||||
const multer = require("multer");
|
||||
const fs = require("fs");
|
||||
const { v4: uuidv4 } = require("uuid");
|
||||
const path = require("path");
|
||||
const configService = require("./configService");
|
||||
@@ -57,8 +58,27 @@ const peoplePicturesUpload = multer({
|
||||
}),
|
||||
});
|
||||
|
||||
// ? discovery videos
|
||||
const videosUpload = multer({
|
||||
storage: multer.diskStorage({
|
||||
destination: function (req, file, cb) {
|
||||
const dataPath = configService.getSettings().userDataPath;
|
||||
const videosDir = path.join(dataPath, "videos");
|
||||
// ensure the folder exists even if createMediaFolders() was never called
|
||||
fs.mkdirSync(videosDir, { recursive: true });
|
||||
cb(null, videosDir);
|
||||
},
|
||||
filename: function (req, file, cb) {
|
||||
const uniqueFilename = uuidv4();
|
||||
const extension = file.originalname.split(".").pop();
|
||||
cb(null, `${uniqueFilename}.${extension}`);
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
entryPicturesUpload,
|
||||
collectionPicturesUpload,
|
||||
peoplePicturesUpload,
|
||||
videosUpload,
|
||||
};
|
||||
Reference in new issue
Block a user