ActivityPub-federated video streaming platform using P2P directly in your web browser
Signal fixes
Chocobozzzb02df71bb94c
diff --git a/client/src/app/+admin/admin-moderation.component.ts b/client/src/app/+admin/admin-moderation.component.tsindex 1e0e66c77a..cb1aa0fce7 100644--- a/client/src/app/+admin/admin-moderation.component.ts+++ b/client/src/app/+admin/admin-moderation.component.ts@@ -5,6 +5,7 @@ import { HorizontalMenuComponent, HorizontalMenuEntry } from '@app/shared/sharedimport { UserRight, UserRightType } from '@peertube/peertube-models'@Component({+ selector: 'my-admin-moderation',templateUrl: './admin-moderation.component.html',imports: [ HorizontalMenuComponent, RouterOutlet ]})diff --git a/client/src/app/+admin/admin-overview.component.ts b/client/src/app/+admin/admin-overview.component.tsindex 2b73f8f3d9..7932ac5a38 100644--- a/client/src/app/+admin/admin-overview.component.ts+++ b/client/src/app/+admin/admin-overview.component.ts@@ -5,6 +5,7 @@ import { HorizontalMenuComponent, HorizontalMenuEntry } from '@app/shared/sharedimport { UserRight, UserRightType } from '@peertube/peertube-models'@Component({+ selector: 'my-admin-overview',templateUrl: './admin-overview.component.html',imports: [ HorizontalMenuComponent, RouterOutlet ]})diff --git a/client/src/app/+admin/admin-settings.component.ts b/client/src/app/+admin/admin-settings.component.tsindex 955b9ff125..5f0ec2e12a 100644--- a/client/src/app/+admin/admin-settings.component.ts+++ b/client/src/app/+admin/admin-settings.component.ts@@ -5,6 +5,7 @@ import { HorizontalMenuComponent, HorizontalMenuEntry } from '@app/shared/sharedimport { PluginType, UserRight, UserRightType } from '@peertube/peertube-models'@Component({+ selector: 'my-admin-settings',templateUrl: './admin-settings.component.html',imports: [ HorizontalMenuComponent, RouterOutlet ]})diff --git a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.tsindex 39af376581..2bc45d8851 100644--- a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts+++ b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts@@ -1,8 +1,8 @@-import { Component, inject, input } from '@angular/core'-import { Notifier } from '@app/core'+import { Component, inject, input, model } from '@angular/core'import { FormsModule } from '@angular/forms'-import { PeertubeCheckboxComponent } from '../../../shared/shared-forms/peertube-checkbox.component'+import { Notifier } from '@app/core'import { RedundancyService } from '@app/shared/shared-main/video/redundancy.service'+import { PeertubeCheckboxComponent } from '../../../shared/shared-forms/peertube-checkbox.component'@Component({selector: 'my-redundancy-checkbox',@@ -13,8 +13,8 @@ export class RedundancyCheckboxComponent {private notifier = inject(Notifier)private redundancyService = inject(RedundancyService)- readonly redundancyAllowed = input<boolean>(undefined)readonly host = input<string>(undefined)+ readonly redundancyAllowed = model<boolean>(undefined)updateRedundancyState () {this.redundancyService.updateRedundancy(this.host(), this.redundancyAllowed())diff --git a/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.tsindex 33fd7a40e8..c2d03e3770 100644--- a/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts+++ b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts@@ -1,4 +1,4 @@-import { Component, OnInit, inject, input } from '@angular/core'+import { Component, OnInit, inject, model } from '@angular/core'import { FormsModule, ReactiveFormsModule } from '@angular/forms'import { Notifier, UserService } from '@app/core'import { FormReactive } from '@app/shared/shared-forms/form-reactive'@@ -17,7 +17,7 @@ export class MyAccountEmailPreferencesComponent extends FormReactive implementsprivate userService = inject(UserService)private notifier = inject(Notifier)- readonly user = input<User>(undefined)+ readonly user = model<User>(undefined)ngOnInit () {this.buildForm({@@ -38,7 +38,7 @@ export class MyAccountEmailPreferencesComponent extends FormReactive implementsif (details.emailPublic) this.notifier.success($localize`Email is now public`)else this.notifier.success($localize`Email is now private`)- this.user().emailPublic = details.emailPublic+ this.user.update(u => ({ ...u, emailPublic: details.emailPublic }))},error: err => this.notifier.error(err.message)diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.tsindex f9622ff66e..c71f0545c2 100644--- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts+++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts@@ -1,5 +1,5 @@import { NgFor, NgIf } from '@angular/common'-import { Component, OnInit, inject, input } from '@angular/core'+import { Component, OnInit, inject, model } from '@angular/core'import { FormsModule } from '@angular/forms'import { Notifier, ServerService, User } from '@app/core'import { UserNotificationService } from '@app/shared/shared-main/users/user-notification.service'@@ -19,7 +19,7 @@ export class MyAccountNotificationPreferencesComponent implements OnInit {private serverService = inject(ServerService)private notifier = inject(Notifier)- readonly user = input<User>(undefined)+ readonly user = model<User>(undefined)notificationSettingGroups: { label: string, keys: (keyof UserNotificationSetting)[] }[] = []emailNotifications: { [id in keyof UserNotificationSetting]?: boolean } = {}@@ -134,15 +134,27 @@ export class MyAccountNotificationPreferencesComponent implements OnInit {}updateEmailSetting (field: keyof UserNotificationSetting, value: boolean) {- if (value === true) this.user().notificationSettings[field] |= UserNotificationSettingValue.EMAIL- else this.user().notificationSettings[field] &= ~UserNotificationSettingValue.EMAIL+ this.user.update(u => {+ // FIXME: use immutable user object+ u.notificationSettings[field] = value === true+ ? u.notificationSettings[field] | UserNotificationSettingValue.EMAIL+ : u.notificationSettings[field] & ~UserNotificationSettingValue.EMAIL++ return u+ })this.savePreferences()}updateWebSetting (field: keyof UserNotificationSetting, value: boolean) {- if (value === true) this.user().notificationSettings[field] |= UserNotificationSettingValue.WEB- else this.user().notificationSettings[field] &= ~UserNotificationSettingValue.WEB+ this.user.update(u => {+ // FIXME: use immutable user object+ u.notificationSettings[field] = value === true+ ? u.notificationSettings[field] | UserNotificationSettingValue.WEB+ : u.notificationSettings[field] & ~UserNotificationSettingValue.WEB++ return u+ })this.savePreferences()}diff --git a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.tsindex 38ddd0bacd..7d36d15e44 100644--- a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts+++ b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts@@ -1,5 +1,5 @@import { NgClass, NgIf } from '@angular/common'-import { Component, OnInit, inject, input } from '@angular/core'+import { Component, OnInit, inject, model } from '@angular/core'import { FormsModule, ReactiveFormsModule } from '@angular/forms'import { Notifier, User, UserService } from '@app/core'import { USER_DESCRIPTION_VALIDATOR, USER_DISPLAY_NAME_REQUIRED_VALIDATOR } from '@app/shared/form-validators/user-validators'@@ -20,7 +20,7 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit {private notifier = inject(Notifier)private userService = inject(UserService)- readonly user = input<User>(null)+ readonly user = model<User>()error: string = null@@ -52,9 +52,13 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit {this.userService.updateMyProfile({ displayName, description }).subscribe({next: () => {- const user = this.user()- user.account.displayName = displayName- user.account.description = description+ this.user.update(u => {+ // FIXME: Use immutability+ u.account.displayName = displayName+ u.account.description = description++ return u+ })this.notifier.success($localize`Profile updated.`)},diff --git a/client/src/app/+my-account/my-account.component.ts b/client/src/app/+my-account/my-account.component.tsindex a05bd2aaaf..d5608cf9b0 100644--- a/client/src/app/+my-account/my-account.component.ts+++ b/client/src/app/+my-account/my-account.component.ts@@ -4,6 +4,7 @@ import { AuthUser, PluginService } from '@app/core'import { HorizontalMenuComponent, HorizontalMenuEntry } from '@app/shared/shared-main/menu/horizontal-menu.component'@Component({+ selector: 'my-account',templateUrl: './my-account.component.html',imports: [ HorizontalMenuComponent, RouterOutlet ]})diff --git a/client/src/app/+my-library/my-history/my-history.component.html b/client/src/app/+my-library/my-history/my-history.component.htmlindex 440224bccf..d9c2f6339e 100644--- a/client/src/app/+my-library/my-history/my-history.component.html+++ b/client/src/app/+my-library/my-history/my-history.component.html@@ -13,7 +13,7 @@<my-videos-selection[pagination]="pagination"- [(videosModel)]="videos"+ [(videos)]="videos"[miniatureDisplayOptions]="miniatureDisplayOptions"[titlePage]="titlePage"[getVideosObservableFunction]="getVideosObservableFunction"diff --git a/client/src/app/+my-library/my-videos/my-videos.component.html b/client/src/app/+my-library/my-videos/my-videos.component.htmlindex dc114950a2..c944a61404 100644--- a/client/src/app/+my-library/my-videos/my-videos.component.html+++ b/client/src/app/+my-library/my-videos/my-videos.component.html@@ -18,7 +18,7 @@[videosContainedInPlaylists]="videosContainedInPlaylists"[pagination]="pagination"[(selection)]="selection"- [(videosModel)]="videos"+ [(videos)]="videos"[miniatureDisplayOptions]="miniatureDisplayOptions"[titlePage]="titlePage"[getVideosObservableFunction]="getVideosObservableFunction"diff --git a/client/src/app/+videos/+video-edit/shared/caption/video-caption-add-modal.component.ts b/client/src/app/+videos/+video-edit/shared/caption/video-caption-add-modal.component.tsindex d116a2e4ef..3dd722a13f 100644--- a/client/src/app/+videos/+video-edit/shared/caption/video-caption-add-modal.component.ts+++ b/client/src/app/+videos/+video-edit/shared/caption/video-caption-add-modal.component.ts@@ -33,7 +33,6 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnInivideoCaptionLanguages: VideoConstant<string>[] = []private openedModal: NgbModalRef- private closingModal = falseget videoCaptionExtensions () {return this.serverConfig().videoCaption.file.extensions@@ -58,20 +57,15 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni}show () {- this.closingModal = false-this.openedModal = this.modalService.open(this.modal(), { centered: true, keyboard: false })}hide () {- this.closingModal = truethis.openedModal.close()this.form.reset()}isReplacingExistingCaption () {- if (this.closingModal === true) return false-const languageId = this.form.value['language']return languageId && this.existingCaptions().includes(languageId)diff --git a/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal-content.component.html b/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal-content.component.htmldeleted file mode 100644index c93ac7e2fe..0000000000--- a/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal-content.component.html+++ /dev/null@@ -1,132 +0,0 @@-<div class="modal-header">- <h4 i18n class="modal-title">Edit caption "{{ videoCaption().language.label }}"</h4>-- <button class="border-0 p-0" title="Close this modal" i18n-title (click)="hide()">- <my-global-icon iconName="cross"></my-global-icon>- </button>-</div>--<div class="modal-body">-- <div class="row">-- <my-embed *ngIf="publishedVideo()" #embed class="col-md-12 col-xl-6 mb-3" [video]="publishedVideo()" enableAPI="true"></my-embed>-- <div [ngClass]="publishedVideo() ? 'col-xl-6 col-md-12' : ''">-- <div class="d-flex justify-content-between align-items-center mb-3 ms-2">- <my-peertube-checkbox- inputName="raw-edition"- [(ngModel)]="rawEdit" (ngModelChange)="onRawEditSwitch()"- i18n-labelText labelText="Edit raw"- ></my-peertube-checkbox>-- <my-button *ngIf="!rawEdit && !segmentToUpdate" i18n-label label="Add a new segment" (click)="addSegmentToEdit()">- </my-button>- </div>-- <div [hidden]="!rawEdit" [formGroup]="form">- <textarea- id="captionFileContent"- formControlName="captionFileContent"- i18n-label aria-label="Caption raw content"- class="form-control caption-raw-textarea fs-7"- [ngClass]="{ 'input-error': formErrors['captionFileContent'] }"- #textarea- >- </textarea>-- <div *ngIf="formErrors.captionFileContent" class="form-error" role="alert">- {{ formErrors.captionFileContent }}- </div>- </div>-- <div class="text-start segments pe-2 ps-2" [hidden]="rawEdit">- @for (segment of segments; track segment.id) {- <div class="pt-1 pb-1 mb-3">- @if (segmentToUpdate === segment) {- <div role="form">- <div class="d-flex flex-wrap ">- <div>- <label class="visually-hidden" i18n for="segmentStart">Segment start timestamp</label>-- <my-timestamp-input- class="me-1"- inputName="segmentStart" enableBorder="true" [maxTimestamp]="publishedVideo().duration * 1000" mask="99:99:99.999"- [(ngModel)]="segment.startMs" [parser]="timestampParser" [formatter]="timestampFormatter"- ></my-timestamp-input>-- <my-button *ngIf="publishedVideo()" icon="clock-arrow-down" i18n-title title="Use video current time as start time" (click)="videoTimeForSegmentStart(segment)">- </my-button>- </div>-- <my-global-icon class="d-inline-block ms-2 me-2" iconName="move-right"></my-global-icon>-- <div>- <label class="visually-hidden" i18n for="segmentEnd">Segment end timestamp</label>-- <my-timestamp-input- class="me-1"- inputName="segmentEnd" enableBorder="true" [maxTimestamp]="publishedVideo().duration * 1000" mask="99:99:99.999"- [(ngModel)]="segment.endMs" [parser]="timestampParser" [formatter]="timestampFormatter"- ></my-timestamp-input>-- <my-button *ngIf="publishedVideo()" icon="clock-arrow-down" i18n-title title="Use video current time as end time" (click)="videoTimeForSegmentEnd(segment)">- </my-button>- </div>- </div>-- <div class="d-flex mt-2">- <div class="form-group w-100">- <label class="visually-hidden" i18n for="segment-edit">Segment end timestamp</label>-- <textarea id="segment-edit" name="segment-edit" class="form-control fs-7" [(ngModel)]="segment.text"></textarea>-- <div *ngIf="segmentEditError" class="form-error" role="alert">{{ segmentEditError }}</div>- </div>-- <div class="d-flex flex-column ms-3">- <my-button i18n-title title="Save" icon="tick" (click)="onEditSaved(segment)"></my-button>- <my-button class="mt-3" i18n-title title="Revert" icon="undo" (click)="onEditCanceled(segment)"></my-button>- </div>- </div>- </div>- } @else {- <div class="d-flex">- <div- class="flex-grow-1 segment-text ps-1 pe-1" role="button" tabindex="0" i18n-title title="Jump to this segment"- (keyup.enter)="onSegmentClick($event, segment)" (click)="onSegmentClick($event, segment)"- [ngClass]="{ active: segment === activeSegment }"- >- <strong class="segment-start me-2 d-block">{{ segment.startFormatted }} -> {{ segment.endFormatted }}</strong>- <span class="segment-text fs-7">{{ segment.text }}</span>- </div>-- <div class="d-flex flex-column ms-3" [ngClass]="{ 'opacity-0': !!segmentToUpdate }">- @defer (on viewport) {- <my-edit-button i18n-title title="Edit this segment" (click)="updateSegment(segment)"></my-edit-button>- <my-delete-button class="mt-1" i18n-title title="Delete this segment" (click)="deleteSegment(segment)"></my-delete-button>- } @placeholder {- <div style="height: 100%; width: 40px"></div>- }- </div>- </div>- }- </div>- }- </div>- </div>- </div>-</div>--<div class="modal-footer inputs">- <input- type="button" role="button" i18n-value value="Cancel" class="peertube-button secondary-button"- (click)="hide()" (key.enter)="hide()"- >-- <input- type="button" i18n-value value="Edit this caption" class="peertube-button primary-button"- [disabled]="rawEdit && !form.valid" (click)="updateCaption()"- >-</div>diff --git a/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal.component.html b/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal.component.htmlnew file mode 100644index 0000000000..85d09b743f--- /dev/null+++ b/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal.component.html@@ -0,0 +1,134 @@+<ng-template #modal>+ <div class="modal-header">+ <h4 i18n class="modal-title">Edit caption "{{ videoCaption.language.label }}"</h4>++ <button class="border-0 p-0" title="Close this modal" i18n-title (click)="hide()">+ <my-global-icon iconName="cross"></my-global-icon>+ </button>+ </div>++ <div class="modal-body">++ <div class="row">++ <my-embed *ngIf="publishedVideo" #embed class="col-md-12 col-xl-6 mb-3" [video]="publishedVideo" enableAPI="true"></my-embed>++ <div [ngClass]="publishedVideo ? 'col-xl-6 col-md-12' : ''">++ <div class="d-flex justify-content-between align-items-center mb-3 ms-2">+ <my-peertube-checkbox+ inputName="raw-edition"+ [(ngModel)]="rawEdit" (ngModelChange)="onRawEditSwitch()"+ i18n-labelText labelText="Edit raw"+ ></my-peertube-checkbox>++ <my-button *ngIf="!rawEdit && !segmentToUpdate" i18n-label label="Add a new segment" (click)="addSegmentToEdit()">+ </my-button>+ </div>++ <div [hidden]="!rawEdit" [formGroup]="form">+ <textarea+ id="captionFileContent"+ formControlName="captionFileContent"+ i18n-label aria-label="Caption raw content"+ class="form-control caption-raw-textarea fs-7"+ [ngClass]="{ 'input-error': formErrors['captionFileContent'] }"+ #textarea+ >+ </textarea>++ <div *ngIf="formErrors.captionFileContent" class="form-error" role="alert">+ {{ formErrors.captionFileContent }}+ </div>+ </div>++ <div class="text-start segments pe-2 ps-2" [hidden]="rawEdit">+ @for (segment of segments; track segment.id) {+ <div class="pt-1 pb-1 mb-3">+ @if (segmentToUpdate === segment) {+ <div role="form">+ <div class="d-flex flex-wrap align-items-center">+ <div>+ <label class="visually-hidden" i18n for="segmentStart">Segment start timestamp</label>++ <my-timestamp-input+ class="me-1"+ inputName="segmentStart" enableBorder="true" [maxTimestamp]="publishedVideo.duration * 1000" mask="99:99:99.999"+ [(ngModel)]="segment.startMs" [parser]="timestampParser" [formatter]="timestampFormatter"+ ></my-timestamp-input>++ <my-button *ngIf="publishedVideo" icon="clock-arrow-down" i18n-title title="Use video current time as start time" (click)="videoTimeForSegmentStart(segment)">+ </my-button>+ </div>++ <my-global-icon class="d-inline-block ms-2 me-2" iconName="move-right"></my-global-icon>++ <div>+ <label class="visually-hidden" i18n for="segmentEnd">Segment end timestamp</label>++ <my-timestamp-input+ class="me-1"+ inputName="segmentEnd" enableBorder="true" [maxTimestamp]="publishedVideo.duration * 1000" mask="99:99:99.999"+ [(ngModel)]="segment.endMs" [parser]="timestampParser" [formatter]="timestampFormatter"+ ></my-timestamp-input>++ <my-button *ngIf="publishedVideo" icon="clock-arrow-down" i18n-title title="Use video current time as end time" (click)="videoTimeForSegmentEnd(segment)">+ </my-button>+ </div>+ </div>++ <div class="d-flex mt-2">+ <div class="form-group w-100">+ <label class="visually-hidden" i18n for="segment-edit">Segment end timestamp</label>++ <textarea id="segment-edit" name="segment-edit" class="form-control fs-7" [(ngModel)]="segment.text"></textarea>++ <div *ngIf="segmentEditError" class="form-error" role="alert">{{ segmentEditError }}</div>+ </div>++ <div class="d-flex flex-column ms-3">+ <my-button i18n-title title="Save" icon="tick" (click)="onEditSaved(segment)"></my-button>+ <my-button class="mt-3" i18n-title title="Revert" icon="undo" (click)="onEditCanceled(segment)"></my-button>+ </div>+ </div>+ </div>+ } @else {+ <div class="d-flex">+ <div+ class="flex-grow-1 segment-text ps-1 pe-1" role="button" tabindex="0" i18n-title title="Jump to this segment"+ (keyup.enter)="onSegmentClick($event, segment)" (click)="onSegmentClick($event, segment)"+ [ngClass]="{ active: segment === activeSegment }"+ >+ <strong class="segment-start me-2 d-block">{{ segment.startFormatted }} -> {{ segment.endFormatted }}</strong>+ <span class="segment-text fs-7">{{ segment.text }}</span>+ </div>++ <div class="d-flex flex-column ms-3" [ngClass]="{ 'opacity-0': !!segmentToUpdate }">+ @defer (on viewport) {+ <my-edit-button i18n-title title="Edit this segment" (click)="updateSegment(segment)"></my-edit-button>+ <my-delete-button class="mt-1" i18n-title title="Delete this segment" (click)="deleteSegment(segment)"></my-delete-button>+ } @placeholder {+ <div style="height: 100%; width: 40px"></div>+ }+ </div>+ </div>+ }+ </div>+ }+ </div>+ </div>+ </div>+ </div>++ <div class="modal-footer inputs">+ <input+ type="button" role="button" i18n-value value="Cancel" class="peertube-button secondary-button"+ (click)="hide()" (key.enter)="hide()"+ >++ <input+ type="button" i18n-value value="Edit this caption" class="peertube-button primary-button"+ [disabled]="rawEdit && !form.valid" (click)="updateCaption()"+ >+ </div>+</ng-template>diff --git a/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal-content.component.scss b/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal.component.scsssimilarity index 93%rename from client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal-content.component.scssrename to client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal.component.scssindex 31d4e8c602..285ed76d13 100644--- a/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal-content.component.scss+++ b/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal.component.scss@@ -25,4 +25,5 @@my-timestamp-input {width: 130px;display: inline-block;+ vertical-align: bottom;}diff --git a/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal-content.component.ts b/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal.component.tssimilarity index 80%rename from client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal-content.component.tsrename to client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal.component.tsindex f611457242..bca5411d6f 100644--- a/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal-content.component.ts+++ b/client/src/app/+videos/+video-edit/shared/caption/video-caption-edit-modal.component.ts@@ -1,21 +1,20 @@import { NgClass, NgIf } from '@angular/common'-import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnInit, inject, input, output, viewChild } from '@angular/core'+import { ChangeDetectorRef, Component, ElementRef, OnInit, inject, viewChild } from '@angular/core'import { FormsModule, ReactiveFormsModule } from '@angular/forms'import { VIDEO_CAPTION_FILE_CONTENT_VALIDATOR } from '@app/shared/form-validators/video-captions-validators'import { FormReactive } from '@app/shared/shared-forms/form-reactive'import { FormReactiveService } from '@app/shared/shared-forms/form-reactive.service'import { PeertubeCheckboxComponent } from '@app/shared/shared-forms/peertube-checkbox.component'import { TimestampInputComponent } from '@app/shared/shared-forms/timestamp-input.component'-import { VideoCaptionEdit, VideoCaptionWithPathEdit } from '@app/shared/shared-main/video-caption/video-caption-edit.model'import { VideoCaptionService } from '@app/shared/shared-main/video-caption/video-caption.service'import { EmbedComponent } from '@app/shared/shared-main/video/embed.component'-import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'+import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'import { millisecondsToVttTime, sortBy, timeToInt } from '@peertube/peertube-core-utils'import { HTMLServerConfig, Video, VideoConstant } from '@peertube/peertube-models'import { parse } from '@plussub/srt-vtt-parser'import { PeerTubePlayer } from '../../../../../standalone/embed-player-api/player'-import { Notifier, ServerService } from '../../../../core'+import { ConfirmService, Notifier, ServerService } from '../../../../core'import { GlobalIconComponent } from '../../../../shared/shared-icons/global-icon.component'import { ButtonComponent } from '../../../../shared/shared-main/buttons/button.component'import { DeleteButtonComponent } from '../../../../shared/shared-main/buttons/delete-button.component'@@ -34,8 +33,9 @@ type Segment = {}@Component({- styleUrls: [ './video-caption-edit-modal-content.component.scss' ],- templateUrl: './video-caption-edit-modal-content.component.html',+ selector: 'my-video-caption-edit-modal',+ styleUrls: [ './video-caption-edit-modal.component.scss' ],+ templateUrl: './video-caption-edit-modal.component.html',imports: [FormsModule,ReactiveFormsModule,@@ -50,22 +50,20 @@ type Segment = {DeleteButtonComponent]})-export class VideoCaptionEditModalContentComponent extends FormReactive implements OnInit, AfterViewInit {- protected openedModal = inject(NgbActiveModal)+export class VideoCaptionEditModalComponent extends FormReactive implements OnInit {protected formReactiveService = inject(FormReactiveService)private videoCaptionService = inject(VideoCaptionService)private serverService = inject(ServerService)private notifier = inject(Notifier)private cd = inject(ChangeDetectorRef)-- readonly videoCaption = input<VideoCaptionWithPathEdit>(undefined)- readonly serverConfig = input<HTMLServerConfig>(undefined)- readonly publishedVideo = input<Video>(undefined)-- readonly captionEdited = output<VideoCaptionEdit>()+ private modalService = inject(NgbModal)+ private confirmService = inject(ConfirmService)readonly textarea = viewChild<ElementRef>('textarea')readonly embed = viewChild<EmbedComponent>('embed')+ readonly modal = viewChild<ElementRef>('modal')++ private openedModal: NgbModalRefrawEdit = falsesegments: Segment[] = []@@ -83,19 +81,59 @@ export class VideoCaptionEditModalContentComponent extends FormReactive implemenprivate player: PeerTubePlayer+ // Show options+ videoCaption: VideoCaptionWithPathEdit+ serverConfig: HTMLServerConfig+ publishedVideo: Video+ captionEdited: (caption: VideoCaptionEdit) => any+ngOnInit () {this.serverService.getVideoLanguages().subscribe(languages => {this.videoCaptionLanguages = languages})this.buildForm({ captionFileContent: VIDEO_CAPTION_FILE_CONTENT_VALIDATOR })+ }++ show (options: {+ videoCaption: VideoCaptionWithPathEdit+ serverConfig: HTMLServerConfig+ publishedVideo: Video+ captionEdited: (caption: VideoCaptionEdit) => any+ }) {+ this.videoCaption = options.videoCaption+ this.serverConfig = options.serverConfig+ this.publishedVideo = options.publishedVideo+ this.captionEdited = options.captionEdited++ this.openedModal = this.modalService.open(this.modal(), {+ centered: true,+ size: 'xl',++ beforeDismiss: () => {+ return this.confirmService.confirm(+ $localize`Are you sure you want to close this modal without saving your changes?`,+ $localize`Closing caption editing modal`+ )+ }+ })this.loadCaptionContent()- this.openedModal.update({})+ setTimeout(() => this.initEmbed())}- ngAfterViewInit () {+ hide () {+ this.videoCaption = undefined+ this.serverConfig = undefined+ this.publishedVideo = undefined+ this.captionEdited = undefined++ this.openedModal.close()+ this.form.reset()+ }++ initEmbed () {const embed = this.embed()if (embed) {this.player = new PeerTubePlayer(embed.getIframe())@@ -123,15 +161,14 @@ export class VideoCaptionEditModalContentComponent extends FormReactive implemenloadCaptionContent () {this.rawEdit = false- const videoCaption = this.videoCaption()- if (videoCaption.action === 'CREATE' || videoCaption.action === 'UPDATE') {- const file = videoCaption.captionfile as File+ if (this.videoCaption.action === 'CREATE' || this.videoCaption.action === 'UPDATE') {+ const file = this.videoCaption.captionfile as Filefile.text().then(content => this.loadSegments(content))return}- const { fileUrl } = videoCaption+ const { fileUrl } = this.videoCaptionif (!fileUrl) returnthis.videoCaptionService.getCaptionContent({ fileUrl })@@ -296,24 +333,20 @@ export class VideoCaptionEditModalContentComponent extends FormReactive implemenel.selectionEnd = 0}- hide () {- this.openedModal.dismiss()- }-updateCaption () {if (this.segmentToUpdate) {this.notifier.error($localize`A segment is being edited. Save or cancel your edits first.`)return}- const languageId = this.videoCaption().language.id+ const languageId = this.videoCaption.language.idconst languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)if (this.rawEdit) {this.loadSegments(this.form.value['captionFileContent'])}- this.captionEdited.emit({+ this.captionEdited({language: languageObject,captionfile: new File([ this.formatSegments() ], `${languageId}.vtt`, {type: 'text/vtt',diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.html b/client/src/app/+videos/+video-edit/shared/video-edit.component.htmlindex 55fc076f58..8365a44403 100644--- a/client/src/app/+videos/+video-edit/shared/video-edit.component.html+++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.html@@ -185,7 +185,6 @@<div i18n class="caption-entry-state green">Will be created on update</div>} @case ('UPDATE') {<div i18n class="caption-entry-state green">Will be edited on update</div>- Will be edited on update} @case ('REMOVE') {<div i18n class="caption-entry-state red">Will be deleted on update</div>}@@ -492,3 +491,5 @@<my-video-caption-add-modal#videoCaptionAddModal [existingCaptions]="getExistingCaptions()" [serverConfig]="serverConfig" (captionAdded)="onCaptionEdited($event)"></my-video-caption-add-modal>++<my-video-caption-edit-modal #videoCaptionEditModal></my-video-caption-edit-modal>diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.tsindex df2da10599..fd4e31e03c 100644--- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts+++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts@@ -2,7 +2,7 @@ import { NgClass, NgFor, NgIf, NgTemplateOutlet } from '@angular/common'import { ChangeDetectorRef, Component, NgZone, OnDestroy, OnInit, booleanAttribute, inject, input, output, viewChild } from '@angular/core'import { AbstractControl, FormArray, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'import { RouterLink } from '@angular/router'-import { ConfirmService, HooksService, PluginService, ServerService } from '@app/core'+import { HooksService, PluginService, ServerService } from '@app/core'import { removeElementFromArray } from '@app/helpers'import { BuildFormArgument, BuildFormValidator } from '@app/shared/form-validators/form-validator.model'import { VIDEO_CHAPTERS_ARRAY_VALIDATOR, VIDEO_CHAPTER_TITLE_VALIDATOR } from '@app/shared/form-validators/video-chapter-validators'@@ -29,7 +29,7 @@ import { VideoCaptionEdit, VideoCaptionWithPathEdit } from '@app/shared/shared-mimport { VideoChaptersEdit } from '@app/shared/shared-main/video/video-chapters-edit.model'import { VideoEdit } from '@app/shared/shared-main/video/video-edit.model'import { VideoService } from '@app/shared/shared-main/video/video.service'-import { NgbModal, NgbNav, NgbNavContent, NgbNavItem, NgbNavLink, NgbNavLinkBase, NgbNavOutlet } from '@ng-bootstrap/ng-bootstrap'+import { NgbNav, NgbNavContent, NgbNavItem, NgbNavLink, NgbNavLinkBase, NgbNavOutlet } from '@ng-bootstrap/ng-bootstrap'import {HTMLServerConfig,LiveVideo,@@ -67,7 +67,7 @@ import { PeerTubeTemplateDirective } from '../../../shared/shared-main/common/peimport { EmbedComponent } from '../../../shared/shared-main/video/embed.component'import { LiveDocumentationLinkComponent } from '../../../shared/shared-video-live/live-documentation-link.component'import { VideoCaptionAddModalComponent } from './caption/video-caption-add-modal.component'-import { VideoCaptionEditModalContentComponent } from './caption/video-caption-edit-modal-content.component'+import { VideoCaptionEditModalComponent } from './caption/video-caption-edit-modal.component'import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service'import { ThumbnailManagerComponent } from './thumbnail-manager/thumbnail-manager.component'import { VideoEditType } from './video-edit.type'@@ -116,7 +116,8 @@ type PluginField = {ThumbnailManagerComponent,EditButtonComponent,ButtonComponent,- AlertComponent+ AlertComponent,+ VideoCaptionEditModalComponent]})export class VideoEditComponent implements OnInit, OnDestroy {@@ -129,8 +130,6 @@ export class VideoEditComponent implements OnInit, OnDestroy {private ngZone = inject(NgZone)private hooks = inject(HooksService)private cd = inject(ChangeDetectorRef)- private modalService = inject(NgbModal)- private confirmService = inject(ConfirmService)readonly form = input<FormGroup>(undefined)readonly formErrors = input<@@ -161,6 +160,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {readonly liveVideo = input<LiveVideo>(undefined)readonly videoCaptionAddModal = viewChild<VideoCaptionAddModalComponent>('videoCaptionAddModal')+ readonly videoCaptionEditModal = viewChild<VideoCaptionEditModalComponent>('videoCaptionEditModal')readonly formBuilt = output()readonly pluginFieldsAdded = output()@@ -398,22 +398,12 @@ export class VideoEditComponent implements OnInit, OnDestroy {}openEditCaptionModal (videoCaption: VideoCaptionWithPathEdit) {- const modalRef = this.modalService.open(VideoCaptionEditModalContentComponent, {- centered: true,- size: 'xl',-- beforeDismiss: () => {- return this.confirmService.confirm(- $localize`Are you sure you want to close this modal without saving your changes?`,- $localize`Closing caption editing modal`- )- }+ this.videoCaptionEditModal().show({+ videoCaption,+ serverConfig: this.serverConfig,+ publishedVideo: this.publishedVideo(),+ captionEdited: caption => this.onCaptionEdited(caption)})-- modalRef.componentInstance.videoCaption = videoCaption- modalRef.componentInstance.serverConfig = this.serverConfig- modalRef.componentInstance.publishedVideo = this.publishedVideo()- modalRef.componentInstance.captionEdited.subscribe(this.onCaptionEdited.bind(this))}// ---------------------------------------------------------------------------@@ -526,6 +516,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {)this.form().addControl('pluginData', this.pluginDataFormGroup)+ // FIXME: use update function to signalthis.formErrors()['pluginData'] = pluginFormErrorsthis.validationMessages()['pluginData'] = pluginValidationMessagesdiff --git a/client/src/app/shared/shared-actor-image/actor-avatar.component.html b/client/src/app/shared/shared-actor-image/actor-avatar.component.htmlindex 39109c4960..7cddb9bd82 100644--- a/client/src/app/shared/shared-actor-image/actor-avatar.component.html+++ b/client/src/app/shared/shared-actor-image/actor-avatar.component.html@@ -8,11 +8,11 @@<div #avatarEl *ngIf="displayPlaceholder()" [ngClass]="classes"></div></ng-template>-<a *ngIf="actor() && href()" [href]="href()" target="_blank" rel="noopener noreferrer" [title]="title">+<a *ngIf="actor() && href()" [href]="href()" target="_blank" rel="noopener noreferrer" [title]="getTitle()"><ng-template *ngTemplateOutlet="img"></ng-template></a>-<a *ngIf="actor() && internalHref()" [routerLink]="internalHref()" [title]="title">+<a *ngIf="actor() && internalHref()" [routerLink]="internalHref()" [title]="getTitle()"><ng-template *ngTemplateOutlet="img"></ng-template></a>diff --git a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts b/client/src/app/shared/shared-actor-image/actor-avatar.component.tsindex 1e9895eb2e..b2633dc2cd 100644--- a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts+++ b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts@@ -35,15 +35,10 @@ export class ActorAvatarComponent implements OnInit, OnChanges {// Use routerLinkreadonly internalHref = input<string | any[]>(undefined)- private _title: string+ readonly title = input<string>()- @Input()- set title (value) {- this._title = value- }-- get title () {- if (this._title) return this._title+ getTitle () {+ if (this.title()) return this.title()if (this.isAccount()) return $localize`${this.actor().name} (account page)`if (this.isChannel()) return $localize`${this.actor().name} (channel page)`if (this.isInstance()) return $localize`${this.actor().name} (instance page)`diff --git a/client/src/app/shared/shared-forms/markdown-textarea.component.ts b/client/src/app/shared/shared-forms/markdown-textarea.component.tsindex 43c76df822..dfa4fac7bc 100644--- a/client/src/app/shared/shared-forms/markdown-textarea.component.ts+++ b/client/src/app/shared/shared-forms/markdown-textarea.component.ts@@ -166,9 +166,12 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit,const result = await customMarkdownRenderer(text)if (result instanceof HTMLElement) {- const wrapperElement = this.previewElement().nativeElement as HTMLElement- wrapperElement.innerHTML = ''- wrapperElement.appendChild(result)+ setTimeout(() => {+ const wrapperElement = this.previewElement().nativeElement as HTMLElement+ wrapperElement.innerHTML = ''+ wrapperElement.appendChild(result)+ })+return}diff --git a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.tsindex 8e97a1ed9c..6835e3b0f7 100644--- a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts+++ b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts@@ -1,13 +1,13 @@+import { NgIf } from '@angular/common'import { Component, OnChanges, OnInit, inject, input, output, viewChild } from '@angular/core'-import { AuthService, ConfirmService, HooksService, Notifier, PluginService, ServerService } from '@app/core'+import { AuthService, ConfirmService, HooksService, Notifier, ServerService } from '@app/core'import { BulkRemoveCommentsOfBody, User, UserRight } from '@peertube/peertube-models'+import { Account } from '../shared-main/account/account.model'+import { ActionDropdownComponent, DropdownAction } from '../shared-main/buttons/action-dropdown.component'+import { UserAdminService } from '../shared-users/user-admin.service'import { BlocklistService } from './blocklist.service'import { BulkService } from './bulk.service'import { UserBanModalComponent } from './user-ban-modal.component'-import { ActionDropdownComponent, DropdownAction } from '../shared-main/buttons/action-dropdown.component'-import { NgIf } from '@angular/common'-import { Account } from '../shared-main/account/account.model'-import { UserAdminService } from '../shared-users/user-admin.service'export type AccountMutedStatus = Pick<Account,@@ -34,7 +34,6 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {private blocklistService = inject(BlocklistService)private bulkService = inject(BulkService)private hooks = inject(HooksService)- private pluginService = inject(PluginService)readonly userBanModal = viewChild<UserBanModalComponent>('userBanModal')diff --git a/client/src/app/shared/shared-video-miniature/videos-selection.component.html b/client/src/app/shared/shared-video-miniature/videos-selection.component.htmlindex 906a8b9bd5..401433deef 100644--- a/client/src/app/shared/shared-video-miniature/videos-selection.component.html+++ b/client/src/app/shared/shared-video-miniature/videos-selection.component.html@@ -1,14 +1,14 @@-<div class="no-results" i18n *ngIf="hasDoneFirstQuery && videos.length === 0">{{ noResultMessage() }}</div>+<div class="no-results" i18n *ngIf="hasDoneFirstQuery && videos().length === 0">{{ noResultMessage() }}</div><divclass="videos"myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"[parentDisabled]="disabled()" [setAngularState]="true">- <div class="video" *ngFor="let video of videos; let i = index; trackBy: videoById">+ <div class="video" *ngFor="let video of videos(); let i = index; trackBy: videoById"><div class="checkbox-container" *ngIf="enableSelection()">- <my-peertube-checkbox [inputName]="'video-check-' + video.id" [(ngModel)]="_selection[video.id]"></my-peertube-checkbox>+ <my-peertube-checkbox [inputName]="'video-check-' + video.id" [(ngModel)]="selection()[video.id]"></my-peertube-checkbox></div><my-video-miniaturediff --git a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts b/client/src/app/shared/shared-video-miniature/videos-selection.component.tsindex 47912a3dbc..3e07b37b2b 100644--- a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts+++ b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts@@ -1,5 +1,5 @@import { NgFor, NgIf, NgTemplateOutlet } from '@angular/common'-import { AfterContentInit, Component, Input, TemplateRef, inject, input, output, contentChildren } from '@angular/core'+import { AfterContentInit, Component, contentChildren, inject, input, model, TemplateRef } from '@angular/core'import { FormsModule } from '@angular/forms'import { ComponentPagination, Notifier, resetCurrentPage, User } from '@app/core'import { objectKeysTyped } from '@peertube/peertube-core-utils'@@ -40,15 +40,12 @@ export class VideosSelectionComponent implements AfterContentInit {readonly templates = contentChildren(PeerTubeTemplateDirective)- readonly selectionChange = output<SelectionType>()- readonly videosModelChange = output<Video[]>()-- _selection: SelectionType = {}+ readonly selection = model<SelectionType>({})+ readonly videos = model<Video[]>([])rowButtonsTemplate: TemplateRef<any>globalButtonsTemplate: TemplateRef<any>- videos: Video[] = []sort: VideoSortField = '-publishedAt'onDataSubject = new Subject<any[]>()@@ -57,26 +54,6 @@ export class VideosSelectionComponent implements AfterContentInit {private lastQueryLength: number- @Input()- get selection () {- return this._selection- }-- set selection (selection: SelectionType) {- this._selection = selection- this.selectionChange.emit(this._selection)- }-- @Input()- get videosModel () {- return this.videos- }-- set videosModel (videos: Video[]) {- this.videos = videos- this.videosModelChange.emit(this.videos)- }-ngAfterContentInit () {{const t = this.templates().find(t => t.name() === 'rowButtons')@@ -96,14 +73,15 @@ export class VideosSelectionComponent implements AfterContentInit {}abortSelectionMode () {- this._selection = {}+ this.selection.update(() => ({}))}isInSelectionMode () {- return objectKeysTyped(this._selection).some(k => this._selection[k] === true)+ return objectKeysTyped(this.selection())+ .some(k => this.selection()[k] === true)}- videoById (index: number, video: Video) {+ videoById (_index: number, video: Video) {return video.id}@@ -127,9 +105,8 @@ export class VideosSelectionComponent implements AfterContentInit {this.hasDoneFirstQuery = truethis.lastQueryLength = data.length- if (reset) this.videos = []- this.videos = this.videos.concat(data)- this.videosModel = this.videos+ if (reset) this.videos.set([])+ this.videos.update(videos => videos.concat(data))this.onDataSubject.next(data)},diff --git a/client/src/app/shared/standalone-notifications/user-notifications.component.ts b/client/src/app/shared/standalone-notifications/user-notifications.component.tsindex 2c4691236e..ede991ad9c 100644--- a/client/src/app/shared/standalone-notifications/user-notifications.component.ts+++ b/client/src/app/shared/standalone-notifications/user-notifications.component.ts@@ -38,7 +38,7 @@ export class UserNotificationsComponent implements OnInit {ngOnInit () {this.componentPagination = {currentPage: 1,- itemsPerPage: this.itemsPerPage(), // Reset items per page, because of the @Input() variable+ itemsPerPage: this.itemsPerPage(),totalItems: null}