mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 02:41:39 +00:00
refactor: change ManhwaZ icon path
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
// prettier-ignore
|
||||
const mangayomiSources = [{
|
||||
"name": "ManhwaZ",
|
||||
"lang": "en",
|
||||
"baseUrl": "https://manhwaz.com",
|
||||
"apiUrl": "",
|
||||
"iconUrl": "https://manhwaz.com/favicon.ico",
|
||||
"iconUrl": "https://manhwaz.com/apple-touch-icon.png",
|
||||
"typeSource": "single",
|
||||
"itemType": 0,
|
||||
"version": "0.1.0",
|
||||
@@ -14,8 +15,9 @@ const mangayomiSources = [{
|
||||
class DefaultExtension extends MProvider {
|
||||
getHeaders(url) {
|
||||
return {
|
||||
"Referer": this.source.baseUrl,
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
|
||||
Referer: this.source.baseUrl,
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -63,7 +65,7 @@ class DefaultExtension extends MProvider {
|
||||
// Check for next page
|
||||
const hasNextPage = doc.selectFirst("ul.pager a[rel=next]") !== null;
|
||||
|
||||
return { "list": list, hasNextPage };
|
||||
return { list: list, hasNextPage };
|
||||
}
|
||||
|
||||
// Helper method to get image URL with fallbacks
|
||||
@@ -86,11 +88,17 @@ class DefaultExtension extends MProvider {
|
||||
const statusLower = status?.toLowerCase() || "";
|
||||
if (statusLower.includes("ongoing") || statusLower.includes("publishing")) {
|
||||
return 0;
|
||||
} else if (statusLower.includes("completed") || statusLower.includes("complete")) {
|
||||
} else if (
|
||||
statusLower.includes("completed") ||
|
||||
statusLower.includes("complete")
|
||||
) {
|
||||
return 1;
|
||||
} else if (statusLower.includes("hiatus")) {
|
||||
return 2;
|
||||
} else if (statusLower.includes("cancelled") || statusLower.includes("dropped")) {
|
||||
} else if (
|
||||
statusLower.includes("cancelled") ||
|
||||
statusLower.includes("dropped")
|
||||
) {
|
||||
return 3;
|
||||
} else {
|
||||
return 5; // unknown
|
||||
@@ -106,7 +114,9 @@ class DefaultExtension extends MProvider {
|
||||
const now = new Date();
|
||||
|
||||
// Extract number and unit
|
||||
const match = lowerDateStr.match(/(\d+)\s*(second|minute|hour|day|week|month|year)s?\s*ago/);
|
||||
const match = lowerDateStr.match(
|
||||
/(\d+)\s*(second|minute|hour|day|week|month|year)s?\s*ago/,
|
||||
);
|
||||
if (!match) {
|
||||
// Try to parse as regular date
|
||||
const date = new Date(dateStr);
|
||||
@@ -132,7 +142,7 @@ class DefaultExtension extends MProvider {
|
||||
calendar.setDate(calendar.getDate() - value);
|
||||
break;
|
||||
case "week":
|
||||
calendar.setDate(calendar.getDate() - (value * 7));
|
||||
calendar.setDate(calendar.getDate() - value * 7);
|
||||
break;
|
||||
case "month":
|
||||
calendar.setMonth(calendar.getMonth() - value);
|
||||
@@ -180,8 +190,12 @@ class DefaultExtension extends MProvider {
|
||||
|
||||
// Process filters
|
||||
if (filters && filters.length > 0) {
|
||||
const genreFilter = filters.find(f => f.type === "select" && f.name === "genre");
|
||||
const orderByFilter = filters.find(f => f.type === "select" && f.name === "orderby");
|
||||
const genreFilter = filters.find(
|
||||
(f) => f.type === "select" && f.name === "genre",
|
||||
);
|
||||
const orderByFilter = filters.find(
|
||||
(f) => f.type === "select" && f.name === "orderby",
|
||||
);
|
||||
|
||||
if (genreFilter && genreFilter.state > 0) {
|
||||
const selectedGenre = genreFilter.values[genreFilter.state];
|
||||
@@ -213,7 +227,9 @@ class DefaultExtension extends MProvider {
|
||||
|
||||
async getDetail(url) {
|
||||
// Ensure we have the full URL
|
||||
const fullUrl = url.startsWith("http") ? url : `${this.source.baseUrl}${url}`;
|
||||
const fullUrl = url.startsWith("http")
|
||||
? url
|
||||
: `${this.source.baseUrl}${url}`;
|
||||
const res = await new Client().get(fullUrl, this.getHeaders());
|
||||
const doc = new Document(res.body);
|
||||
|
||||
@@ -227,11 +243,15 @@ class DefaultExtension extends MProvider {
|
||||
const imageUrl = imageElement ? this.getImageUrl(imageElement) : "";
|
||||
|
||||
// Extract author
|
||||
const authorElement = doc.selectFirst("div.post-content_item .summary-heading:contains(Author) + .summary-content");
|
||||
const authorElement = doc.selectFirst(
|
||||
"div.post-content_item .summary-heading:contains(Author) + .summary-content",
|
||||
);
|
||||
const author = authorElement?.text?.trim() || "";
|
||||
|
||||
// Extract status
|
||||
const statusElement = doc.selectFirst("div.summary-heading:contains(status) + div.summary-content");
|
||||
const statusElement = doc.selectFirst(
|
||||
"div.summary-heading:contains(status) + div.summary-content",
|
||||
);
|
||||
const statusText = statusElement?.text?.toLowerCase() || "";
|
||||
const status = this.toStatus(statusText);
|
||||
|
||||
@@ -264,7 +284,7 @@ class DefaultExtension extends MProvider {
|
||||
chapters.push({
|
||||
name: chapterName,
|
||||
url: chapterUrl,
|
||||
dateUpload
|
||||
dateUpload,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -276,13 +296,15 @@ class DefaultExtension extends MProvider {
|
||||
status,
|
||||
author,
|
||||
genre,
|
||||
chapters
|
||||
chapters,
|
||||
};
|
||||
}
|
||||
|
||||
async getPageList(url) {
|
||||
// Ensure we have the full URL
|
||||
const fullUrl = url.startsWith("http") ? url : `${this.source.baseUrl}${url}`;
|
||||
const fullUrl = url.startsWith("http")
|
||||
? url
|
||||
: `${this.source.baseUrl}${url}`;
|
||||
const res = await new Client().get(fullUrl, this.getHeaders());
|
||||
const doc = new Document(res.body);
|
||||
|
||||
@@ -314,10 +336,10 @@ class DefaultExtension extends MProvider {
|
||||
return [
|
||||
{
|
||||
type: "header",
|
||||
name: "Note: Filters only work when search query is empty"
|
||||
name: "Note: Filters only work when search query is empty",
|
||||
},
|
||||
{
|
||||
type: "separator"
|
||||
type: "separator",
|
||||
},
|
||||
{
|
||||
type: "select",
|
||||
@@ -354,9 +376,9 @@ class DefaultExtension extends MProvider {
|
||||
{ name: "Sports", value: "genre/sports" },
|
||||
{ name: "Supernatural", value: "genre/supernatural" },
|
||||
{ name: "Tragedy", value: "genre/tragedy" },
|
||||
{ name: "Webtoons", value: "genre/webtoons" }
|
||||
{ name: "Webtoons", value: "genre/webtoons" },
|
||||
],
|
||||
state: 0
|
||||
state: 0,
|
||||
},
|
||||
{
|
||||
type: "select",
|
||||
@@ -366,10 +388,10 @@ class DefaultExtension extends MProvider {
|
||||
{ name: "Latest", value: "latest" },
|
||||
{ name: "Rating", value: "rating" },
|
||||
{ name: "Most Views", value: "views" },
|
||||
{ name: "New", value: "new" }
|
||||
{ name: "New", value: "new" },
|
||||
],
|
||||
state: 0
|
||||
}
|
||||
state: 0,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user