Cleaned up code and added missing translation units

This commit is contained in:
Tzahi12345
2020-05-03 19:35:38 -04:00
parent 74e47b7d04
commit 1861011fb0
10 changed files with 16 additions and 19 deletions

1
.gitignore vendored
View File

@@ -64,3 +64,4 @@ backend/appdata/archives/blacklist_video.txt
backend/appdata/logs/combined.log
backend/appdata/logs/error.log
backend/appdata/users.json
backend/users/*

View File

@@ -12,7 +12,7 @@
</mat-form-field>
</div>
<div style="margin-bottom: 10px; margin-top: 10px;">
<button [disabled]="loggingIn" color="primary" (click)="login()" mat-raised-button>Login</button>
<button [disabled]="loggingIn" color="primary" (click)="login()" mat-raised-button><ng-container i18n="Login">Login</ng-container></button>
</div>
</mat-tab>
<mat-tab *ngIf="registrationEnabled" label="Register">
@@ -32,7 +32,7 @@
</mat-form-field>
</div>
<div style="margin-bottom: 10px; margin-top: 10px;">
<button [disabled]="registering" color="primary" (click)="register()" mat-raised-button>Register</button>
<button [disabled]="registering" color="primary" (click)="register()" mat-raised-button><ng-container i18n="Register">Register</ng-container></button>
</div>
</mat-tab>
</mat-tab-group>

View File

@@ -41,7 +41,7 @@ export class LoginComponent implements OnInit {
}
login() {
if (this.loginPasswordInput === '' || this.loggingIn) {
if (this.loginPasswordInput === '') {
return;
}
this.loggingIn = true;

View File

@@ -92,7 +92,7 @@
</div>
</div>
</div>
<button color="primary" [matMenuTriggerFor]="edit_roles_menu" class="edit-role" mat-raised-button>Edit Role</button>
<button color="primary" [matMenuTriggerFor]="edit_roles_menu" class="edit-role" mat-raised-button><ng-container i18n="Edit role">Edit Role</ng-container></button>
<mat-menu #edit_roles_menu="matMenu">
<button (click)="openModifyRole(role)" mat-menu-item *ngFor="let role of roles">{{role.name}}</button>
</mat-menu>

View File

@@ -3,12 +3,12 @@
<mat-dialog-content>
<div>
<mat-form-field>
<input matInput placeholder="User name" [(ngModel)]="usernameInput">
<input matInput placeholder="User name" i18n-placeholder="User name placeholder" [(ngModel)]="usernameInput">
</mat-form-field>
</div>
<div>
<mat-form-field>
<input matInput placeholder="Password" [(ngModel)]="passwordInput" type="password">
<input matInput placeholder="Password" i18n-placeholder="Password placeholder" [(ngModel)]="passwordInput" type="password">
</mat-form-field>
</div>
</mat-dialog-content>

View File

@@ -10,7 +10,7 @@
<mat-checkbox [checked]="sharing_enabled" (change)="sharingChanged($event)"><ng-container i18n="Enable sharing checkbox">Enable sharing</ng-container></mat-checkbox>
</div>
<div>
<mat-checkbox style="margin-right: 15px;" (change)="useTimestampChanged()" [(ngModel)]="timestamp_enabled">Use timestamp</mat-checkbox>
<mat-checkbox style="margin-right: 15px;" (change)="useTimestampChanged()" [(ngModel)]="timestamp_enabled"><ng-container i18n="Use timestamp">Use timestamp</ng-container></mat-checkbox>
<mat-form-field>
<input matInput type="number" [(ngModel)]="current_timestamp" [disabled]="!timestamp_enabled" (change)="timestampInputChanged($event)" placeholder="Seconds" i18n-placeholder="Seconds">
</mat-form-field>

View File

@@ -31,7 +31,7 @@
</div>
<div class="col-12">
<div>
<mat-checkbox [(ngModel)]="streamingOnlyMode">Streaming-only mode</mat-checkbox>
<mat-checkbox [(ngModel)]="streamingOnlyMode"><ng-container i18n="Streaming-only mode">Streaming-only mode</ng-container></mat-checkbox>
</div>
</div>
</div>

View File

@@ -24,18 +24,18 @@
</div>
</mat-expansion-panel-header>
<div *ngIf="download.error">
<strong>An error has occured:</strong>
<strong><ng-container i18n="Error label">An error has occured:</ng-container></strong>
<br/>
{{download.error}}
</div>
<div *ngIf="download.timestamp_start">
<strong>Download start: </strong>{{download.timestamp_start | date:'medium'}}
<strong><ng-container i18n="Download start label">Download start:</ng-container></strong>&nbsp;{{download.timestamp_start | date:'medium'}}
</div>
<div *ngIf="download.timestamp_end">
<strong>Download end: </strong> {{download.timestamp_end | date:'medium'}}
<strong><ng-container i18n="Download end label">Download end:</ng-container></strong>&nbsp;{{download.timestamp_end | date:'medium'}}
</div>
<div *ngIf="download.fileNames">
<strong>File path(s): </strong> {{download.fileNames.join(', ')}}
<strong><ng-container i18n="File path(s) label">File path(s):</ng-container></strong>&nbsp;{{download.fileNames.join(', ')}}
</div>
</mat-expansion-panel>
</div>

View File

@@ -1,5 +1,5 @@
import {Injectable, isDevMode, Inject} from '@angular/core';
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
import { HttpClient, HttpParams } from '@angular/common/http';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
@@ -336,9 +336,7 @@ export class PostsService implements CanActivate {
this.token = token;
localStorage.setItem('jwt_token', this.token);
this.httpOptions.params = this.httpOptions.params.set('jwt', this.token);
console.log(this.httpOptions);
this.setInitialized();
// needed to re-initialize parts of app after login
@@ -357,18 +355,16 @@ export class PostsService implements CanActivate {
// user methods
jwtAuth() {
console.log('doing jwt call');
const call = this.http.post(this.path + 'auth/jwtAuth', {}, this.httpOptions);
call.subscribe(res => {
if (res['token']) {
this.afterLogin(res['user'], res['token'], res['permissions'], res['available_permissions']);
}
}, err => {
console.log('jwt errored')
if (err.status === 401) {
this.sendToLogin();
}
console.log(err)
console.log(err);
});
return call;
}

View File

@@ -35,7 +35,7 @@
</div>
<div class="col-12 mt-3 mb-4">
<mat-form-field class="text-field">
<input [(ngModel)]="new_config['Users']['base_path']" matInput placeholder="Users base path" i18n-placeholder="Users base path placeholder" required>
<input [disabled]="!new_config['Advanced']['multi_user_mode']" [(ngModel)]="new_config['Users']['base_path']" matInput placeholder="Users base path" i18n-placeholder="Users base path placeholder" required>
<mat-hint><ng-container i18n="Users base path hint">Base path for users and their downloaded videos.</ng-container></mat-hint>
</mat-form-field>
</div>