Skip to content

Commit

Permalink
AsuraScans | Fix image parsing for search and home sections
Browse files Browse the repository at this point in the history
  • Loading branch information
Seyden committed Aug 4, 2024
1 parent c7a1039 commit 30bd775
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/AsuraScans/AsuraScans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const ASURASCANS_DOMAIN = 'https://asuracomic.net'
const ASURASCANS_API_DOMAIN = 'https://gg.asuracomic.net'

export const AsuraScansInfo: SourceInfo = {
version: '4.1.5',
version: '4.1.6',
name: 'AsuraScans',
description: 'Extension that pulls manga from AsuraScans',
author: 'Seyden',
Expand Down Expand Up @@ -123,6 +123,12 @@ export class AsuraScans implements ChapterProviding, HomePageSectionsProviding,
request.url = simpleUrl.create(path)
}

if (path.host.includes(`localhost`)) {
const url: string = await this.getBaseUrl()
path.host = simpleUrl.parse(url, true).host
request.url = simpleUrl.create(path)
}

if (isImgLink(request.url)) {
let overrideUrl: string = await this.stateManager.retrieve('Domain')
if (overrideUrl && overrideUrl != this.baseUrl) {
Expand Down
6 changes: 3 additions & 3 deletions src/AsuraScans/AsuraScansParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class AsuraScansParser {
const covers = [comicObj.comic.cover]
const description = this.decodeHTMLEntity($('span.font-medium').text().trim().replace(/\\r\\n/gm, '\n'))
const rating = comicObj.comic.rating

const slug = comicObj.comic.slug?.trim()
if (slug) {
await source.setMangaSlug(mangaId, `series/${slug}`)
Expand Down Expand Up @@ -115,7 +115,7 @@ export class AsuraScansParser {
if (!mangaUrl) {
mangaUrl = await source.getMangaSlug(mangaId)
}

const chapters: Chapter[] = []
let sortingIndex = 0
for (const chapter of chaptersObj.chapters.reverse())
Expand Down Expand Up @@ -337,7 +337,7 @@ export class AsuraScansParser {

image = image?.split('?resize')[0] ?? ''

return encodeURI(decodeURI(this.decodeHTMLEntity(image?.trim() ?? '')))
return decodeURI(this.decodeHTMLEntity(image?.trim() ?? ''))
}

protected decodeHTMLEntity(str: string): string {
Expand Down

0 comments on commit 30bd775

Please sign in to comment.