ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix token injection if unlogged user
Chocobozzz49e7e4d9ffd1
diff --git a/client/src/assets/player/shared/peertube/peertube-plugin.ts b/client/src/assets/player/shared/peertube/peertube-plugin.tsindex 4bd038bb13..56de66998d 100644--- a/client/src/assets/player/shared/peertube/peertube-plugin.ts+++ b/client/src/assets/player/shared/peertube/peertube-plugin.ts@@ -210,7 +210,7 @@ class PeerTubePlugin extends Plugin {lastViewEvent = undefined// Server won't save history, so save the video position in local storage- if (!this.authorizationHeader) {+ if (!this.authorizationHeader()) {saveVideoWatchHistory(this.videoUUID, currentTime)}}, this.CONSTANTS.USER_VIEW_VIDEO_INTERVAL)@@ -228,7 +228,7 @@ class PeerTubePlugin extends Plugin {'Content-type': 'application/json; charset=UTF-8'})- if (this.authorizationHeader) headers.set('Authorization', this.authorizationHeader())+ if (this.authorizationHeader()) headers.set('Authorization', this.authorizationHeader())return fetch(this.videoViewUrl, { method: 'POST', body: JSON.stringify(body), headers })}diff --git a/client/src/standalone/videos/shared/auth-http.ts b/client/src/standalone/videos/shared/auth-http.tsindex 43af5dff49..95e3b029e3 100644--- a/client/src/standalone/videos/shared/auth-http.ts+++ b/client/src/standalone/videos/shared/auth-http.ts@@ -27,6 +27,8 @@ export class AuthHTTP {}getHeaderTokenValue () {+ if (!this.userOAuthTokens) return null+return `${this.userOAuthTokens.tokenType} ${this.userOAuthTokens.accessToken}`}