-
diff --git a/client/src/app/+my-account/my-account.module.ts b/client/src/app/+my-account/my-account.module.ts
index 6cf1499d3..db8ffac16 100644
--- a/client/src/app/+my-account/my-account.module.ts
+++ b/client/src/app/+my-account/my-account.module.ts
@@ -5,7 +5,6 @@ import { InputSwitchModule } from 'primeng/inputswitch'
import { SharedModule } from '../shared'
import { MyAccountRoutingModule } from './my-account-routing.module'
import { MyAccountChangePasswordComponent } from './my-account-settings/my-account-change-password/my-account-change-password.component'
-import { MyAccountVideoSettingsComponent } from './my-account-settings/my-account-video-settings/my-account-video-settings.component'
import { MyAccountSettingsComponent } from './my-account-settings/my-account-settings.component'
import { MyAccountComponent } from './my-account.component'
import { MyAccountVideosComponent } from './my-account-videos/my-account-videos.component'
@@ -37,7 +36,6 @@ import {
} from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component'
import { DragDropModule } from '@angular/cdk/drag-drop'
import { MyAccountChangeEmailComponent } from '@app/+my-account/my-account-settings/my-account-change-email'
-import { MyAccountInterfaceSettingsComponent } from '@app/+my-account/my-account-settings/my-account-interface'
@NgModule({
imports: [
@@ -54,10 +52,8 @@ import { MyAccountInterfaceSettingsComponent } from '@app/+my-account/my-account
MyAccountComponent,
MyAccountSettingsComponent,
MyAccountChangePasswordComponent,
- MyAccountVideoSettingsComponent,
MyAccountProfileComponent,
MyAccountChangeEmailComponent,
- MyAccountInterfaceSettingsComponent,
MyAccountVideosComponent,
diff --git a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts
index f32a892a4..9eaa3ba32 100644
--- a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts
+++ b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts
@@ -12,6 +12,8 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
import { Subscription } from 'rxjs'
import { ScreenService } from '@app/shared/misc/screen.service'
import { Notifier, ServerService } from '@app/core'
+import { UserService } from '@app/shared'
+import { LocalStorageService } from '@app/shared/misc/storage.service'
@Component({
selector: 'my-video-channel-videos',
@@ -34,9 +36,11 @@ export class VideoChannelVideosComponent extends AbstractVideoList implements On
protected serverService: ServerService,
protected route: ActivatedRoute,
protected authService: AuthService,
+ protected userService: UserService,
protected notifier: Notifier,
protected confirmService: ConfirmService,
protected screenService: ScreenService,
+ protected storageService: LocalStorageService,
private videoChannelService: VideoChannelService,
private videoService: VideoService
) {
diff --git a/client/src/app/app.component.html b/client/src/app/app.component.html
index 7743124d4..54b320f79 100644
--- a/client/src/app/app.component.html
+++ b/client/src/app/app.component.html
@@ -27,11 +27,6 @@
-
-
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index 9e220a383..55e929e78 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -19,6 +19,7 @@ import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component'
import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models'
import { APP_BASE_HREF } from '@angular/common'
+import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
export function metaFactory (serverService: ServerService): MetaLoader {
return new MetaStaticLoader({
@@ -39,6 +40,7 @@ export function metaFactory (serverService: ServerService): MetaLoader {
MenuComponent,
LanguageChooserComponent,
+ QuickSettingsModalComponent,
AvatarNotificationComponent,
HeaderComponent,
SearchTypeaheadComponent,
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts
index 1447daead..4ad904beb 100644
--- a/client/src/app/core/auth/auth-user.model.ts
+++ b/client/src/app/core/auth/auth-user.model.ts
@@ -67,17 +67,6 @@ class Tokens {
}
export class AuthUser extends User implements ServerMyUserModel {
- private static KEYS = {
- ID: 'id',
- ROLE: 'role',
- EMAIL: 'email',
- VIDEOS_HISTORY_ENABLED: 'videos-history-enabled',
- USERNAME: 'username',
- NSFW_POLICY: 'nsfw_policy',
- WEBTORRENT_ENABLED: 'peertube-videojs-' + 'webtorrent_enabled',
- AUTO_PLAY_VIDEO: 'auto_play_video'
- }
-
tokens: Tokens
specialPlaylists: MyUserSpecialPlaylist[]
@@ -106,10 +95,6 @@ export class AuthUser extends User implements ServerMyUserModel {
peertubeLocalStorage.removeItem(this.KEYS.USERNAME)
peertubeLocalStorage.removeItem(this.KEYS.ID)
peertubeLocalStorage.removeItem(this.KEYS.ROLE)
- peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY)
- peertubeLocalStorage.removeItem(this.KEYS.WEBTORRENT_ENABLED)
- peertubeLocalStorage.removeItem(this.KEYS.VIDEOS_HISTORY_ENABLED)
- peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO)
peertubeLocalStorage.removeItem(this.KEYS.EMAIL)
Tokens.flush()
}
diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts
index 2c5873cb3..3c066ca74 100644
--- a/client/src/app/core/theme/theme.service.ts
+++ b/client/src/app/core/theme/theme.service.ts
@@ -4,16 +4,15 @@ import { ServerService } from '@app/core/server'
import { environment } from '../../../environments/environment'
import { PluginService } from '@app/core/plugins/plugin.service'
import { ServerConfig, ServerConfigTheme } from '@shared/models'
-import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage'
import { first } from 'rxjs/operators'
+import { User } from '@app/shared/users/user.model'
+import { UserService } from '@app/shared/users/user.service'
+import { LocalStorageService } from '@app/shared/misc/storage.service'
+import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage'
@Injectable()
export class ThemeService {
- private static KEYS = {
- LAST_ACTIVE_THEME: 'last_active_theme'
- }
-
private oldThemeName: string
private themes: ServerConfigTheme[] = []
@@ -24,8 +23,10 @@ export class ThemeService {
constructor (
private auth: AuthService,
+ private userService: UserService,
private pluginService: PluginService,
- private server: ServerService
+ private server: ServerService,
+ private localStorageService: LocalStorageService
) {}
initialize () {
@@ -77,11 +78,11 @@ export class ThemeService {
private getCurrentTheme () {
if (this.themeFromLocalStorage) return this.themeFromLocalStorage.name
- if (this.auth.isLoggedIn()) {
- const theme = this.auth.getUser().theme
- if (theme !== 'instance-default') return theme
- }
+ const theme = this.auth.isLoggedIn()
+ ? this.auth.getUser().theme
+ : this.userService.getAnonymousUser().theme
+ if (theme !== 'instance-default') return theme
return this.serverConfig.theme.default
}
@@ -111,9 +112,9 @@ export class ThemeService {
this.pluginService.reloadLoadedScopes()
- peertubeLocalStorage.setItem(ThemeService.KEYS.LAST_ACTIVE_THEME, JSON.stringify(theme))
+ this.localStorageService.setItem(User.KEYS.THEME, JSON.stringify(theme), false)
} else {
- peertubeLocalStorage.removeItem(ThemeService.KEYS.LAST_ACTIVE_THEME)
+ this.localStorageService.removeItem(User.KEYS.THEME, false)
}
this.oldThemeName = currentTheme
@@ -126,6 +127,10 @@ export class ThemeService {
if (!this.auth.isLoggedIn()) {
this.updateCurrentTheme()
+
+ this.localStorageService.watch([User.KEYS.THEME]).subscribe(
+ () => this.updateCurrentTheme()
+ )
}
this.auth.userInformationLoaded
@@ -134,7 +139,7 @@ export class ThemeService {
}
private loadAndSetFromLocalStorage () {
- const lastActiveThemeString = peertubeLocalStorage.getItem(ThemeService.KEYS.LAST_ACTIVE_THEME)
+ const lastActiveThemeString = this.localStorageService.getItem(User.KEYS.THEME)
if (!lastActiveThemeString) return
try {
diff --git a/client/src/app/menu/language-chooser.component.scss b/client/src/app/menu/language-chooser.component.scss
index 72deb3952..50d19fd1f 100644
--- a/client/src/app/menu/language-chooser.component.scss
+++ b/client/src/app/menu/language-chooser.component.scss
@@ -4,6 +4,8 @@
.help-to-translate {
@include peertube-button-link;
@include orange-button;
+
+ border-radius: 0;
}
.modal-body {
diff --git a/client/src/app/menu/language-chooser.component.ts b/client/src/app/menu/language-chooser.component.ts
index 43f622dfb..fb74cdf19 100644
--- a/client/src/app/menu/language-chooser.component.ts
+++ b/client/src/app/menu/language-chooser.component.ts
@@ -1,7 +1,9 @@
-import { Component, ElementRef, ViewChild } from '@angular/core'
+import { Component, ElementRef, ViewChild, Inject, LOCALE_ID } from '@angular/core'
import { I18N_LOCALES } from '../../../../shared'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { sortBy } from '@app/shared/misc/utils'
+import { getCompleteLocale } from '@shared/models/i18n'
+import { isOnDevLocale, getDevLocale } from '@app/shared/i18n/i18n-utils'
@Component({
selector: 'my-language-chooser',
@@ -13,7 +15,10 @@ export class LanguageChooserComponent {
languages: { id: string, label: string }[] = []
- constructor (private modalService: NgbModal) {
+ constructor (
+ private modalService: NgbModal,
+ @Inject(LOCALE_ID) private localeId: string
+ ) {
const l = Object.keys(I18N_LOCALES)
.map(k => ({ id: k, label: I18N_LOCALES[k] }))
@@ -28,4 +33,10 @@ export class LanguageChooserComponent {
return window.location.origin + '/' + lang.id
}
+ getCurrentLanguage () {
+ const english = 'English'
+ const locale = isOnDevLocale() ? getDevLocale() : getCompleteLocale(this.localeId)
+ if (locale) return I18N_LOCALES[locale] || english
+ return english
+ }
}
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html
index 790a8af00..399350616 100644
--- a/client/src/app/menu/menu.component.html
+++ b/client/src/app/menu/menu.component.html
@@ -11,31 +11,62 @@