Implement support for comic book files (CBZ, CBR and CB7)
This commit is contained in:
committed by
Aditya Chandel
parent
25ee510379
commit
ff64362edb
@@ -128,6 +128,10 @@ export class BookService {
|
||||
const url = `/epub-viewer/book/${book.id}`;
|
||||
window.open(url, '_blank');
|
||||
this.updateLastReadTime(book.id);
|
||||
} else if (book.bookType === "CBX") {
|
||||
const url = `/cbx-viewer/book/${book.id}`;
|
||||
window.open(url, '_blank');
|
||||
this.updateLastReadTime(book.id);
|
||||
} else {
|
||||
console.error('Unsupported book type:', book.bookType);
|
||||
}
|
||||
@@ -207,6 +211,17 @@ export class BookService {
|
||||
return this.http.post<void>(`${this.url}/progress`, body);
|
||||
}
|
||||
|
||||
saveCbxProgress(bookId: number, page: number, percentage: number): Observable<void> {
|
||||
const body = {
|
||||
bookId: bookId,
|
||||
cbxProgress: {
|
||||
page: page,
|
||||
percentage: percentage
|
||||
}
|
||||
};
|
||||
return this.http.post<void>(`${this.url}/progress`, body);
|
||||
}
|
||||
|
||||
regenerateCovers(): Observable<void> {
|
||||
return this.http.post<void>(`${this.url}/regenerate-covers`, {});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import {API_CONFIG} from '../../config/api-config';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class CbxReaderService {
|
||||
|
||||
private readonly url = `${API_CONFIG.BASE_URL}/api/v1/cbx`;
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
getAvailablePages(bookId: number) {
|
||||
return this.http.get<number[]>(`${this.url}/${bookId}/pages`);
|
||||
}
|
||||
|
||||
getPageImageUrl(bookId: number, page: number): string {
|
||||
return `${this.url}/${bookId}/pages/${page}`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user