+ },
+
+ getServerConfig: () => {
+ return this.server.getConfig()
+ .pipe(catchError(res => this.restExtractor.handleError(res)))
+ .toPromise()
+ },
+
+ isLoggedIn: () => {
+ 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),
+ success: (text: string, title?: string, timeout?: number) => this.notifier.success(text, title, timeout)
+ },
+
+ showModal: (input: {
+ title: string,
+ content: string,
+ close?: boolean,
+ cancel?: { value: string, action?: () => void },
+ confirm?: { value: string, action?: () => void }
+ }) => {
+ this.customModal.show(input)
+ },
+
+ markdownRenderer: {
+ textMarkdownToHTML: (textMarkdown: string) => {
+ return this.markdownRenderer.textMarkdownToHTML(textMarkdown)
+ },
+
+ enhancedMarkdownToHTML: (enhancedMarkdown: string) => {
+ return this.markdownRenderer.enhancedMarkdownToHTML(enhancedMarkdown)
+ }
+ },
+
+ translate: (value: string) => {
+ return this.translationsObservable
+ .pipe(map(allTranslations => allTranslations[npmName]))
+ .pipe(map(translations => peertubeTranslate(value, translations)))
+ .toPromise()