mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-02 21:24:18 -04:00
v0.4.4 polishing (#515)
* Fixed a bad comparision between JsonElement and null. * Removed console.logs. Fixed bug in edit collection detail page where summary wouldn't update after editing it. * Removed a UI package that is no longer used. Fixed an issue where MarkVolumeAsUnread was using an old set of APIs and now uses the new, faster API.
This commit is contained in:
parent
9568d9b2e5
commit
e479f17aa6
@ -217,7 +217,7 @@ namespace API.Controllers
|
|||||||
foreach (var chapter in chapters)
|
foreach (var chapter in chapters)
|
||||||
{
|
{
|
||||||
user.Progresses ??= new List<AppUserProgress>();
|
user.Progresses ??= new List<AppUserProgress>();
|
||||||
var userProgress = user.Progresses.SingleOrDefault(x => x.ChapterId == chapter.Id && x.AppUserId == user.Id);
|
var userProgress = user.Progresses.FirstOrDefault(x => x.ChapterId == chapter.Id && x.AppUserId == user.Id);
|
||||||
|
|
||||||
if (userProgress == null)
|
if (userProgress == null)
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,6 @@ namespace Kavita.Common
|
|||||||
var json = File.ReadAllText(filePath);
|
var json = File.ReadAllText(filePath);
|
||||||
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
||||||
const string key = "TokenKey";
|
const string key = "TokenKey";
|
||||||
if (jsonObj == null) return string.Empty;
|
|
||||||
|
|
||||||
if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
|
if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
|
||||||
{
|
{
|
||||||
@ -136,7 +135,6 @@ namespace Kavita.Common
|
|||||||
var json = File.ReadAllText(filePath);
|
var json = File.ReadAllText(filePath);
|
||||||
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
||||||
const string key = "Port";
|
const string key = "Port";
|
||||||
if (jsonObj == null) return defaultPort;
|
|
||||||
|
|
||||||
if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
|
if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
|
||||||
{
|
{
|
||||||
@ -176,7 +174,6 @@ namespace Kavita.Common
|
|||||||
{
|
{
|
||||||
var json = File.ReadAllText(filePath);
|
var json = File.ReadAllText(filePath);
|
||||||
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
||||||
if (jsonObj == null) return string.Empty;
|
|
||||||
|
|
||||||
if (jsonObj.TryGetProperty("Logging", out JsonElement tokenElement))
|
if (jsonObj.TryGetProperty("Logging", out JsonElement tokenElement))
|
||||||
{
|
{
|
||||||
@ -212,7 +209,6 @@ namespace Kavita.Common
|
|||||||
var json = File.ReadAllText(filePath);
|
var json = File.ReadAllText(filePath);
|
||||||
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
||||||
const string key = "Branch";
|
const string key = "Branch";
|
||||||
if (jsonObj == null) return string.Empty;
|
|
||||||
|
|
||||||
if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
|
if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
|
||||||
{
|
{
|
||||||
|
5
UI/Web/package-lock.json
generated
5
UI/Web/package-lock.json
generated
@ -10673,11 +10673,6 @@
|
|||||||
"tslib": "^2.0.0"
|
"tslib": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ng-sidebar": {
|
|
||||||
"version": "9.4.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/ng-sidebar/-/ng-sidebar-9.4.2.tgz",
|
|
||||||
"integrity": "sha512-8KmEQYFhn4S5LDjRDXBhDfCgLchJEj+ClBdiTCAQoRjX8vdh85hmKIGN7aBsh1HNOXKN3rzDu0qmd90193/P3Q=="
|
|
||||||
},
|
|
||||||
"ngx-file-drop": {
|
"ngx-file-drop": {
|
||||||
"version": "11.1.0",
|
"version": "11.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/ngx-file-drop/-/ngx-file-drop-11.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/ngx-file-drop/-/ngx-file-drop-11.1.0.tgz",
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
"lazysizes": "^5.3.2",
|
"lazysizes": "^5.3.2",
|
||||||
"ng-circle-progress": "^1.6.0",
|
"ng-circle-progress": "^1.6.0",
|
||||||
"ng-lazyload-image": "^9.1.0",
|
"ng-lazyload-image": "^9.1.0",
|
||||||
"ng-sidebar": "^9.4.2",
|
|
||||||
"ngx-file-drop": "^11.1.0",
|
"ngx-file-drop": "^11.1.0",
|
||||||
"ngx-toastr": "^13.2.1",
|
"ngx-toastr": "^13.2.1",
|
||||||
"rxjs": "~6.6.0",
|
"rxjs": "~6.6.0",
|
||||||
|
@ -156,7 +156,7 @@ export class ActionService implements OnDestroy {
|
|||||||
* @param callback Optional callback to perform actions after API completes
|
* @param callback Optional callback to perform actions after API completes
|
||||||
*/
|
*/
|
||||||
markVolumeAsUnread(seriesId: number, volume: Volume, callback?: VolumeActionCallback) {
|
markVolumeAsUnread(seriesId: number, volume: Volume, callback?: VolumeActionCallback) {
|
||||||
forkJoin(volume.chapters?.map(chapter => this.readerService.saveProgress(seriesId, volume.id, chapter.id, 0))).pipe(takeUntil(this.onDestroy)).subscribe(results => {
|
this.readerService.markVolumeRead(seriesId, volume.id).subscribe(() => {
|
||||||
volume.pagesRead = 0;
|
volume.pagesRead = 0;
|
||||||
volume.chapters?.forEach(c => c.pagesRead = 0);
|
volume.chapters?.forEach(c => c.pagesRead = 0);
|
||||||
this.toastr.success('Marked as Unread');
|
this.toastr.success('Marked as Unread');
|
||||||
|
@ -41,7 +41,7 @@ export class MessageHubService {
|
|||||||
.catch(err => console.error(err));
|
.catch(err => console.error(err));
|
||||||
|
|
||||||
this.hubConnection.on('receiveMessage', body => {
|
this.hubConnection.on('receiveMessage', body => {
|
||||||
console.log('[Hub] Body: ', body);
|
//console.log('[Hub] Body: ', body);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.hubConnection.on(EVENTS.UpdateAvailable, resp => {
|
this.hubConnection.on(EVENTS.UpdateAvailable, resp => {
|
||||||
|
@ -94,12 +94,12 @@ export class CoverImageChooserComponent implements OnInit, OnDestroy {
|
|||||||
if (url && url != '') {
|
if (url && url != '') {
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.crossOrigin = 'Anonymous';
|
img.crossOrigin = 'Anonymous';
|
||||||
img.src = this.form.get('coverImageUrl')?.value;
|
|
||||||
img.onload = (e) => this.handleUrlImageAdd(e);
|
img.onload = (e) => this.handleUrlImageAdd(e);
|
||||||
img.onerror = (e) => {
|
img.onerror = (e) => {
|
||||||
this.toastr.error('The image could not be fetched due to server refusing request. Please download and upload from file instead.');
|
this.toastr.error('The image could not be fetched due to server refusing request. Please download and upload from file instead.');
|
||||||
this.form.get('coverImageUrl')?.setValue('');
|
this.form.get('coverImageUrl')?.setValue('');
|
||||||
}
|
};
|
||||||
|
img.src = this.form.get('coverImageUrl')?.value;
|
||||||
this.form.get('coverImageUrl')?.setValue('');
|
this.form.get('coverImageUrl')?.setValue('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,7 +135,6 @@ export class CoverImageChooserComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleUrlImageAdd(e: any) {
|
handleUrlImageAdd(e: any) {
|
||||||
console.log(e);
|
|
||||||
if (e.path === null || e.path.length === 0) return;
|
if (e.path === null || e.path.length === 0) return;
|
||||||
|
|
||||||
const url = this.getBase64Image(e.path[0]);
|
const url = this.getBase64Image(e.path[0]);
|
||||||
|
@ -56,25 +56,29 @@ export class CollectionDetailComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const tagId = parseInt(routeId, 10);
|
const tagId = parseInt(routeId, 10);
|
||||||
this.collectionService.allTags().subscribe(tags => {
|
this.updateTag(tagId);
|
||||||
this.collections = tags;
|
|
||||||
const matchingTags = this.collections.filter(t => t.id === tagId);
|
|
||||||
if (matchingTags.length === 0) {
|
|
||||||
this.toastr.error('You don\'t have access to any libraries this tag belongs to or this tag is invalid');
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.collectionTag = matchingTags[0];
|
|
||||||
this.tagImage = this.imageService.randomize(this.imageService.getCollectionCoverImage(this.collectionTag.id));
|
|
||||||
this.titleService.setTitle('Kavita - ' + this.collectionTag.title + ' Collection');
|
|
||||||
this.loadPage();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.collectionTagActions = this.actionFactoryService.getCollectionTagActions(this.handleCollectionActionCallback.bind(this));
|
this.collectionTagActions = this.actionFactoryService.getCollectionTagActions(this.handleCollectionActionCallback.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateTag(tagId: number) {
|
||||||
|
this.collectionService.allTags().subscribe(tags => {
|
||||||
|
this.collections = tags;
|
||||||
|
const matchingTags = this.collections.filter(t => t.id === tagId);
|
||||||
|
if (matchingTags.length === 0) {
|
||||||
|
this.toastr.error('You don\'t have access to any libraries this tag belongs to or this tag is invalid');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.collectionTag = matchingTags[0];
|
||||||
|
this.tagImage = this.imageService.randomize(this.imageService.getCollectionCoverImage(this.collectionTag.id));
|
||||||
|
this.titleService.setTitle('Kavita - ' + this.collectionTag.title + ' Collection');
|
||||||
|
this.loadPage();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onPageChange(pagination: Pagination) {
|
onPageChange(pagination: Pagination) {
|
||||||
this.router.navigate(['collections', this.collectionTag.id], {replaceUrl: true, queryParamsHandling: 'merge', queryParams: {page: this.seriesPagination.currentPage} });
|
this.router.navigate(['collections', this.collectionTag.id], {replaceUrl: true, queryParamsHandling: 'merge', queryParams: {page: this.seriesPagination.currentPage} });
|
||||||
}
|
}
|
||||||
@ -120,6 +124,7 @@ export class CollectionDetailComponent implements OnInit {
|
|||||||
const modalRef = this.modalService.open(EditCollectionTagsComponent, { size: 'lg', scrollable: true });
|
const modalRef = this.modalService.open(EditCollectionTagsComponent, { size: 'lg', scrollable: true });
|
||||||
modalRef.componentInstance.tag = this.collectionTag;
|
modalRef.componentInstance.tag = this.collectionTag;
|
||||||
modalRef.closed.subscribe((results: {success: boolean, coverImageUpdated: boolean}) => {
|
modalRef.closed.subscribe((results: {success: boolean, coverImageUpdated: boolean}) => {
|
||||||
|
this.updateTag(this.collectionTag.id);
|
||||||
this.loadPage();
|
this.loadPage();
|
||||||
if (results.coverImageUpdated) {
|
if (results.coverImageUpdated) {
|
||||||
this.tagImage = this.imageService.randomize(this.imageService.getCollectionCoverImage(collectionTag.id));
|
this.tagImage = this.imageService.randomize(this.imageService.getCollectionCoverImage(collectionTag.id));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user