Skip to content

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

Fix logged in hotkeys

Chocobozzz905a40217d7d
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index c22b6ef0b9..d38e9eea11 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -314,7 +314,7 @@ export class AppComponent implements OnInit, AfterViewInit {
private initHotkeys () {
this.hotkeysService.add([
- new Hotkey([ '/', 's' ], () => {
+ new Hotkey([ 'Shift+/', 's' ], () => {
document.getElementById('search-video').focus()
return false
}, $localize`Focus the search bar`),
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 2ec4a4b7e0..cadf78c0cf 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -36,7 +36,7 @@ export class AuthService {
loginChangedSource: Observable<AuthStatus>
userInformationLoaded = new ReplaySubject<boolean>(1)
tokensRefreshed = new ReplaySubject<void>(1)
- hotkeys: Hotkey[]
+ loggedInHotkeys: Hotkey[]
private clientId: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_ID)
private clientSecret: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_SECRET)
@@ -56,7 +56,7 @@ export class AuthService {
this.loginChangedSource = this.loginChanged.asObservable()
// Set HotKeys
- this.hotkeys = [
+ this.loggedInHotkeys = [
new Hotkey('m s', e => {
this.router.navigate([ '/videos/subscriptions' ])
return false
@@ -78,6 +78,8 @@ export class AuthService {
buildAuthUser (userInfo: Partial<User>, tokens: OAuthUserTokens) {
this.user = new AuthUser(userInfo, tokens)
+
+ this.hotkeysService.add(this.loggedInHotkeys)
}
loadClientCredentials () {
@@ -194,8 +196,6 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular
this.user = null
this.setStatus(AuthStatus.LoggedOut)
-
- this.hotkeysService.remove(this.hotkeys)
}
refreshAccessToken () {
@@ -284,8 +284,6 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular
this.setStatus(AuthStatus.LoggedIn)
this.userInformationLoaded.next(true)
-
- this.hotkeysService.add(this.hotkeys)
}
private handleRefreshToken (obj: UserRefreshToken) {
@@ -295,5 +293,11 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular
private setStatus (status: AuthStatus) {
this.loginChanged.next(status)
+
+ if (status === AuthStatus.LoggedIn) {
+ this.hotkeysService.add(this.loggedInHotkeys)
+ } else {
+ this.hotkeysService.remove(this.loggedInHotkeys)
+ }
}
}