Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Add getAuthHeader client helper

Chocobozzz4eca42ffb4a1
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index ee80d4d39b..6a1a46e73c 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -271,6 +271,13 @@ export class PluginService implements ClientHook {
return this.authService.isLoggedIn()
},
+ getAuthHeader: () => {
+ if (!this.authService.isLoggedIn()) return undefined
+
+ const value = this.authService.getRequestHeaderValue()
+ return { 'Authorization': value }
+ },
+
notifier: {
info: (text: string, title?: string, timeout?: number) => this.notifier.info(text, title, timeout),
error: (text: string, title?: string, timeout?: number) => this.notifier.error(text, title, timeout),
diff --git a/client/src/types/register-client-option.model.ts b/client/src/types/register-client-option.model.ts
index 16c9213442..8802edc329 100644
--- a/client/src/types/register-client-option.model.ts
+++ b/client/src/types/register-client-option.model.ts
@@ -21,6 +21,8 @@ export type RegisterClientHelpers = {
isLoggedIn: () => boolean
+ getAuthHeader: () => { 'Authorization': string } | undefined
+
getSettings: () => Promise<{ [ name: string ]: string }>
getServerConfig: () => Promise<ServerConfig>