ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix video password access
Chocobozzz0fb216c2fc30
diff --git a/client/src/app/+video-watch/video-watch.component.ts b/client/src/app/+video-watch/video-watch.component.tsindex fa55b2d702..c633de1687 100644--- a/client/src/app/+video-watch/video-watch.component.ts+++ b/client/src/app/+video-watch/video-watch.component.ts@@ -404,6 +404,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {})},error: async err => {+ console.log(err)if (err.body.code === ServerErrorCode.VIDEO_REQUIRES_PASSWORD || err.body.code === ServerErrorCode.INCORRECT_VIDEO_PASSWORD) {const { confirmed, password } = await this.handleVideoPasswordError(err)diff --git a/client/src/app/shared/shared-main/http/auth-interceptor.service.ts b/client/src/app/shared/shared-main/http/auth-interceptor.service.tsindex b65f307cc2..a8988aa5df 100644--- a/client/src/app/shared/shared-main/http/auth-interceptor.service.ts+++ b/client/src/app/shared/shared-main/http/auth-interceptor.service.ts@@ -3,7 +3,14 @@ import { Injectable, Injector, inject } from '@angular/core'import { Router } from '@angular/router'import { AuthService } from '@app/core/auth/auth.service'import { getBackendUrl } from '@app/helpers'-import { HttpStatusCode, OAuth2ErrorCode, PeerTubeProblemDocument, ServerErrorCode } from '@peertube/peertube-models'+import {+ HttpStatusCode,+ OAuth2ErrorCode,+ OAuth2ErrorCodeType,+ PeerTubeProblemDocument,+ ServerErrorCode,+ ServerErrorCodeType+} from '@peertube/peertube-models'import { isSameOrigin } from '@root-helpers/url'import { Observable, throwError as observableThrowError, of } from 'rxjs'import { catchError, switchMap } from 'rxjs/operators'@@ -28,13 +35,18 @@ export class AuthInterceptor implements HttpInterceptor {.pipe(catchError((err: HttpErrorResponse) => {const error = err.error as PeerTubeProblemDocument- const isOTPMissingError = this.authService.isOTPMissingError(err)- if (error && error.code === ServerErrorCode.CURRENT_PASSWORD_IS_INVALID) {+ const bypassCodes = new Set<ServerErrorCodeType | OAuth2ErrorCodeType>([+ ServerErrorCode.VIDEO_REQUIRES_PASSWORD,+ ServerErrorCode.INCORRECT_VIDEO_PASSWORD,+ ServerErrorCode.CURRENT_PASSWORD_IS_INVALID+ ])++ if (error?.code && bypassCodes.has(error.code)) {return observableThrowError(() => err)}- if (!isOTPMissingError) {+ if (!this.authService.isOTPMissingError(err)) {if (err.status === HttpStatusCode.UNAUTHORIZED_401 && error && error.code === OAuth2ErrorCode.INVALID_TOKEN) {return this.handleTokenExpired(req, next)}diff --git a/client/src/sass/bootstrap.scss b/client/src/sass/bootstrap.scssindex 6f172adf84..9d7f6bf0c7 100644--- a/client/src/sass/bootstrap.scss+++ b/client/src/sass/bootstrap.scss@@ -188,6 +188,7 @@ body {.modal-header {border-bottom: 0;margin-bottom: 5px;+ padding: 1.5rem $modal-inner-padding;.modal-title {font-size: 20px;