Merge pull request #239 from adityachandelgit/develop
Merge Develop into Master for Release
This commit is contained in:
@@ -20,6 +20,25 @@
|
||||
</p-toggleButton>
|
||||
</div>
|
||||
|
||||
<div *ngIf="opdsEnabled" class="flex flex-col gap-2 mt-4 rounded-lg">
|
||||
<p class="text-lg py-1">OPDS Endpoint:</p>
|
||||
<div class="flex items-center gap-4">
|
||||
<input
|
||||
class="min-w-[500px] max-w-[800px]"
|
||||
type="text"
|
||||
pInputText
|
||||
[value]="opdsEndpoint"
|
||||
readonly/>
|
||||
<p-button
|
||||
icon="pi pi-copy"
|
||||
severity="info"
|
||||
(onClick)="copyOpdsEndpoint()"
|
||||
label="Copy"
|
||||
outlined="true">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="opdsEnabled" class="mt-6">
|
||||
<p-button
|
||||
label="Create New User"
|
||||
@@ -44,7 +63,7 @@
|
||||
<td>{{ user.username }}</td>
|
||||
<td class="flex items-center gap-2">
|
||||
<p-password
|
||||
[(ngModel)]="user.password"
|
||||
[(ngModel)]="dummyPassword"
|
||||
[disabled]="true">
|
||||
</p-password>
|
||||
<i
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { NgIf } from '@angular/common';
|
||||
import { TableModule } from 'primeng/table';
|
||||
import { Button } from 'primeng/button';
|
||||
import { InputText } from 'primeng/inputtext';
|
||||
import { Dialog } from 'primeng/dialog';
|
||||
import { Tooltip } from 'primeng/tooltip';
|
||||
import { ToggleButton } from 'primeng/togglebutton';
|
||||
import { MessageService } from 'primeng/api';
|
||||
import { filter, take } from 'rxjs/operators';
|
||||
import {Component, inject, OnInit} from '@angular/core';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {NgIf} from '@angular/common';
|
||||
import {TableModule} from 'primeng/table';
|
||||
import {Button} from 'primeng/button';
|
||||
import {InputText} from 'primeng/inputtext';
|
||||
import {Dialog} from 'primeng/dialog';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {ToggleButton} from 'primeng/togglebutton';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {filter, take} from 'rxjs/operators';
|
||||
|
||||
import { OpdsUser, OpdsUserService } from '../opds-user.service';
|
||||
import { AppSettingsService } from '../core/service/app-settings.service';
|
||||
import { AppSettings } from '../core/model/app-settings.model';
|
||||
import { Password } from 'primeng/password';
|
||||
import {OpdsUser, OpdsUserService} from '../opds-user.service';
|
||||
import {AppSettingsService} from '../core/service/app-settings.service';
|
||||
import {AppSettings} from '../core/model/app-settings.model';
|
||||
import {Password} from 'primeng/password';
|
||||
import {API_CONFIG} from '../config/api-config';
|
||||
|
||||
@Component({
|
||||
selector: 'app-opds-settings',
|
||||
@@ -38,8 +39,10 @@ export class OpdsSettingsComponent implements OnInit {
|
||||
selectedUser: OpdsUser | null = null;
|
||||
createUserDialogVisible = false;
|
||||
resetPasswordDialogVisible = false;
|
||||
newUser = { username: '', password: '' };
|
||||
newUser = {username: '', password: ''};
|
||||
newPassword = '';
|
||||
opdsEndpoint: string = `${API_CONFIG.BASE_URL}/api/v1/opds/catalog`;
|
||||
dummyPassword: string = '********************************';
|
||||
|
||||
private readonly appSettings$ = inject(AppSettingsService).appSettings$;
|
||||
private readonly opdsUserService = inject(OpdsUserService);
|
||||
@@ -77,7 +80,7 @@ export class OpdsSettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
openCreateUserDialog(): void {
|
||||
this.newUser = { username: '', password: '' };
|
||||
this.newUser = {username: '', password: ''};
|
||||
this.createUserDialogVisible = true;
|
||||
}
|
||||
|
||||
@@ -86,7 +89,7 @@ export class OpdsSettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
saveNewUser(): void {
|
||||
const { username, password } = this.newUser;
|
||||
const {username, password} = this.newUser;
|
||||
|
||||
if (username.trim() && password.trim()) {
|
||||
this.opdsUserService.createUser(this.newUser).subscribe({
|
||||
@@ -117,6 +120,14 @@ export class OpdsSettingsComponent implements OnInit {
|
||||
this.newPassword = '';
|
||||
}
|
||||
|
||||
copyOpdsEndpoint() {
|
||||
navigator.clipboard.writeText(this.opdsEndpoint)
|
||||
.then(() => {
|
||||
})
|
||||
.catch(err => {
|
||||
});
|
||||
}
|
||||
|
||||
confirmResetPassword(): void {
|
||||
if (this.selectedUser && this.newPassword.trim()) {
|
||||
this.opdsUserService.resetPassword(this.selectedUser.id, this.newPassword).subscribe({
|
||||
@@ -147,7 +158,7 @@ export class OpdsSettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
private saveSetting(key: string, value: unknown): void {
|
||||
this.appSettingsService.saveSettings([{ key, newValue: value }]).subscribe({
|
||||
this.appSettingsService.saveSettings([{key, newValue: value}]).subscribe({
|
||||
next: () => {
|
||||
let successMessage = 'Settings saved successfully.';
|
||||
if (key === 'opds_server_enabled') {
|
||||
@@ -164,14 +175,14 @@ export class OpdsSettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
private showSuccess(summary: string, detail: string): void {
|
||||
this.messageService.add({ severity: 'success', summary, detail });
|
||||
this.messageService.add({severity: 'success', summary, detail});
|
||||
}
|
||||
|
||||
private showError(summary: string, detail: string): void {
|
||||
this.messageService.add({ severity: 'error', summary, detail });
|
||||
this.messageService.add({severity: 'error', summary, detail});
|
||||
}
|
||||
|
||||
private showWarning(summary: string, detail: string): void {
|
||||
this.messageService.add({ severity: 'warn', summary, detail });
|
||||
this.messageService.add({severity: 'warn', summary, detail});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user