Feature/999 add high resolution cover support upload storage and search (#1006)

* Add high-resolution cover support: upload, storage, and search

* Disable tests until fixed
This commit is contained in:
Aditya Chandel
2025-08-27 21:47:27 -06:00
committed by GitHub
parent b4978f3bd7
commit 09bc2f6e9e
102 changed files with 1496 additions and 800 deletions
@@ -1,19 +1,30 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Injectable, inject} from '@angular/core';
import {API_CONFIG} from '../../config/api-config';
import {AuthService} from '../../core/service/auth.service';
@Injectable({ providedIn: 'root' })
@Injectable({providedIn: 'root'})
export class CbxReaderService {
private readonly url = `${API_CONFIG.BASE_URL}/api/v1/cbx`;
private readonly pagesUrl = `${API_CONFIG.BASE_URL}/api/v1/cbx`;
private readonly imageUrl = `${API_CONFIG.BASE_URL}/api/v1/media/book`;
private authService = inject(AuthService);
private http = inject(HttpClient);
constructor(private http: HttpClient) {}
private getToken(): string | null {
return this.authService.getOidcAccessToken() || this.authService.getInternalAccessToken();
}
private appendToken(url: string): string {
const token = this.getToken();
return token ? `${url}${url.includes('?') ? '&' : '?'}token=${token}` : url;
}
getAvailablePages(bookId: number) {
return this.http.get<number[]>(`${this.url}/${bookId}/pages`);
return this.http.get<number[]>(this.appendToken(`${this.pagesUrl}/${bookId}/pages`));
}
getPageImageUrl(bookId: number, page: number): string {
return `${this.url}/${bookId}/pages/${page}`;
return this.appendToken(`${this.imageUrl}/${bookId}/cbx/pages/${page}`);
}
}
@@ -1,21 +1,32 @@
import { Injectable } from '@angular/core';
import {Injectable, inject} from '@angular/core';
import {API_CONFIG} from '../../config/api-config';
import {HttpClient} from '@angular/common/http';
import {AuthService} from '../../core/service/auth.service';
@Injectable({
providedIn: 'root'
})
export class NewPdfReaderService {
private readonly url = `${API_CONFIG.BASE_URL}/api/v1/pdf`;
private readonly pagesUrl = `${API_CONFIG.BASE_URL}/api/v1/pdf`;
private readonly imageUrl = `${API_CONFIG.BASE_URL}/api/v1/media/book`;
private authService = inject(AuthService);
private http = inject(HttpClient);
constructor(private http: HttpClient) {}
private getToken(): string | null {
return this.authService.getOidcAccessToken() || this.authService.getInternalAccessToken();
}
private appendToken(url: string): string {
const token = this.getToken();
return token ? `${url}${url.includes('?') ? '&' : '?'}token=${token}` : url;
}
getAvailablePages(bookId: number) {
return this.http.get<number[]>(`${this.url}/${bookId}/pages`);
return this.http.get<number[]>(this.appendToken(`${this.pagesUrl}/${bookId}/pages`));
}
getPageImageUrl(bookId: number, page: number): string {
return `${this.url}/${bookId}/pages/${page}`;
return this.appendToken(`${this.imageUrl}/${bookId}/pdf/pages/${page}`);
}
}