Bookmark RBS + Dynamic PGO (#1503)

* Allow .NET to optimize code as it's running.

* Implemented the ability to restrict users Bookmark ability. By default, users will need to now opt-in to get bookmark roles.

* Fixed a tachiyomi progress syncing logic bug
This commit is contained in:
Joseph Milazzo 2022-09-02 11:40:52 -05:00 committed by GitHub
parent 30500a441c
commit 2283ae5d61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 75 additions and 28 deletions

View file

@ -58,6 +58,10 @@ export class AccountService implements OnDestroy {
return user && user.roles.includes('Download');
}
hasBookmarkRole(user: User) {
return user && user.roles.includes('Bookmark');
}
getRoles() {
return this.httpClient.get<string[]>(this.baseUrl + 'account/roles');
}

View file

@ -22,7 +22,7 @@
<div class="col-md-6 col-sm-12">
<div class="mb-3" style="width:100%">
<label for="email" class="form-label">Email</label>
<input class="form-control" type="email" id="email" formControlName="email" [disabled]="true">
<input class="form-control" type="email" id="email" formControlName="email">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="userForm.dirty || userForm.touched">
<div *ngIf="userForm.get('email')?.errors?.required">
This field is required

View file

@ -18,8 +18,7 @@
<i class="fa-regular fa-rectangle-list" aria-hidden="true"></i>
<span class="visually-hidden">Keyboard Shortcuts Modal</span>
</button>
<button *ngIf="!bookmarkMode" class="btn btn-icon btn-small" role="checkbox" [attr.aria-checked]="CurrentPageBookmarked"
<button *ngIf="!bookmarkMode && hasBookmarkRights" class="btn btn-icon btn-small" role="checkbox" [attr.aria-checked]="CurrentPageBookmarked"
title="{{CurrentPageBookmarked ? 'Unbookmark Page' : 'Bookmark Page'}}" (click)="bookmarkPage()">
<i class="{{CurrentPageBookmarked ? 'fa' : 'far'}} fa-bookmark" aria-hidden="true"></i>
<span class="visually-hidden">{{CurrentPageBookmarked ? 'Unbookmark Page' : 'Bookmark Page'}}</span>

View file

@ -122,6 +122,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
layoutModes = layoutModes;
isLoading = true;
hasBookmarkRights: boolean = false;
private ctx!: CanvasRenderingContext2D;
/**
@ -153,7 +154,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
* Responsible to hold current page -2 2. Used to know if we should render
* @remarks Used solely for LayoutMode.DoubleReverse rendering.
*/
canvasImageBehindBy2 = new Image();
canvasImageBehindBy2 = new Image();
/**
* Dictates if we use render with canvas or with image.
* @remarks This is only for Splitting.
@ -174,16 +175,16 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
/**
* An event emitter when a page change occurs. Used solely by the webtoon reader.
*/
goToPageEvent!: BehaviorSubject<number>;
goToPageEvent!: BehaviorSubject<number>;
/**
* An event emitter when a bookmark on a page change occurs. Used solely by the webtoon reader.
*/
showBookmarkEffectEvent: ReplaySubject<number> = new ReplaySubject<number>();
showBookmarkEffectEvent: ReplaySubject<number> = new ReplaySubject<number>();
/**
* An event emitter when fullscreen mode is toggled. Used solely by the webtoon reader.
*/
fullscreenEvent: ReplaySubject<boolean> = new ReplaySubject<boolean>();
fullscreenEvent: ReplaySubject<boolean> = new ReplaySubject<boolean>();
/**
* If the menu is open/visible.
*/
@ -467,6 +468,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
this.user = user;
this.hasBookmarkRights = this.accountService.hasBookmarkRole(user);
this.readingDirection = this.user.preferences.readingDirection;
this.scalingOption = this.user.preferences.scalingOption;
this.pageSplitOption = this.user.preferences.pageSplitOption;