
* Updated a ton of dependencies. PDFs reader got a big update from PDF.js 2.6 -> 3.x * Rolled back fontawesome update * Updated to latest angular patch. Fixed search being too long instead of just to the end of the browser screen. * Fixed alignment on download icon for download indicator in cards * Include progress information on Want To Read API and when marking something as Read, perform cleanup service on want to read. * Removed mark-read updating want to read. As there are series restrictions and it could be misleading. * Tweaked login page spacing when form is dirty * Replaced an object instantiation * Commented out a few tests that always break when updating NetVips (but always work) * Updated ngx-toastr * Added styles for alerts to Kavita. They were somehow missing. Fixed an issue where when OPDS was disabled, user preferences wouldn't tell them. * Wired up a reset base url button to match Ip Addresses * Disable ipAddress and port for docker users * Removed cache dir since it's kinda pointless currently * Started the update for OPDS BaseUrl support * Fixed OPDS url not reflecting base url on localhost * Added extra plumbing to allow sending a real email when testing a custom service. * Implemented OPDS support under Base Url. Added pagination to all APIs where applicable. * Added a swallowing of permission denied on Updating baseurl in index.html for inapplicable users. * Fixed a bad test
83 lines
3 KiB
TypeScript
83 lines
3 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
|
import { ToastrService } from 'ngx-toastr';
|
|
import { take } from 'rxjs';
|
|
import { SettingsService, EmailTestResult } from '../settings.service';
|
|
import { ServerSettings } from '../_models/server-settings';
|
|
|
|
@Component({
|
|
selector: 'app-manage-email-settings',
|
|
templateUrl: './manage-email-settings.component.html',
|
|
styleUrls: ['./manage-email-settings.component.scss']
|
|
})
|
|
export class ManageEmailSettingsComponent implements OnInit {
|
|
|
|
serverSettings!: ServerSettings;
|
|
settingsForm: FormGroup = new FormGroup({});
|
|
|
|
constructor(private settingsService: SettingsService, private toastr: ToastrService) { }
|
|
|
|
ngOnInit(): void {
|
|
this.settingsService.getServerSettings().pipe(take(1)).subscribe((settings: ServerSettings) => {
|
|
this.serverSettings = settings;
|
|
this.settingsForm.addControl('emailServiceUrl', new FormControl(this.serverSettings.emailServiceUrl, [Validators.required]));
|
|
this.settingsForm.addControl('hostName', new FormControl(this.serverSettings.hostName, []));
|
|
});
|
|
}
|
|
|
|
resetForm() {
|
|
this.settingsForm.get('emailServiceUrl')?.setValue(this.serverSettings.emailServiceUrl);
|
|
this.settingsForm.get('hostName')?.setValue(this.serverSettings.hostName);
|
|
this.settingsForm.markAsPristine();
|
|
}
|
|
|
|
async saveSettings() {
|
|
const modelSettings = Object.assign({}, this.serverSettings);
|
|
modelSettings.emailServiceUrl = this.settingsForm.get('emailServiceUrl')?.value;
|
|
modelSettings.hostName = this.settingsForm.get('hostName')?.value;
|
|
|
|
|
|
this.settingsService.updateServerSettings(modelSettings).pipe(take(1)).subscribe((settings: ServerSettings) => {
|
|
this.serverSettings = settings;
|
|
this.resetForm();
|
|
this.toastr.success('Server settings updated');
|
|
}, (err: any) => {
|
|
console.error('error: ', err);
|
|
});
|
|
}
|
|
|
|
resetToDefaults() {
|
|
this.settingsService.resetServerSettings().pipe(take(1)).subscribe((settings: ServerSettings) => {
|
|
this.serverSettings = settings;
|
|
this.resetForm();
|
|
this.toastr.success('Server settings updated');
|
|
}, (err: any) => {
|
|
console.error('error: ', err);
|
|
});
|
|
}
|
|
|
|
resetEmailServiceUrl() {
|
|
this.settingsService.resetEmailServerSettings().pipe(take(1)).subscribe((settings: ServerSettings) => {
|
|
this.serverSettings.emailServiceUrl = settings.emailServiceUrl;
|
|
this.resetForm();
|
|
this.toastr.success('Email Service Reset');
|
|
}, (err: any) => {
|
|
console.error('error: ', err);
|
|
});
|
|
}
|
|
|
|
testEmailServiceUrl() {
|
|
this.settingsService.testEmailServerSettings(this.settingsForm.get('emailServiceUrl')?.value || '').pipe(take(1)).subscribe(async (result: EmailTestResult) => {
|
|
if (result.successful) {
|
|
this.toastr.success('Email Service was reachable');
|
|
} else {
|
|
this.toastr.error('Email Service Url did not respond. ' + result.errorMessage);
|
|
}
|
|
|
|
}, (err: any) => {
|
|
console.error('error: ', err);
|
|
});
|
|
|
|
}
|
|
|
|
}
|