Skip to content

Commit

Permalink
FIX : AsuraScans domain as a setting (#6142)
Browse files Browse the repository at this point in the history
* FIX : AsuraScans  domain as a setting

* Asura change url often, so its now a setting
* Had to change AsuraScansTR so it extends Mangastream and not AsuraScans.

Because if you want to set URL as a setting in a connector that is extended by another connecor, you end up wiping user settings and bookmarks.

* fix lint
  • Loading branch information
MikeZeDev authored and Sheepux committed Jan 2, 2024
1 parent 85409d4 commit dbc7169
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
20 changes: 19 additions & 1 deletion src/web/mjs/connectors/AsuraScans.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,28 @@ export default class AsuraScans extends WordPressMangastream {
super.id = 'asurascans';
super.label = 'Asura Scans';
this.tags = ['webtoon', 'english'];
this.url = 'https://asura.gg';
this.path = '/manga/list-mode/';
this.queryPages = 'div#readerarea p img';
this.requestOptions.headers.set('x-user-agent', 'Mozilla/5.0 (Linux; Android 9; Pixel) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4026.0 Mobile Safari/537.36');
this.config = {
url: {
label: 'URL',
description: `This website change domains regularly.\nThis is the default URL which can also be manually set by the user.`,
input: 'text',
value: 'https://asura.nacm.xyz'
}
};
}

get url() {
return this.config.url.value;
}

set url(value) {
if (this.config && value) {
this.config.url.value = value;
Engine.Settings.save();
}
}

async _getPages(chapter) {
Expand Down
19 changes: 17 additions & 2 deletions src/web/mjs/connectors/AsuraScansTR.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
import AsuraScans from './AsuraScans.mjs';
import WordPressMangastream from './templates/WordPressMangastream.mjs';

export default class AsuraScansTR extends AsuraScans {
export default class AsuraScansTR extends WordPressMangastream {

constructor() {
super();
super.id = 'asurascans-tr';
super.label = 'Asura Scans (TR)';
this.tags = ['webtoon', 'turkish'];
this.url = 'https://asurascanstr.com';
this.path = '/manga/list-mode/';
this.queryPages = 'div#readerarea p img';
this.requestOptions.headers.set('x-user-agent', 'Mozilla/5.0 (Linux; Android 9; Pixel) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4026.0 Mobile Safari/537.36');
}

get icon() {
return '/img/connectors/asurascans';
}

async _getPages(chapter) {
const excludes = [
/panda_gif_large/i,
/2021\/04\/page100-10\.jpg/i,
/2021\/03\/20-ending-page-\.jpg/i,
/ENDING-PAGE/i
];
const images = await super._getPages(chapter);
return images.filter(link => !excludes.some(rgx => rgx.test(link)));
}

}

0 comments on commit dbc7169

Please sign in to comment.