X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fobject-storage%2Fvideos.ts;h=9152c535295eb3108bb3a95d4e3eb65c81272d05;hb=d4fff51d96925b5704c97dd673dd779030b1aced;hp=b764e4b22ad67e8233ccd2e3b4da40f033080af3;hpb=77239b425a8e00822a53c9907415832a473c3eb6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/object-storage/videos.ts b/server/lib/object-storage/videos.ts index b764e4b22..9152c5352 100644 --- a/server/lib/object-storage/videos.ts +++ b/server/lib/object-storage/videos.ts @@ -13,6 +13,7 @@ import { removeObject, removeObjectByFullKey, removePrefix, + storeContent, storeObject, updateObjectACL, updatePrefixACL @@ -42,6 +43,16 @@ function storeHLSFileFromPath (playlist: MStreamingPlaylistVideo, path: string) }) } +function storeHLSFileFromContent (playlist: MStreamingPlaylistVideo, path: string, content: string) { + return storeContent({ + content, + inputPath: path, + objectStorageKey: generateHLSObjectStorageKey(playlist, basename(path)), + bucketInfo: CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS, + isPrivate: playlist.Video.hasPrivateStaticPath() + }) +} + // --------------------------------------------------------------------------- function storeWebTorrentFile (video: MVideo, file: MVideoFile) { @@ -55,16 +66,16 @@ function storeWebTorrentFile (video: MVideo, file: MVideoFile) { // --------------------------------------------------------------------------- -function updateWebTorrentFileACL (video: MVideo, file: MVideoFile) { - return updateObjectACL({ +async function updateWebTorrentFileACL (video: MVideo, file: MVideoFile) { + await updateObjectACL({ objectStorageKey: generateWebTorrentObjectStorageKey(file.filename), bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS, isPrivate: video.hasPrivateStaticPath() }) } -function updateHLSFilesACL (playlist: MStreamingPlaylistVideo) { - return updatePrefixACL({ +async function updateHLSFilesACL (playlist: MStreamingPlaylistVideo) { + await updatePrefixACL({ prefix: generateHLSObjectBaseStorageKey(playlist), bucketInfo: CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS, isPrivate: playlist.Video.hasPrivateStaticPath() @@ -166,6 +177,7 @@ export { storeWebTorrentFile, storeHLSFileFromFilename, storeHLSFileFromPath, + storeHLSFileFromContent, updateWebTorrentFileACL, updateHLSFilesACL,