aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-12-30 15:28:49 +0100
committerChocobozzz <me@florianbigard.com>2022-12-30 15:28:49 +0100
commit9972ace3a3bc65865fb3aaaa865a400386e49252 (patch)
tree7bd9a0b40311145c942b0cbf2fbcf58a58f9eca5
parent75ec2580484d2fa2d6d21a062ddb33ffea9ab046 (diff)
parentfbe088b816c6e33e013006285e18bc2938173507 (diff)
downloadPeerTube-9972ace3a3bc65865fb3aaaa865a400386e49252.tar.gz
PeerTube-9972ace3a3bc65865fb3aaaa865a400386e49252.tar.zst
PeerTube-9972ace3a3bc65865fb3aaaa865a400386e49252.zip
Merge branch 'release/5.0.0' into develop
-rw-r--r--client/src/sass/primeng-custom.scss7
-rw-r--r--server/lib/live/live-manager.ts4
-rw-r--r--server/lib/live/shared/muxing-session.ts2
-rw-r--r--server/tests/shared/live.ts8
-rw-r--r--server/tests/shared/streaming-playlists.ts4
-rw-r--r--shared/server-commands/miscs/sql-command.ts13
6 files changed, 35 insertions, 3 deletions
diff --git a/client/src/sass/primeng-custom.scss b/client/src/sass/primeng-custom.scss
index fb1d3f7bd..88f6efb6a 100644
--- a/client/src/sass/primeng-custom.scss
+++ b/client/src/sass/primeng-custom.scss
@@ -455,7 +455,7 @@ p-table {
455 background-color: pvar(--mainBackgroundColor) !important; 455 background-color: pvar(--mainBackgroundColor) !important;
456 456
457 .caption { 457 .caption {
458 height: 40px; 458 min-height: 40px;
459 width: 100%; 459 width: 100%;
460 display: inline-flex; 460 display: inline-flex;
461 align-items: center; 461 align-items: center;
@@ -634,6 +634,11 @@ p-table {
634 right: 0; 634 right: 0;
635 color: pvar(--inputPlaceholderColor); 635 color: pvar(--inputPlaceholderColor);
636 overflow: visible; 636 overflow: visible;
637
638 @media screen and (max-width: $small-view) {
639 left: 0;
640 top: 40px;
641 }
637 } 642 }
638 643
639 .p-paginator-first, 644 .p-paginator-first,
diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts
index 5e459f3c3..9ea983119 100644
--- a/server/lib/live/live-manager.ts
+++ b/server/lib/live/live-manager.ts
@@ -483,12 +483,12 @@ class LiveManager {
483 playlist.p2pMediaLoaderPeerVersion = P2P_MEDIA_LOADER_PEER_VERSION 483 playlist.p2pMediaLoaderPeerVersion = P2P_MEDIA_LOADER_PEER_VERSION
484 playlist.type = VideoStreamingPlaylistType.HLS 484 playlist.type = VideoStreamingPlaylistType.HLS
485 485
486 playlist.assignP2PMediaLoaderInfoHashes(video, allResolutions)
487
488 playlist.storage = CONFIG.OBJECT_STORAGE.ENABLED 486 playlist.storage = CONFIG.OBJECT_STORAGE.ENABLED
489 ? VideoStorage.OBJECT_STORAGE 487 ? VideoStorage.OBJECT_STORAGE
490 : VideoStorage.FILE_SYSTEM 488 : VideoStorage.FILE_SYSTEM
491 489
490 playlist.assignP2PMediaLoaderInfoHashes(video, allResolutions)
491
492 return playlist.save() 492 return playlist.save()
493 } 493 }
494 494
diff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.ts
index 6ec126955..25ecf1c64 100644
--- a/server/lib/live/shared/muxing-session.ts
+++ b/server/lib/live/shared/muxing-session.ts
@@ -262,6 +262,8 @@ class MuxingSession extends EventEmitter {
262 const url = await storeHLSFileFromFilename(this.streamingPlaylist, this.streamingPlaylist.playlistFilename) 262 const url = await storeHLSFileFromFilename(this.streamingPlaylist, this.streamingPlaylist.playlistFilename)
263 263
264 this.streamingPlaylist.playlistUrl = url 264 this.streamingPlaylist.playlistUrl = url
265 this.streamingPlaylist.assignP2PMediaLoaderInfoHashes(this.videoLive.Video, this.allResolutions)
266
265 await this.streamingPlaylist.save() 267 await this.streamingPlaylist.save()
266 } catch (err) { 268 } catch (err) {
267 logger.error('Cannot upload live master file to object storage.', { err, ...this.lTags() }) 269 logger.error('Cannot upload live master file to object storage.', { err, ...this.lTags() })
diff --git a/server/tests/shared/live.ts b/server/tests/shared/live.ts
index 47e0dc481..1c868eb5b 100644
--- a/server/tests/shared/live.ts
+++ b/server/tests/shared/live.ts
@@ -6,6 +6,7 @@ import { join } from 'path'
6import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models' 6import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models'
7import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands' 7import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands'
8import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists' 8import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists'
9import { sha1 } from '@shared/extra-utils'
9 10
10async function checkLiveCleanup (options: { 11async function checkLiveCleanup (options: {
11 server: PeerTubeServer 12 server: PeerTubeServer
@@ -101,6 +102,13 @@ async function testVideoResolutions (options: {
101 segmentName, 102 segmentName,
102 hlsPlaylist 103 hlsPlaylist
103 }) 104 })
105
106 if (originServer.internalServerNumber === server.internalServerNumber) {
107 const infohash = sha1(`${2 + hlsPlaylist.playlistUrl}+V${i}`)
108 const dbInfohashes = await originServer.sql.getPlaylistInfohash(hlsPlaylist.id)
109
110 expect(dbInfohashes).to.include(infohash)
111 }
104 } 112 }
105 } 113 }
106} 114}
diff --git a/server/tests/shared/streaming-playlists.ts b/server/tests/shared/streaming-playlists.ts
index 5c62af812..75e135c4e 100644
--- a/server/tests/shared/streaming-playlists.ts
+++ b/server/tests/shared/streaming-playlists.ts
@@ -40,6 +40,8 @@ async function checkSegmentHash (options: {
40 expect(sha256(segmentBody)).to.equal(shaBody[videoName][range]) 40 expect(sha256(segmentBody)).to.equal(shaBody[videoName][range])
41} 41}
42 42
43// ---------------------------------------------------------------------------
44
43async function checkLiveSegmentHash (options: { 45async function checkLiveSegmentHash (options: {
44 server: PeerTubeServer 46 server: PeerTubeServer
45 baseUrlSegment: string 47 baseUrlSegment: string
@@ -56,6 +58,8 @@ async function checkLiveSegmentHash (options: {
56 expect(sha256(segmentBody)).to.equal(shaBody[segmentName]) 58 expect(sha256(segmentBody)).to.equal(shaBody[segmentName])
57} 59}
58 60
61// ---------------------------------------------------------------------------
62
59async function checkResolutionsInMasterPlaylist (options: { 63async function checkResolutionsInMasterPlaylist (options: {
60 server: PeerTubeServer 64 server: PeerTubeServer
61 playlistUrl: string 65 playlistUrl: string
diff --git a/shared/server-commands/miscs/sql-command.ts b/shared/server-commands/miscs/sql-command.ts
index dbc441aba..823fc9e38 100644
--- a/shared/server-commands/miscs/sql-command.ts
+++ b/shared/server-commands/miscs/sql-command.ts
@@ -86,6 +86,8 @@ export class SQLCommand extends AbstractCommand {
86 return seq.query(query, options) 86 return seq.query(query, options)
87 } 87 }
88 88
89 // ---------------------------------------------------------------------------
90
89 setPluginField (pluginName: string, field: string, value: string) { 91 setPluginField (pluginName: string, field: string, value: string) {
90 const seq = this.getSequelize() 92 const seq = this.getSequelize()
91 93
@@ -102,6 +104,17 @@ export class SQLCommand extends AbstractCommand {
102 return this.setPluginField(pluginName, 'latestVersion', newVersion) 104 return this.setPluginField(pluginName, 'latestVersion', newVersion)
103 } 105 }
104 106
107 // ---------------------------------------------------------------------------
108
109 async getPlaylistInfohash (playlistId: number) {
110 const result = await this.selectQuery('SELECT "p2pMediaLoaderInfohashes" FROM "videoStreamingPlaylist" WHERE id = ' + playlistId)
111 if (!result || result.length === 0) return []
112
113 return result[0].p2pMediaLoaderInfohashes
114 }
115
116 // ---------------------------------------------------------------------------
117
105 setActorFollowScores (newScore: number) { 118 setActorFollowScores (newScore: number) {
106 const seq = this.getSequelize() 119 const seq = this.getSequelize()
107 120