aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-22 14:28:03 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-07-26 11:29:31 +0200
commit83903cb65d531a6b6b91715387493ba8312b264d (patch)
treefd172e26a483331e74f15a062743a9d40d4016d3 /shared/extra-utils/server
parentc4fa01f7c45b66b112ebd08abce744b7c4041feb (diff)
downloadPeerTube-83903cb65d531a6b6b91715387493ba8312b264d.tar.gz
PeerTube-83903cb65d531a6b6b91715387493ba8312b264d.tar.zst
PeerTube-83903cb65d531a6b6b91715387493ba8312b264d.zip
Generate random uuid for video files
Diffstat (limited to 'shared/extra-utils/server')
-rw-r--r--shared/extra-utils/server/server.ts18
-rw-r--r--shared/extra-utils/server/servers-command.ts9
2 files changed, 13 insertions, 14 deletions
diff --git a/shared/extra-utils/server/server.ts b/shared/extra-utils/server/server.ts
index 5bdcbac52..d37a7f39c 100644
--- a/shared/extra-utils/server/server.ts
+++ b/shared/extra-utils/server/server.ts
@@ -3,7 +3,7 @@ import { copy } from 'fs-extra'
3import { join } from 'path' 3import { join } from 'path'
4import { root } from '@server/helpers/core-utils' 4import { root } from '@server/helpers/core-utils'
5import { randomInt } from '../../core-utils/miscs/miscs' 5import { randomInt } from '../../core-utils/miscs/miscs'
6import { VideoChannel } from '../../models/videos' 6import { Video, VideoChannel, VideoCreateResult, VideoDetails } from '../../models/videos'
7import { BulkCommand } from '../bulk' 7import { BulkCommand } from '../bulk'
8import { CLICommand } from '../cli' 8import { CLICommand } from '../cli'
9import { CustomPagesCommand } from '../custom-pages' 9import { CustomPagesCommand } from '../custom-pages'
@@ -75,19 +75,9 @@ export class PeerTubeServer {
75 75
76 channel?: VideoChannel 76 channel?: VideoChannel
77 77
78 video?: { 78 video?: Video
79 id: number 79 videoCreated?: VideoCreateResult
80 uuid: string 80 videoDetails?: VideoDetails
81 shortUUID: string
82 name?: string
83 url?: string
84
85 account?: {
86 name: string
87 }
88
89 embedPath?: string
90 }
91 81
92 videos?: { id: number, uuid: string }[] 82 videos?: { id: number, uuid: string }[]
93 } 83 }
diff --git a/shared/extra-utils/server/servers-command.ts b/shared/extra-utils/server/servers-command.ts
index a78921f2a..441c728c1 100644
--- a/shared/extra-utils/server/servers-command.ts
+++ b/shared/extra-utils/server/servers-command.ts
@@ -1,6 +1,7 @@
1import { exec } from 'child_process' 1import { exec } from 'child_process'
2import { copy, ensureDir, readFile, remove } from 'fs-extra' 2import { copy, ensureDir, readFile, remove } from 'fs-extra'
3import { join } from 'path' 3import { join } from 'path'
4import { basename } from 'path/posix'
4import { root } from '@server/helpers/core-utils' 5import { root } from '@server/helpers/core-utils'
5import { HttpStatusCode } from '@shared/models' 6import { HttpStatusCode } from '@shared/models'
6import { getFileSize, isGithubCI, wait } from '../miscs' 7import { getFileSize, isGithubCI, wait } from '../miscs'
@@ -72,6 +73,14 @@ export class ServersCommand extends AbstractCommand {
72 return join(root(), 'test' + this.server.internalServerNumber, directory) 73 return join(root(), 'test' + this.server.internalServerNumber, directory)
73 } 74 }
74 75
76 buildWebTorrentFilePath (fileUrl: string) {
77 return this.buildDirectory(join('videos', basename(fileUrl)))
78 }
79
80 buildFragmentedFilePath (videoUUID: string, fileUrl: string) {
81 return this.buildDirectory(join('streaming-playlists', 'hls', videoUUID, basename(fileUrl)))
82 }
83
75 async getServerFileSize (subPath: string) { 84 async getServerFileSize (subPath: string) {
76 const path = this.server.servers.buildDirectory(subPath) 85 const path = this.server.servers.buildDirectory(subPath)
77 86