diff options
Diffstat (limited to 'server/lib/object-storage')
-rw-r--r-- | server/lib/object-storage/shared/object-storage-helpers.ts | 17 | ||||
-rw-r--r-- | server/lib/object-storage/videos.ts | 10 |
2 files changed, 26 insertions, 1 deletions
diff --git a/server/lib/object-storage/shared/object-storage-helpers.ts b/server/lib/object-storage/shared/object-storage-helpers.ts index be94b01a8..f517c5f69 100644 --- a/server/lib/object-storage/shared/object-storage-helpers.ts +++ b/server/lib/object-storage/shared/object-storage-helpers.ts | |||
@@ -59,6 +59,20 @@ async function storeObject (options: { | |||
59 | return uploadToStorage({ objectStorageKey, content: fileStream, bucketInfo, isPrivate }) | 59 | return uploadToStorage({ objectStorageKey, content: fileStream, bucketInfo, isPrivate }) |
60 | } | 60 | } |
61 | 61 | ||
62 | async function storeContent (options: { | ||
63 | content: string | ||
64 | inputPath: string | ||
65 | objectStorageKey: string | ||
66 | bucketInfo: BucketInfo | ||
67 | isPrivate: boolean | ||
68 | }): Promise<string> { | ||
69 | const { content, objectStorageKey, bucketInfo, inputPath, isPrivate } = options | ||
70 | |||
71 | logger.debug('Uploading %s content to %s%s in bucket %s', inputPath, bucketInfo.PREFIX, objectStorageKey, bucketInfo.BUCKET_NAME, lTags()) | ||
72 | |||
73 | return uploadToStorage({ objectStorageKey, content, bucketInfo, isPrivate }) | ||
74 | } | ||
75 | |||
62 | // --------------------------------------------------------------------------- | 76 | // --------------------------------------------------------------------------- |
63 | 77 | ||
64 | async function updateObjectACL (options: { | 78 | async function updateObjectACL (options: { |
@@ -206,6 +220,7 @@ export { | |||
206 | buildKey, | 220 | buildKey, |
207 | 221 | ||
208 | storeObject, | 222 | storeObject, |
223 | storeContent, | ||
209 | 224 | ||
210 | removeObject, | 225 | removeObject, |
211 | removeObjectByFullKey, | 226 | removeObjectByFullKey, |
@@ -223,7 +238,7 @@ export { | |||
223 | // --------------------------------------------------------------------------- | 238 | // --------------------------------------------------------------------------- |
224 | 239 | ||
225 | async function uploadToStorage (options: { | 240 | async function uploadToStorage (options: { |
226 | content: ReadStream | 241 | content: ReadStream | string |
227 | objectStorageKey: string | 242 | objectStorageKey: string |
228 | bucketInfo: BucketInfo | 243 | bucketInfo: BucketInfo |
229 | isPrivate: boolean | 244 | isPrivate: boolean |
diff --git a/server/lib/object-storage/videos.ts b/server/lib/object-storage/videos.ts index bfdef94fd..57d978e4c 100644 --- a/server/lib/object-storage/videos.ts +++ b/server/lib/object-storage/videos.ts | |||
@@ -42,6 +42,15 @@ function storeHLSFileFromPath (playlist: MStreamingPlaylistVideo, path: string) | |||
42 | }) | 42 | }) |
43 | } | 43 | } |
44 | 44 | ||
45 | function storeHLSFileFromContent (playlist: MStreamingPlaylistVideo, path: string, content: string) { | ||
46 | return storeObject({ | ||
47 | inputPath: path, | ||
48 | objectStorageKey: generateHLSObjectStorageKey(playlist, basename(path)), | ||
49 | bucketInfo: CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS, | ||
50 | isPrivate: playlist.Video.hasPrivateStaticPath() | ||
51 | }) | ||
52 | } | ||
53 | |||
45 | // --------------------------------------------------------------------------- | 54 | // --------------------------------------------------------------------------- |
46 | 55 | ||
47 | function storeWebTorrentFile (video: MVideo, file: MVideoFile) { | 56 | function storeWebTorrentFile (video: MVideo, file: MVideoFile) { |
@@ -166,6 +175,7 @@ export { | |||
166 | storeWebTorrentFile, | 175 | storeWebTorrentFile, |
167 | storeHLSFileFromFilename, | 176 | storeHLSFileFromFilename, |
168 | storeHLSFileFromPath, | 177 | storeHLSFileFromPath, |
178 | storeHLSFileFromContent, | ||
169 | 179 | ||
170 | updateWebTorrentFileACL, | 180 | updateWebTorrentFileACL, |
171 | updateHLSFilesACL, | 181 | updateHLSFilesACL, |