Merged changes from master

This commit is contained in:
Isaac Grynsztein
2020-06-21 23:54:18 -04:00
6 changed files with 20 additions and 18 deletions

View File

@@ -73,7 +73,7 @@ export class PostsService implements CanActivate {
this.httpOptions.params = this.httpOptions.params.set('sessionID', this.session_id);
});
const login_not_required = this.router.url !== '/player'
const redirect_not_required = window.location.href.includes('/player') || window.location.href.includes('/login');
// get config
this.loadNavItems().subscribe(res => {
@@ -82,11 +82,11 @@ export class PostsService implements CanActivate {
this.config = result['YoutubeDLMaterial'];
if (this.config['Advanced']['multi_user_mode']) {
// login stuff
if (localStorage.getItem('jwt_token')) {
if (localStorage.getItem('jwt_token') && localStorage.getItem('jwt_token') !== 'null') {
this.token = localStorage.getItem('jwt_token');
this.httpOptions.params = this.httpOptions.params.set('jwt', this.token);
this.jwtAuth();
} else if (login_not_required) {
} else if (redirect_not_required) {
this.setInitialized();
} else {
this.sendToLogin();
@@ -382,6 +382,7 @@ export class PostsService implements CanActivate {
this.user = null;
this.permissions = null;
this.isLoggedIn = false;
this.token = null;
localStorage.setItem('jwt_token', null);
if (this.router.url !== '/login') {
this.router.navigate(['/login']);
@@ -402,17 +403,14 @@ export class PostsService implements CanActivate {
const call = this.http.post(this.path + 'auth/register', {userid: username,
username: username,
password: password}, this.httpOptions);
/*call.subscribe(res => {
console.log(res['user']);
if (res['user']) {
// this.afterRegistration(res['user']);
}
});*/
return call;
}
sendToLogin() {
this.checkAdminCreationStatus();
if (!this.initialized) {
this.setInitialized();
}
if (this.router.url === '/login') {
return;
}

View File

@@ -2,9 +2,9 @@
<!-- <ng-container i18n="Allow subscriptions setting"></ng-container> -->
<mat-dialog-content>
<!-- Language
<!-- Language
<div style="margin-bottom: 10px;">
</div> -->
<mat-tab-group>
@@ -47,13 +47,13 @@
<div class="col-12 mt-3">
<mat-checkbox color="accent" [(ngModel)]="new_config['Encryption']['use-encryption']"><ng-container i18n="Use encryption setting">Use encryption</ng-container></mat-checkbox>
</div>
<div class="col-12">
<mat-form-field class="text-field" color="accent">
<input [disabled]="!new_config['Encryption']['use-encryption']" [(ngModel)]="new_config['Encryption']['cert-file-path']" matInput placeholder="Cert file path" i18n-placeholder="Cert file path input placeholder">
</mat-form-field>
</div>
<div class="col-12">
<mat-form-field class="text-field" color="accent">
<input [disabled]="!new_config['Encryption']['use-encryption']" [(ngModel)]="new_config['Encryption']['key-file-path']" matInput placeholder="Key file path" i18n-placeholder="Key file path input placeholder">
@@ -132,7 +132,7 @@
<mat-hint><ng-container i18n="Aduio path setting input hint">Path for audio only downloads. It is relative to YTDL-Material's root folder.</ng-container></mat-hint>
</mat-form-field>
</div>
<div class="col-12 mt-5">
<mat-form-field class="text-field" color="accent">
<input matInput [(ngModel)]="new_config['Downloader']['path-video']" placeholder="Video folder path" i18n-placeholder="Video folder path input placeholder" required>
@@ -192,7 +192,7 @@
</div>
</div>
</div>
<mat-divider></mat-divider>
<mat-divider></mat-divider>
<div *ngIf="new_config" class="container-fluid">
<div class="row">
<div class="col-12 mt-3">
@@ -275,7 +275,7 @@
</div>
<div class="col-12 mt-2 mb-1">
<mat-form-field>
<mat-label><ng-container i18n="Logger level select label">Select a downloader</ng-container></mat-label>
<mat-label><ng-container i18n="Logger level select label">Select a logger level</ng-container></mat-label>
<mat-select color="accent" [(ngModel)]="new_config['Advanced']['logger_level']">
<mat-option value="debug">Debug</mat-option>
<mat-option value="verbose">Verbose</mat-option>
@@ -311,7 +311,7 @@
</div>
<app-modify-users></app-modify-users>
</mat-tab>
</mat-tab-group>
</mat-tab-group>
</mat-dialog-content>
<mat-dialog-actions>
@@ -323,4 +323,4 @@
<span i18n="Settings cancel and close button">{settingsAreTheSame + "", select, true {Close} false {Cancel} other {otha}}</span>
</button>
</div>
</mat-dialog-actions>
</mat-dialog-actions>