@@ -90,10 +90,7 @@ export class KomgaExtension implements IKomgaExtension {
9090 baseUrl : getKomgaBaseURL ( ) ,
9191 auth ( auth ) {
9292 const { username, password } = getKomgaCredentials ( )
93- console . log ( JSON . stringify ( auth ) )
94- console . log ( username )
95- console . log ( password )
96-
93+
9794 if ( auth . type == 'http' && auth . scheme == 'basic' ) {
9895 return `${ username } :${ password } `
9996 }
@@ -497,7 +494,7 @@ export class KomgaExtension implements IKomgaExtension {
497494 }
498495 }
499496 case 'continueReading' : {
500- const { data, error } = await getBooksList ( {
497+ const { data, error } = await getSeriesList ( {
501498 query : { sort : [ 'readProgress.readDate,desc' ] , page : metadata ?. page } ,
502499 body : {
503500 condition : {
@@ -513,13 +510,13 @@ export class KomgaExtension implements IKomgaExtension {
513510
514511 const items : DiscoverSectionItem [ ] = [ ]
515512 for ( const serie of data . content ?? [ ] ) {
516- const thumbnailUrl = `${ client . getConfig ( ) . baseUrl } /api/v1/books /${ serie . id } /thumbnail`
513+ const thumbnailUrl = `${ client . getConfig ( ) . baseUrl } /api/v1/series /${ serie . id } /thumbnail`
517514
518515 items . push ( {
519516 type : 'simpleCarouselItem' ,
520- title : serie . seriesTitle ,
517+ title : serie . name ,
521518 imageUrl : thumbnailUrl ,
522- mangaId : serie . seriesId ,
519+ mangaId : serie . id ,
523520 subtitle : undefined ,
524521 } )
525522 }
@@ -589,137 +586,3 @@ export class KomgaExtension implements IKomgaExtension {
589586 }
590587 }
591588}
592-
593- /*
594-
595- override async getHomePageSections(sectionCallback: (section: HomeSection) => void): Promise<void> {
596- // This function is called on the homepage and should not throw if the server is unavailable
597- // We won't use `await this.getKomgaAPI()` as we do not want to throw an error on
598- // the homepage when server settings are not set
599- const komgaAPI = await getKomgaAPI(this.stateManager)
600- const { showOnDeck, showContinueReading } = await getOptions(this.stateManager)
601- if (komgaAPI === null) {
602- console.log('searchRequest failed because server settings are unset')
603- const section = App.createHomeSection({
604- id: 'unset',
605- title: 'Go to source settings to set your Komga server credentials.',
606- items: getServerUnavailableMangaTiles(),
607- containsMoreItems: false,
608- type: 'singleRowNormal'
609- })
610- sectionCallback(section)
611- return
612- }
613- // The source define two homepage sections: new and latest
614- const sections = []
615- if (showOnDeck) {
616- sections.push(App.createHomeSection({
617- id: 'ondeck',
618- title: 'On Deck',
619- containsMoreItems: false,
620- type: 'singleRowNormal'
621- }))
622- }
623- if (showContinueReading) {
624- sections.push(App.createHomeSection({
625- id: 'continue',
626- title: 'Continue Reading',
627- containsMoreItems: false,
628- type: 'singleRowNormal'
629- }))
630- }
631- sections.push(App.createHomeSection({
632- id: 'new',
633- title: 'Recently added series',
634- containsMoreItems: true,
635- type: 'singleRowNormal'
636- }))
637- sections.push(App.createHomeSection({
638- id: 'updated',
639- title: 'Recently updated series',
640- containsMoreItems: true,
641- type: 'singleRowNormal'
642- }))
643- const promises: Promise<void>[] = []
644- for (const section of sections) {
645- // Let the app load empty tagSections
646- sectionCallback(section)
647- let apiPath: string, thumbPath: string, params: string, idProp: keyof BookDto
648- switch (section.id) {
649- case 'ondeck':
650- apiPath = `${komgaAPI}/books/${section.id}`
651- thumbPath = `${komgaAPI}/books`
652- params = '?page=0&size=20&deleted=false'
653- idProp = 'seriesId'
654- break
655- case 'continue':
656- apiPath = `${komgaAPI}/books`
657- thumbPath = `${komgaAPI}/books`
658- params = '?sort=readProgress.readDate,desc&read_status=IN_PROGRESS&page=0&size=20&deleted=false'
659- idProp = 'seriesId'
660- break
661- default:
662- apiPath = `${komgaAPI}/series/${section.id}`
663- thumbPath = `${komgaAPI}/series`
664- params = '?page=0&size=20&deleted=false'
665- idProp = 'id'
666- break
667- }
668- const request = App.createRequest({
669- url: apiPath,
670- param: params,
671- method: 'GET'
672- })
673- // Get the section data
674- promises.push((async () => {
675- const data = await this.requestManager.schedule(request, 1)
676- const result: PageBookDto = typeof data.data === 'string' ? JSON.parse(data.data) : data.data
677-
678- const tiles = []
679- if (!result.content) {
680- return
681- }
682-
683- for (const serie of result.content) {
684- tiles.push(App.createPartialSourceManga({
685- title: serie.metadata.title,
686- image: `${thumbPath}/${serie.id}/thumbnail`,
687- mangaId: serie[idProp],
688- subtitle: undefined
689- }))
690- }
691-
692- section.items = tiles
693- sectionCallback(section)
694- })())
695- }
696- // Make sure the function completes
697- await Promise.all(promises)
698- }
699- override async getViewMoreItems(homepageSectionId: string, metadata: any): Promise<PagedResults> {
700- const komgaAPI = await getKomgaAPI(this.stateManager)
701- const page: number = metadata?.page ?? 0
702- const request = App.createRequest({
703- url: `${komgaAPI}/series/${homepageSectionId}`,
704- param: `?page=${page}&size=${PAGE_SIZE}&deleted=false`,
705- method: 'GET'
706- })
707- const data = await this.requestManager.schedule(request, 1)
708- const result: PageBookDto = typeof data.data === 'string' ? JSON.parse(data.data) : data.data
709- const tiles: PartialSourceManga[] = []
710- for (const serie of result.content ?? []) {
711- tiles.push(App.createPartialSourceManga({
712- title: serie.metadata.title,
713- image: `${komgaAPI}/series/${serie.id}/thumbnail`,
714- mangaId: serie.id,
715- subtitle: undefined
716- }))
717- }
718- // If no series were returned we are on the last page
719- metadata = tiles.length === 0 ? undefined : { page: page + 1 }
720- return App.createPagedResults({
721- results: tiles,
722- metadata: metadata
723- })
724- }
725- */
0 commit comments