1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 09:49:20 +02:00

Compare commits

...

3 commits

Author SHA1 Message Date
Chocobozzz
91afa1004e
Fill video support on channel sync 2025-09-03 08:46:38 +02:00
Chocobozzz
0882d96624
Do not override privacy for imports and live 2025-09-03 07:13:12 +02:00
Chocobozzz
3ea32ba891
Remove useless help for live transcoding 2025-09-01 09:30:05 +02:00
10 changed files with 44 additions and 27 deletions

View file

@ -107,7 +107,7 @@ export class AdminConfigLiveComponent implements OnInit, OnDestroy, CanComponent
{ id: 1000 * 3600 * 10, label: $localize`10 hours` }
]
this.liveResolutions = this.adminConfigService.transcodingResolutionOptions
this.liveResolutions = this.adminConfigService.getTranscodingOptions('live')
this.transcodingProfiles = this.adminConfigService.buildTranscodingProfiles(
this.server.getHTMLConfig().live.transcoding.availableProfiles
)
@ -143,7 +143,7 @@ export class AdminConfigLiveComponent implements OnInit, OnDestroy, CanComponent
enabled: null,
threads: TRANSCODING_THREADS_VALIDATOR,
profile: null,
resolutions: this.adminConfigService.buildFormResolutions(),
resolutions: this.adminConfigService.buildFormResolutions('live'),
alwaysTranscodeOriginalResolution: null,
remoteRunners: {
enabled: null

View file

@ -112,7 +112,7 @@ export class AdminConfigVODComponent implements OnInit, OnDestroy, CanComponentD
this.customConfig = this.route.parent.snapshot.data['customConfig']
this.transcodingThreadOptions = this.configService.transcodingThreadOptions
this.resolutions = this.adminConfigService.transcodingResolutionOptions
this.resolutions = this.adminConfigService.getTranscodingOptions('vod')
this.additionalVideoExtensions = serverConfig.video.file.extensions.join(' ')
this.transcodingProfiles = this.adminConfigService.buildTranscodingProfiles(serverConfig.transcoding.availableProfiles)
@ -156,7 +156,7 @@ export class AdminConfigVODComponent implements OnInit, OnDestroy, CanComponentD
max: TRANSCODING_MAX_FPS_VALIDATOR
},
resolutions: this.adminConfigService.buildFormResolutions(),
resolutions: this.adminConfigService.buildFormResolutions('vod'),
alwaysTranscodeOriginalResolution: null,
remoteRunners: {

View file

@ -132,7 +132,7 @@ export class VideoImportTorrentComponent implements OnInit, AfterViewInit, CanCo
.pipe(switchMap(({ video }) => this.videoService.getVideo({ videoId: video.uuid })))
.subscribe({
next: async video => {
await videoEdit.loadFromAPI({ video })
await videoEdit.loadFromAPI({ video, loadPrivacy: false })
this.loadingBar.useRef().complete()

View file

@ -130,7 +130,7 @@ export class VideoImportUrlComponent implements OnInit, AfterViewInit, CanCompon
)
.subscribe({
next: async ({ video, captions, chapters }) => {
await videoEdit.loadFromAPI({ video, captions, chapters })
await videoEdit.loadFromAPI({ video, captions, chapters, loadPrivacy: false })
this.loadingBar.useRef().complete()

View file

@ -105,7 +105,7 @@ export class VideoGoLiveComponent implements OnInit, AfterViewInit, CanComponent
.subscribe({
next: async ({ video: { id, uuid, shortUUID }, live }) => {
videoEdit.loadAfterPublish({ video: { id, uuid, shortUUID } })
await videoEdit.loadFromAPI({ live })
await videoEdit.loadFromAPI({ live, loadPrivacy: false })
debugLogger(`Live published`)

View file

@ -293,12 +293,12 @@ export class VideoEdit {
return videoEdit
}
async loadFromAPI (options: UpdateFromAPIOptions) {
const { video, videoPasswords, live, chapters, captions, videoSource } = options
async loadFromAPI (options: UpdateFromAPIOptions & { loadPrivacy?: boolean }) {
const { video, videoPasswords, live, chapters, captions, videoSource, loadPrivacy = true } = options
debugLogger('Load from API', options)
this.loadVideo({ video, videoPasswords, saveInStore: true })
this.loadVideo({ video, videoPasswords, saveInStore: true, loadPrivacy })
this.loadLive(live)
if (captions !== undefined) {
@ -322,18 +322,21 @@ export class VideoEdit {
private loadVideo (options: {
video: UpdateFromAPIOptions['video']
videoPasswords?: string[]
loadPrivacy?: boolean // default true
saveInStore: boolean
}) {
const { video, saveInStore, videoPasswords = [] } = options
const { video, saveInStore, loadPrivacy = true, videoPasswords = [] } = options
if (video === undefined) return
const buildObj: () => CommonUpdate = () => {
return {
const buildObj: (options: { loadPrivacy: boolean }) => CommonUpdate = () => {
const { loadPrivacy } = options
const base = {
...this.common,
name: video.name || '',
privacy: video.privacy?.id ?? null,
channelId: video.channel?.id ?? null,
category: video.category?.id ?? null,
licence: video.licence?.id ?? null,
@ -361,12 +364,18 @@ export class VideoEdit {
videoPasswords: videoPasswords ?? []
}
if (loadPrivacy) {
return { ...base, privacy: video.privacy?.id ?? null }
}
this.common = buildObj()
return base
}
this.common = buildObj({ loadPrivacy })
if (saveInStore) {
const obj = buildObj()
const obj = buildObj({ loadPrivacy: true })
this.saveStore.common = omit(obj, [ 'pluginData', 'previewfile' ])
// Apply plugin defaults so we correctly detect changes

View file

@ -35,7 +35,6 @@ export class AdminConfigService {
private static BASE_APPLICATION_URL = environment.apiUrl + '/api/v1/config'
transcodingThreadOptions: SelectOptionsItem[] = []
transcodingResolutionOptions: ResolutionOption[] = []
constructor () {
this.transcodingThreadOptions = [
@ -48,13 +47,18 @@ export class AdminConfigService {
{ id: 16, label: '16' },
{ id: 32, label: '32' }
]
}
this.transcodingResolutionOptions = [
// ---------------------------------------------------------------------------
getTranscodingOptions (type: 'live' | 'vod'): ResolutionOption[] {
return [
{
id: '0p',
label: $localize`Audio-only`,
description:
$localize`"Split audio and video" must be enabled for the PeerTube player to propose an "Audio only" resolution to users`
description: type === 'vod'
? $localize`"Split audio and video" must be enabled for the PeerTube player to propose an "Audio only" resolution to users`
: undefined
},
{
id: '144p',
@ -141,10 +145,10 @@ export class AdminConfigService {
// ---------------------------------------------------------------------------
buildFormResolutions () {
buildFormResolutions (type: 'live' | 'vod') {
const formResolutions = {} as Record<keyof FormResolutions, BuildFormValidator>
for (const resolution of this.transcodingResolutionOptions) {
for (const resolution of this.getTranscodingOptions(type)) {
formResolutions[resolution.id] = null
}

View file

@ -95,9 +95,6 @@ export class VideoFilters {
if (noChanges) return
console.log(currentFormObjectString)
console.log(this.oldFormObjectString)
this.oldFormObjectString = currentFormObjectString
for (const cb of this.onChangeCallbacks) {

View file

@ -285,7 +285,8 @@ describe('Test channel synchronizations', function () {
const { id: channelId } = await servers[0].channels.create({
attributes: {
name: 'channel2'
name: 'channel2',
support: 'my support test'
}
})
@ -306,6 +307,11 @@ describe('Test channel synchronizations', function () {
expect(data[1].name).to.equal('small video - youtube')
videoToDelete = data[1].id
for (const { uuid } of data) {
const video = await servers[0].videos.get({ id: uuid })
expect(video.support).to.equal('my support test')
}
}
})

View file

@ -66,7 +66,8 @@ export async function synchronizeChannel (options: {
targetUrl,
channelSync,
importDataOverride: {
privacy: VideoPrivacy.PUBLIC
privacy: VideoPrivacy.PUBLIC,
support: channel.support
}
})