aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/update-host.ts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/update-host.ts')
-rwxr-xr-xscripts/update-host.ts18
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/update-host.ts b/scripts/update-host.ts
index 1dc19664d..64eba867a 100755
--- a/scripts/update-host.ts
+++ b/scripts/update-host.ts
@@ -4,7 +4,7 @@ import { VideoModel } from '../server/models/video/video'
4import { ActorModel } from '../server/models/activitypub/actor' 4import { ActorModel } from '../server/models/activitypub/actor'
5import { 5import {
6 getAccountActivityPubUrl, 6 getAccountActivityPubUrl,
7 getAnnounceActivityPubUrl, 7 getVideoAnnounceActivityPubUrl,
8 getVideoActivityPubUrl, getVideoChannelActivityPubUrl, 8 getVideoActivityPubUrl, getVideoChannelActivityPubUrl,
9 getVideoCommentActivityPubUrl 9 getVideoCommentActivityPubUrl
10} from '../server/lib/activitypub' 10} from '../server/lib/activitypub'
@@ -13,6 +13,7 @@ import { VideoCommentModel } from '../server/models/video/video-comment'
13import { getServerActor } from '../server/helpers/utils' 13import { getServerActor } from '../server/helpers/utils'
14import { AccountModel } from '../server/models/account/account' 14import { AccountModel } from '../server/models/account/account'
15import { VideoChannelModel } from '../server/models/video/video-channel' 15import { VideoChannelModel } from '../server/models/video/video-channel'
16import { VideoStreamingPlaylistModel } from '../server/models/video/video-streaming-playlist'
16 17
17run() 18run()
18 .then(() => process.exit(0)) 19 .then(() => process.exit(0))
@@ -78,7 +79,7 @@ async function run () {
78 79
79 console.log('Updating video share ' + videoShare.url) 80 console.log('Updating video share ' + videoShare.url)
80 81
81 videoShare.url = getAnnounceActivityPubUrl(videoShare.Video.url, videoShare.Actor) 82 videoShare.url = getVideoAnnounceActivityPubUrl(videoShare.Actor, videoShare.Video)
82 await videoShare.save() 83 await videoShare.save()
83 } 84 }
84 85
@@ -109,11 +110,9 @@ async function run () {
109 110
110 console.log('Updating video and torrent files.') 111 console.log('Updating video and torrent files.')
111 112
112 const videos = await VideoModel.list() 113 const videos = await VideoModel.listLocal()
113 for (const video of videos) { 114 for (const video of videos) {
114 if (video.isOwned() === false) continue 115 console.log('Updating video ' + video.uuid)
115
116 console.log('Updated video ' + video.uuid)
117 116
118 video.url = getVideoActivityPubUrl(video) 117 video.url = getVideoActivityPubUrl(video)
119 await video.save() 118 await video.save()
@@ -122,5 +121,12 @@ async function run () {
122 console.log('Updating torrent file %s of video %s.', file.resolution, video.uuid) 121 console.log('Updating torrent file %s of video %s.', file.resolution, video.uuid)
123 await video.createTorrentAndSetInfoHash(file) 122 await video.createTorrentAndSetInfoHash(file)
124 } 123 }
124
125 for (const playlist of video.VideoStreamingPlaylists) {
126 playlist.playlistUrl = CONFIG.WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsMasterPlaylistStaticPath(video.uuid)
127 playlist.segmentsSha256Url = CONFIG.WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsSha256SegmentsStaticPath(video.uuid)
128
129 await playlist.save()
130 }
125 } 131 }
126} 132}