+
+ // Set HotKeys
+ this.hotkeys = [
+ new Hotkey('m s', (event: KeyboardEvent): boolean => {
+ this.router.navigate([ '/videos/subscriptions' ])
+ return false
+ }, undefined, 'Go to my subscriptions'),
+ new Hotkey('m v', (event: KeyboardEvent): boolean => {
+ this.router.navigate([ '/my-account/videos' ])
+ return false
+ }, undefined, 'Go to my videos'),
+ new Hotkey('m i', (event: KeyboardEvent): boolean => {
+ this.router.navigate([ '/my-account/video-imports' ])
+ return false
+ }, undefined, 'Go to my imports'),
+ new Hotkey('m c', (event: KeyboardEvent): boolean => {
+ this.router.navigate([ '/my-account/video-channels' ])
+ return false
+ }, undefined, 'Go to my channels')
+ ]
+ }
+
+ loadClientCredentials () {
+ // Fetch the client_id/client_secret
+ this.http.get<OAuthClientLocal>(AuthService.BASE_CLIENT_URL)
+ .pipe(catchError(res => this.restExtractor.handleError(res)))
+ .subscribe(
+ res => {
+ this.clientId = res.client_id
+ this.clientSecret = res.client_secret
+
+ peertubeLocalStorage.setItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_ID, this.clientId)
+ peertubeLocalStorage.setItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_SECRET, this.clientSecret)
+
+ console.log('Client credentials loaded.')
+ },
+
+ error => {
+ let errorMessage = error.message
+
+ if (error.status === 403) {
+ errorMessage = this.i18n('Cannot retrieve OAuth Client credentials: {{errorText}}.\n', { errorText: error.text })
+ errorMessage += this.i18n(
+ 'Ensure you have correctly configured PeerTube (config/ directory), in particular the "webserver" section.'
+ )
+ }
+
+ // We put a bigger timeout
+ // This is an important message
+ this.notificationsService.error(this.i18n('Error'), errorMessage, { timeOut: 7000 })
+ }
+ )