Bugfixes from last PR (#1928)

* Fixed a regression where confirm-email was validating for a real email when it's not required.

* Fixed fit to screen breaking as canvas was still showing on the screen when it should have been hidden.

* Fixed a missing age rating in the pipe

* Fixed fit to height not properly aligning the image

* Tweaked Startup check for base url
This commit is contained in:
Joe Milazzo 2023-04-15 06:58:54 -05:00 committed by GitHub
parent 2b1570b144
commit 10e4b318cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 41 additions and 37 deletions

View File

@ -1,9 +1,5 @@
namespace API.Errors; namespace API.Errors;
public record ApiException #nullable enable
{ public record ApiException(int Status, string? Message = null, string? Details = null);
public ApiException(int status, string? message = null, string? details = null) #nullable disable
{
}
}

View File

@ -401,7 +401,7 @@ public class Startup
} }
catch (Exception ex) catch (Exception ex)
{ {
if (ex.Message.Contains("Permission denied") && baseUrl.Equals(Configuration.DefaultBaseUrl) && new OsInfo().IsDocker) if ((ex.Message.Contains("Permission denied") || ex.Message.Contains("UnauthorizedAccessException")) && baseUrl.Equals(Configuration.DefaultBaseUrl) && new OsInfo().IsDocker)
{ {
// Swallow the exception as the install is non-root and Docker // Swallow the exception as the install is non-root and Docker
return; return;

View File

@ -2,5 +2,5 @@
"TokenKey": "super secret unguessable key", "TokenKey": "super secret unguessable key",
"Port": 5000, "Port": 5000,
"IpAddresses": "", "IpAddresses": "",
"BaseUrl": "/test/" "BaseUrl": "/"
} }

View File

@ -16,7 +16,7 @@ public class OsInfo : IOsInfo
public static bool IsWindows => Os == Os.Windows; public static bool IsWindows => Os == Os.Windows;
// this needs to not be static so we can mock it // this needs to not be static so we can mock it
public bool IsDocker { get; } public bool IsDocker { get; private set; }
public string Version { get; } public string Version { get; }
public string Name { get; } public string Name { get; }
@ -41,7 +41,6 @@ public class OsInfo : IOsInfo
break; break;
} }
} }
} }
public OsInfo(IEnumerable<IOsVersionAdapter> versionAdapters) public OsInfo(IEnumerable<IOsVersionAdapter> versionAdapters)

View File

@ -14,7 +14,7 @@ img {
} }
&.full-height { &.full-height {
height: calc(100vh - $scrollbarHeight); height: calc(100vh); // We need to - $scrollbarHeight when there is a horizontal scroll on macos
display: flex; display: flex;
align-content: center; align-content: center;
} }

View File

@ -1,13 +0,0 @@
import { DetailsVersion } from "./details-version";
export interface ClientInfo {
os: DetailsVersion,
browser: DetailsVersion,
platformType: string,
kavitaUiVersion: string,
screenResolution: string;
usingDarkTheme: boolean;
collectedAt?: Date;
}

View File

@ -1,4 +0,0 @@
export interface DetailsVersion {
name: string;
version: string;
}

View File

@ -67,7 +67,8 @@ export class ManageEmailSettingsComponent implements OnInit {
} }
testEmailServiceUrl() { testEmailServiceUrl() {
this.settingsService.testEmailServerSettings(this.settingsForm.get('emailServiceUrl')?.value || '').pipe(take(1)).subscribe(async (result: EmailTestResult) => { if (this.settingsForm.get('emailServiceUrl')?.value === '') return;
this.settingsService.testEmailServerSettings(this.settingsForm.get('emailServiceUrl')?.value).pipe(take(1)).subscribe(async (result: EmailTestResult) => {
if (result.successful) { if (result.successful) {
this.toastr.success('Email Service was reachable'); this.toastr.success('Email Service was reachable');
} else { } else {

View File

@ -8,6 +8,8 @@ import { ReaderSetting } from '../../_models/reader-setting';
import { ImageRenderer } from '../../_models/renderer'; import { ImageRenderer } from '../../_models/renderer';
import { ManagaReaderService } from '../../_series/managa-reader.service'; import { ManagaReaderService } from '../../_series/managa-reader.service';
const ValidSplits = [PageSplitOption.SplitLeftToRight, PageSplitOption.SplitRightToLeft];
@Component({ @Component({
selector: 'app-canvas-renderer', selector: 'app-canvas-renderer',
templateUrl: './canvas-renderer.component.html', templateUrl: './canvas-renderer.component.html',
@ -179,9 +181,15 @@ export class CanvasRendererComponent implements OnInit, AfterViewInit, OnDestroy
this.canvasImage = img[0]; this.canvasImage = img[0];
this.cdRef.markForCheck(); this.cdRef.markForCheck();
if (this.layoutMode !== LayoutMode.Single || !ValidSplits.includes(this.pageSplit)) {
return;
}
const needsSplitting = this.updateSplitPage(); const needsSplitting = this.updateSplitPage();
if (!needsSplitting) return; if (!needsSplitting) return;
// This is toggling true when manga reader shouldn't use this code
this.renderWithCanvas = true; this.renderWithCanvas = true;
if (this.currentImageSplitPart === SPLIT_PAGE_PART.NO_SPLIT) return; if (this.currentImageSplitPart === SPLIT_PAGE_PART.NO_SPLIT) return;

View File

@ -1,6 +1,6 @@
<ng-container *ngIf="isValid() && !this.mangaReaderService.shouldSplit(this.currentImage, this.pageSplit)"> <ng-container *ngIf="isValid() && !this.mangaReaderService.shouldSplit(this.currentImage, this.pageSplit)">
<div class="image-container {{imageFitClass$ | async}}" <div class="image-container {{imageFitClass$ | async}}"
[style.filter]="(darkenss$ | async) ?? '' | safeStyle"> [style.filter]="(darkenss$ | async) ?? '' | safeStyle" [style.height]="(imageContainerHeight$ | async) ?? '' | safeStyle">
<ng-container *ngIf="currentImage"> <ng-container *ngIf="currentImage">
<img alt=" " <img alt=" "
#image [src]="currentImage.src" #image [src]="currentImage.src"

View File

@ -27,6 +27,7 @@ export class SingleRendererComponent implements OnInit, OnDestroy, ImageRenderer
@Output() imageHeight: EventEmitter<number> = new EventEmitter<number>(); @Output() imageHeight: EventEmitter<number> = new EventEmitter<number>();
imageFitClass$!: Observable<string>; imageFitClass$!: Observable<string>;
imageContainerHeight$!: Observable<string>;
showClickOverlayClass$!: Observable<string>; showClickOverlayClass$!: Observable<string>;
readerModeClass$!: Observable<string>; readerModeClass$!: Observable<string>;
darkenss$: Observable<string> = of('brightness(100%)'); darkenss$: Observable<string> = of('brightness(100%)');
@ -43,7 +44,7 @@ export class SingleRendererComponent implements OnInit, OnDestroy, ImageRenderer
get LayoutMode() {return LayoutMode;} get LayoutMode() {return LayoutMode;}
constructor(private readonly cdRef: ChangeDetectorRef, public mangaReaderService: ManagaReaderService, constructor(private readonly cdRef: ChangeDetectorRef, public mangaReaderService: ManagaReaderService,
@Inject(DOCUMENT) private document: Document, private readerService: ReaderService) { } @Inject(DOCUMENT) private document: Document) { }
ngOnInit(): void { ngOnInit(): void {
this.readerModeClass$ = this.readerSettings$.pipe( this.readerModeClass$ = this.readerSettings$.pipe(
@ -53,13 +54,28 @@ export class SingleRendererComponent implements OnInit, OnDestroy, ImageRenderer
takeUntil(this.onDestroy) takeUntil(this.onDestroy)
); );
this.imageContainerHeight$ = this.readerSettings$.pipe(
map(values => values.fitting),
map(mode => {
if ( mode !== FITTING_OPTION.HEIGHT) return '';
const readingArea = this.document.querySelector('.reading-area');
if (!readingArea) return 'calc(100vh)';
if (this.currentImage.width - readingArea.scrollWidth > 0) {
return 'calc(100vh - 34px)'
}
return 'calc(100vh)'
}),
filter(_ => this.isValid()),
takeUntil(this.onDestroy)
);
this.pageNum$.pipe( this.pageNum$.pipe(
takeUntil(this.onDestroy), takeUntil(this.onDestroy),
tap(pageInfo => { tap(pageInfo => {
this.pageNum = pageInfo.pageNum; this.pageNum = pageInfo.pageNum;
this.maxPages = pageInfo.maxPages; this.maxPages = pageInfo.maxPages;
// TODO: Put this here this.currentImage = this.getPagez
}), }),
).subscribe(() => {}); ).subscribe(() => {});

View File

@ -26,7 +26,8 @@ export class AgeRatingPipe implements PipeTransform {
case AgeRating.G: return of('G'); case AgeRating.G: return of('G');
case AgeRating.KidsToAdults: return of('Kids to Adults'); case AgeRating.KidsToAdults: return of('Kids to Adults');
case AgeRating.Mature: return of('Mature'); case AgeRating.Mature: return of('Mature');
case AgeRating.Mature17Plus: return of('M'); case AgeRating.Mature15Plus: return of('MA15+');
case AgeRating.Mature17Plus: return of('Mature 17+');
case AgeRating.RatingPending: return of('Rating Pending'); case AgeRating.RatingPending: return of('Rating Pending');
case AgeRating.Teen: return of('Teen'); case AgeRating.Teen: return of('Teen');
case AgeRating.X18Plus: return of('X18+'); case AgeRating.X18Plus: return of('X18+');

View File

@ -19,7 +19,7 @@ export class ConfirmEmailComponent {
token: string = ''; token: string = '';
registerForm: FormGroup = new FormGroup({ registerForm: FormGroup = new FormGroup({
email: new FormControl('', [Validators.required, Validators.email]), email: new FormControl('', [Validators.required]),
username: new FormControl('', [Validators.required]), username: new FormControl('', [Validators.required]),
password: new FormControl('', [Validators.required, Validators.maxLength(32), Validators.minLength(6), Validators.pattern("^.{6,32}$")]), password: new FormControl('', [Validators.required, Validators.maxLength(32), Validators.minLength(6), Validators.pattern("^.{6,32}$")]),
}); });

View File

@ -7,7 +7,7 @@
"name": "GPL-3.0", "name": "GPL-3.0",
"url": "https://github.com/Kareadita/Kavita/blob/develop/LICENSE" "url": "https://github.com/Kareadita/Kavita/blob/develop/LICENSE"
}, },
"version": "0.7.1.34" "version": "0.7.1.35"
}, },
"servers": [ "servers": [
{ {