mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-19 11:10:57 +03:00
added ability to set pin for settings. pin is md5'd by the backend
This commit is contained in:
@@ -19,6 +19,7 @@ import { Router, NavigationStart, NavigationEnd } from '@angular/router';
|
||||
import { OverlayContainer } from '@angular/cdk/overlay';
|
||||
import { THEMES_CONFIG } from '../themes';
|
||||
import { SettingsComponent } from './settings/settings.component';
|
||||
import { CheckOrSetPinDialogComponent } from './dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@@ -35,6 +36,8 @@ export class AppComponent implements OnInit {
|
||||
defaultTheme = null;
|
||||
allowThemeChange = null;
|
||||
allowSubscriptions = false;
|
||||
// defaults to true to prevent attack
|
||||
settingsPinRequired = true;
|
||||
|
||||
@ViewChild('sidenav', {static: false}) sidenav: MatSidenav;
|
||||
@ViewChild('hamburgerMenu', {static: false, read: ElementRef}) hamburgerMenuButton: ElementRef;
|
||||
@@ -73,6 +76,7 @@ export class AppComponent implements OnInit {
|
||||
this.postsService.loadNavItems().subscribe(res => { // loads settings
|
||||
const result = !this.postsService.debugMode ? res['config_file'] : res;
|
||||
this.topBarTitle = result['YoutubeDLMaterial']['Extra']['title_top'];
|
||||
this.settingsPinRequired = result['YoutubeDLMaterial']['Extra']['settings_pin_required'];
|
||||
const themingExists = result['YoutubeDLMaterial']['Themes'];
|
||||
this.defaultTheme = themingExists ? result['YoutubeDLMaterial']['Themes']['default_theme'] : 'default';
|
||||
this.allowThemeChange = themingExists ? result['YoutubeDLMaterial']['Themes']['allow_theme_change'] : true;
|
||||
@@ -158,10 +162,29 @@ onSetTheme(theme, old_theme) {
|
||||
}
|
||||
|
||||
openSettingsDialog() {
|
||||
if (this.settingsPinRequired) {
|
||||
this.openPinDialog();
|
||||
} else {
|
||||
this.actuallyOpenSettingsDialog();
|
||||
}
|
||||
}
|
||||
|
||||
actuallyOpenSettingsDialog() {
|
||||
const dialogRef = this.dialog.open(SettingsComponent, {
|
||||
width: '80vw'
|
||||
});
|
||||
}
|
||||
|
||||
openPinDialog() {
|
||||
const dialogRef = this.dialog.open(CheckOrSetPinDialogComponent, {
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(res => {
|
||||
if (res) {
|
||||
this.actuallyOpenSettingsDialog();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user