Lots of Bugfixes (#2356)
This commit is contained in:
parent
86e931dd9a
commit
226d6831df
47 changed files with 359 additions and 225 deletions
|
@ -1,5 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { CanActivate } from '@angular/router';
|
||||
import {CanActivate, Router} from '@angular/router';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
|
@ -11,10 +11,10 @@ import {TranslocoService} from "@ngneat/transloco";
|
|||
})
|
||||
export class AdminGuard implements CanActivate {
|
||||
constructor(private accountService: AccountService, private toastr: ToastrService,
|
||||
private router: Router,
|
||||
private translocoService: TranslocoService) {}
|
||||
|
||||
canActivate(): Observable<boolean> {
|
||||
// this automatically subs due to being router guard
|
||||
return this.accountService.currentUser$.pipe(take(1),
|
||||
map((user) => {
|
||||
if (user && this.accountService.hasAdminRole(user)) {
|
||||
|
@ -22,6 +22,7 @@ export class AdminGuard implements CanActivate {
|
|||
}
|
||||
|
||||
this.toastr.error(this.translocoService.translate('toasts.unauthorized-1'));
|
||||
this.router.navigateByUrl('/libraries');
|
||||
return false;
|
||||
})
|
||||
);
|
||||
|
|
|
@ -22,12 +22,7 @@ export class AuthGuard implements CanActivate {
|
|||
if (user) {
|
||||
return true;
|
||||
}
|
||||
// TODO: Remove the error message stuff here and just redirect them. Don't need to tell them
|
||||
const errorMessage = this.translocoService.translate('toasts.unauthorized-1');
|
||||
const errorMessage2 = this.translocoService.translate('toasts.unauthorized-2');
|
||||
if (this.toastr.toasts.filter(toast => toast.message === errorMessage2 || toast.message === errorMessage).length === 0) {
|
||||
this.toastr.error(errorMessage);
|
||||
}
|
||||
|
||||
localStorage.setItem(this.urlKey, window.location.pathname);
|
||||
this.router.navigateByUrl('/login');
|
||||
return false;
|
||||
|
|
|
@ -124,9 +124,9 @@
|
|||
<div class="col-md-12">
|
||||
<div class="mb-3">
|
||||
<label for="tags" class="form-label">{{t('tags-label')}}</label>
|
||||
<app-typeahead (selectedData)="updateTags($event)" [settings]="tagsSettings"
|
||||
<app-typeahead (selectedData)="updateTags($event);metadata.tagsLocked = true" [settings]="tagsSettings"
|
||||
[(locked)]="metadata.tagsLocked" (onUnlock)="metadata.tagsLocked = false"
|
||||
(newItemAdded)="metadata.tagsLocked = true" (selectedData)="metadata.tagsLocked = true">
|
||||
(newItemAdded)="metadata.tagsLocked = true">
|
||||
<ng-template #badgeItem let-item let-position="idx">
|
||||
{{item.title}}
|
||||
</ng-template>
|
||||
|
|
|
@ -368,7 +368,7 @@ export class EditSeriesModalComponent implements OnInit {
|
|||
return {id: 0, title: title };
|
||||
});
|
||||
this.tagsSettings.selectionCompareFn = (a: Tag, b: Tag) => {
|
||||
return a.id == b.id;
|
||||
return a.title.toLowerCase() == b.title.toLowerCase();
|
||||
}
|
||||
this.tagsSettings.compareFnForAdd = (options: Tag[], filter: string) => {
|
||||
return options.filter(m => this.utilityService.filterMatches(m.title, filter));
|
||||
|
@ -398,7 +398,7 @@ export class EditSeriesModalComponent implements OnInit {
|
|||
return options.filter(m => this.utilityService.filterMatches(m.title, filter));
|
||||
}
|
||||
this.genreSettings.selectionCompareFn = (a: Genre, b: Genre) => {
|
||||
return a.title == b.title;
|
||||
return a.title.toLowerCase() == b.title.toLowerCase();
|
||||
}
|
||||
|
||||
this.genreSettings.addTransformFn = ((title: string) => {
|
||||
|
|
|
@ -103,11 +103,10 @@ export class CoverImageChooserComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
ctx.drawImage(img, 0, 0);
|
||||
const dataURL = canvas.toDataURL("image/png");
|
||||
return dataURL;
|
||||
return canvas.toDataURL("image/png");
|
||||
}
|
||||
|
||||
selectImage(index: number) {
|
||||
selectImage(index: number, callback?: Function) {
|
||||
if (this.selectedIndex === index) { return; }
|
||||
|
||||
// If we load custom images of series/chapters/covers, then those urls are not properly encoded, so on select we have to clean them up
|
||||
|
@ -116,7 +115,11 @@ export class CoverImageChooserComponent implements OnInit, OnDestroy {
|
|||
const img = new Image();
|
||||
img.crossOrigin = 'Anonymous';
|
||||
img.src = imgUrl;
|
||||
img.onload = (e) => this.handleUrlImageAdd(img, index);
|
||||
img.onload = (e) => {
|
||||
this.handleUrlImageAdd(img, index);
|
||||
this.selectedBase64Url.emit(this.imageUrls[this.selectedIndex]);
|
||||
if (callback) callback(index);
|
||||
};
|
||||
img.onerror = (e) => {
|
||||
this.toastr.error(translate('errors.rejected-cover-upload'));
|
||||
this.form.get('coverImageUrl')?.setValue('');
|
||||
|
@ -124,7 +127,6 @@ export class CoverImageChooserComponent implements OnInit, OnDestroy {
|
|||
};
|
||||
this.form.get('coverImageUrl')?.setValue('');
|
||||
this.cdRef.markForCheck();
|
||||
this.selectedBase64Url.emit(this.imageUrls[this.selectedIndex]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -135,11 +137,13 @@ export class CoverImageChooserComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
applyImage(index: number) {
|
||||
if (this.showApplyButton) {
|
||||
if (!this.showApplyButton) return;
|
||||
|
||||
this.selectImage(index, () => {
|
||||
this.applyCover.emit(this.imageUrls[index]);
|
||||
this.appliedIndex = index;
|
||||
this.cdRef.markForCheck();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
resetImage() {
|
||||
|
|
|
@ -1645,6 +1645,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
data.emulateBook = modelSettings.emulateBook;
|
||||
data.swipeToPaginate = modelSettings.swipeToPaginate;
|
||||
data.pageSplitOption = parseInt(modelSettings.pageSplitOption, 10);
|
||||
data.locale = data.locale || 'en';
|
||||
|
||||
this.accountService.updatePreferences(data).subscribe(updatedPrefs => {
|
||||
this.toastr.success(translate('manga-reader.user-preferences-updated'));
|
||||
|
|
|
@ -53,7 +53,6 @@ export class UserLoginComponent implements OnInit {
|
|||
if (user) {
|
||||
this.navService.showSideNav();
|
||||
this.cdRef.markForCheck();
|
||||
this.router.navigateByUrl('/libraries');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -96,6 +95,7 @@ export class UserLoginComponent implements OnInit {
|
|||
localStorage.setItem('kavita--auth-intersection-url', '');
|
||||
this.router.navigateByUrl(pageResume);
|
||||
} else {
|
||||
localStorage.setItem('kavita--auth-intersection-url', '');
|
||||
this.router.navigateByUrl('/libraries');
|
||||
}
|
||||
this.isSubmitting = false;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<app-metadata-detail [tags]="links" [libraryId]="series.libraryId" [heading]="t('links-title')">
|
||||
<ng-template #itemTemplate let-item>
|
||||
<a class="col me-1" [href]="item | safeHtml" target="_blank" rel="noopener noreferrer" [title]="item">
|
||||
<img width="24" height="24" class="lazyload img-placeholder"
|
||||
<img width="24" height="24" class="lazyload img-placeholder favicon"
|
||||
[src]="imageService.errorWebLinkImage"
|
||||
[attr.data-src]="imageService.getWebLinkImage(item)"
|
||||
(error)="imageService.updateErroredWebLinkImage($event)"
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
.favicon {
|
||||
border-radius: 5px;
|
||||
}
|
|
@ -201,7 +201,7 @@ export class FilterUtilitiesService {
|
|||
|
||||
if (sortFieldPart && isAscendingPart) {
|
||||
const sortField = parseInt(sortFieldPart.split('=')[1], 10) as SortField;
|
||||
const isAscending = isAscendingPart.split('=')[1] === 'true';
|
||||
const isAscending = isAscendingPart.split('=')[1].toLowerCase() === 'true';
|
||||
return {sortField, isAscending};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue