mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-01 01:20:57 +03:00
Merge branch 'master' of https://github.com/Tzahi12345/YoutubeDL-Material into add-yt-dlp
This commit is contained in:
@@ -159,7 +159,7 @@ export const isoLangs = {
|
||||
},
|
||||
'nl': {
|
||||
'name': 'Dutch',
|
||||
'nativeName': 'Nederlands, Vlaams'
|
||||
'nativeName': 'Nederlands'
|
||||
},
|
||||
'en': {
|
||||
'name': 'English',
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
<mat-divider></mat-divider>
|
||||
<div *ngIf="new_config" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12 mt-3 mb-2">
|
||||
<div class="col-12 mt-3">
|
||||
<h6 i18n="Categories">Categories</h6>
|
||||
<div cdkDropList class="category-list" (cdkDropListDropped)="dropCategory($event)">
|
||||
<div class="category-box" *ngFor="let category of postsService.categories" cdkDrag>
|
||||
@@ -154,6 +154,9 @@
|
||||
</div>
|
||||
<button style="margin-top: 10px;" mat-mini-fab (click)="openAddCategoryDialog()"><mat-icon>add</mat-icon></button>
|
||||
</div>
|
||||
<div class="col-12 mt-2 mb-2">
|
||||
<mat-checkbox [(ngModel)]="new_config['Extra']['allow_playlist_categorization']" matTooltip="With this setting enabled, if a single video matches a category, the entire playlist will receive that category." i18n-matTooltip="Allow playlist categorization setting tooltip"><ng-container i18n="Allow playlist categorization setting label">Allow playlist categorization</ng-container></mat-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider></mat-divider>
|
||||
@@ -216,7 +219,7 @@
|
||||
<div class="enable-api-key-div">
|
||||
<mat-form-field class="text-field" color="accent">
|
||||
<input [disabled]="!new_config['API']['use_API_key']" [(ngModel)]="new_config['API']['API_key']" matInput placeholder="Public API Key" i18n-placeholder="Public API Key setting placeholder" required>
|
||||
<mat-hint><a target="_blank" href="https://stoplight.io/p/docs/gh/tzahi12345/youtubedl-material"><ng-container i18n="View API docs setting hint">View documentation</ng-container></a></mat-hint>
|
||||
<mat-hint><a target="_blank" href="https://youtubedl-material.stoplight.io/docs/youtubedl-material/Public%20API%20v1.yaml"><ng-container i18n="View API docs setting hint">View documentation</ng-container></a></mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="api-key-div">
|
||||
@@ -277,6 +280,43 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<!-- Database -->
|
||||
<mat-tab label="Database" i18n-label="Database settings label">
|
||||
<ng-template matTabContent>
|
||||
<div *ngIf="new_config" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12 mt-3">
|
||||
<div *ngIf="db_info">
|
||||
<h5 i18n="Database info title">Database Info</h5>
|
||||
<p><ng-container i18n="Database location label">Database location:</ng-container> <strong>{{db_info['using_local_db'] ? 'Local' : 'MongoDB'}}</strong></p>
|
||||
<h6 i18n="Records per table label">Records per table</h6>
|
||||
<mat-list style="padding-top: 0px">
|
||||
<mat-list-item style="height: 28px" *ngFor="let table_stats of db_info['stats_by_table'] | keyvalue">
|
||||
{{table_stats.key}}: {{table_stats.value.records_count}}
|
||||
</mat-list-item>
|
||||
</mat-list>
|
||||
|
||||
<mat-form-field style="width: 100%; margin-top: 15px; margin-bottom: 10px" color="accent">
|
||||
<input [(ngModel)]="new_config['Database']['mongodb_connection_string']" matInput placeholder="MongoDB Connection String" i18n-placeholder="MongoDB Connection String" required>
|
||||
<mat-hint><ng-container i18n="MongoDB Connection String setting hint AKA preamble">Example:</ng-container> mongodb://127.0.0.1:27017/?compressors=zlib</mat-hint>
|
||||
</mat-form-field>
|
||||
|
||||
<br>
|
||||
|
||||
<button (click)="testConnectionString()" [disabled]="testing_connection_string" mat-flat-button color="accent"><ng-container i18n="Test connection string button">Test connection string</ng-container></button>
|
||||
|
||||
<br>
|
||||
|
||||
<button class="transfer-db-button" [disabled]="db_transferring" color="accent" (click)="transferDB()" mat-raised-button><ng-container i18n="Transfer DB button">Transfer DB to </ng-container>{{db_info['using_local_db'] ? 'MongoDB' : 'Local'}}</button>
|
||||
</div>
|
||||
<div *ngIf="!db_info">
|
||||
<ng-container i18n="Database info not retrieved error message">Database information could not be retrieved. Check the server logs for more information.</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<!-- Advanced -->
|
||||
<mat-tab label="Advanced" i18n-label="Host settings label">
|
||||
<ng-template matTabContent>
|
||||
@@ -351,6 +391,14 @@
|
||||
<div *ngIf="new_config" class="container-fluid mt-1">
|
||||
<app-updater></app-updater>
|
||||
</div>
|
||||
<mat-divider></mat-divider>
|
||||
<div *ngIf="new_config" class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 mt-4">
|
||||
<button (click)="restartServer()" mat-stroked-button color="warn"><ng-container i18n="Restart server button">Restart server</ng-container></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab *ngIf="postsService.config && postsService.config.Advanced.multi_user_mode" label="Users" i18n-label="Users settings label">
|
||||
|
||||
@@ -77,8 +77,13 @@
|
||||
}
|
||||
|
||||
.category-custom-placeholder {
|
||||
background: #ccc;
|
||||
border: dotted 3px #999;
|
||||
min-height: 60px;
|
||||
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
||||
background: #ccc;
|
||||
border: dotted 3px #999;
|
||||
min-height: 60px;
|
||||
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.transfer-db-button {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import { EditCategoryDialogComponent } from 'app/dialogs/edit-category-dialog/ed
|
||||
})
|
||||
export class SettingsComponent implements OnInit {
|
||||
all_locales = isoLangs;
|
||||
supported_locales = ['en', 'es', 'de', 'fr', 'zh', 'nb', 'it', 'en-GB'];
|
||||
supported_locales = ['en', 'es', 'de', 'fr', 'nl', 'zh', 'nb', 'it', 'en-GB'];
|
||||
initialLocale = localStorage.getItem('locale');
|
||||
|
||||
initial_config = null;
|
||||
@@ -29,6 +29,10 @@ export class SettingsComponent implements OnInit {
|
||||
generated_bookmarklet_code = null;
|
||||
bookmarkletAudioOnly = false;
|
||||
|
||||
db_info = null;
|
||||
db_transferring = false;
|
||||
testing_connection_string = false;
|
||||
|
||||
_settingsSame = true;
|
||||
|
||||
latestGithubRelease = null;
|
||||
@@ -48,6 +52,7 @@ export class SettingsComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.getConfig();
|
||||
this.getDBInfo();
|
||||
|
||||
this.generated_bookmarklet_code = this.sanitizer.bypassSecurityTrustUrl(this.generateBookmarkletCode());
|
||||
|
||||
@@ -255,6 +260,68 @@ export class SettingsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
restartServer() {
|
||||
this.postsService.restartServer().subscribe(res => {
|
||||
this.postsService.openSnackBar('Restarting!');
|
||||
}, err => {
|
||||
this.postsService.openSnackBar('Failed to restart the server.');
|
||||
});
|
||||
}
|
||||
|
||||
getDBInfo() {
|
||||
this.postsService.getDBInfo().subscribe(res => {
|
||||
this.db_info = res['db_info'];
|
||||
});
|
||||
}
|
||||
|
||||
transferDB() {
|
||||
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
||||
data: {
|
||||
dialogTitle: 'Transfer DB',
|
||||
dialogText: `Are you sure you want to transfer the DB?`,
|
||||
submitText: 'Transfer',
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(confirmed => {
|
||||
if (confirmed) {
|
||||
this._transferDB();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_transferDB() {
|
||||
this.db_transferring = true;
|
||||
this.postsService.transferDB(this.db_info['using_local_db']).subscribe(res => {
|
||||
this.db_transferring = false;
|
||||
const success = res['success'];
|
||||
if (success) {
|
||||
this.openSnackBar('Successfully transfered DB! Reloading info...');
|
||||
this.getDBInfo();
|
||||
} else {
|
||||
this.openSnackBar('Failed to transfer DB -- transfer was aborted. Error: ' + res['error']);
|
||||
}
|
||||
}, err => {
|
||||
this.db_transferring = false;
|
||||
this.openSnackBar('Failed to transfer DB -- API call failed. See browser logs for details.');
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
|
||||
testConnectionString() {
|
||||
this.testing_connection_string = true;
|
||||
this.postsService.testConnectionString().subscribe(res => {
|
||||
this.testing_connection_string = false;
|
||||
if (res['success']) {
|
||||
this.postsService.openSnackBar('Connection successful!');
|
||||
} else {
|
||||
this.postsService.openSnackBar('Connection failed! Error: ' + res['error']);
|
||||
}
|
||||
}, err => {
|
||||
this.testing_connection_string = false;
|
||||
this.postsService.openSnackBar('Connection failed! Error: Server error. See logs for more info.');
|
||||
});
|
||||
}
|
||||
|
||||
// snackbar helper
|
||||
public openSnackBar(message: string, action: string = '') {
|
||||
this.snackBar.open(message, action, {
|
||||
|
||||
Reference in New Issue
Block a user