refactor: change ManhwaZ icon path

This commit is contained in:
xMohnad
2025-06-26 08:37:50 +00:00
parent a3b7a8f2ef
commit 227de96db1

View File

@@ -1,9 +1,10 @@
// prettier-ignore
const mangayomiSources = [{ const mangayomiSources = [{
"name": "ManhwaZ", "name": "ManhwaZ",
"lang": "en", "lang": "en",
"baseUrl": "https://manhwaz.com", "baseUrl": "https://manhwaz.com",
"apiUrl": "", "apiUrl": "",
"iconUrl": "https://manhwaz.com/favicon.ico", "iconUrl": "https://manhwaz.com/apple-touch-icon.png",
"typeSource": "single", "typeSource": "single",
"itemType": 0, "itemType": 0,
"version": "0.1.0", "version": "0.1.0",
@@ -14,8 +15,9 @@ const mangayomiSources = [{
class DefaultExtension extends MProvider { class DefaultExtension extends MProvider {
getHeaders(url) { getHeaders(url) {
return { return {
"Referer": this.source.baseUrl, 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" "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 // Check for next page
const hasNextPage = doc.selectFirst("ul.pager a[rel=next]") !== null; 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 // Helper method to get image URL with fallbacks
@@ -86,11 +88,17 @@ class DefaultExtension extends MProvider {
const statusLower = status?.toLowerCase() || ""; const statusLower = status?.toLowerCase() || "";
if (statusLower.includes("ongoing") || statusLower.includes("publishing")) { if (statusLower.includes("ongoing") || statusLower.includes("publishing")) {
return 0; return 0;
} else if (statusLower.includes("completed") || statusLower.includes("complete")) { } else if (
statusLower.includes("completed") ||
statusLower.includes("complete")
) {
return 1; return 1;
} else if (statusLower.includes("hiatus")) { } else if (statusLower.includes("hiatus")) {
return 2; return 2;
} else if (statusLower.includes("cancelled") || statusLower.includes("dropped")) { } else if (
statusLower.includes("cancelled") ||
statusLower.includes("dropped")
) {
return 3; return 3;
} else { } else {
return 5; // unknown return 5; // unknown
@@ -106,7 +114,9 @@ class DefaultExtension extends MProvider {
const now = new Date(); const now = new Date();
// Extract number and unit // 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) { if (!match) {
// Try to parse as regular date // Try to parse as regular date
const date = new Date(dateStr); const date = new Date(dateStr);
@@ -132,7 +142,7 @@ class DefaultExtension extends MProvider {
calendar.setDate(calendar.getDate() - value); calendar.setDate(calendar.getDate() - value);
break; break;
case "week": case "week":
calendar.setDate(calendar.getDate() - (value * 7)); calendar.setDate(calendar.getDate() - value * 7);
break; break;
case "month": case "month":
calendar.setMonth(calendar.getMonth() - value); calendar.setMonth(calendar.getMonth() - value);
@@ -180,8 +190,12 @@ class DefaultExtension extends MProvider {
// Process filters // Process filters
if (filters && filters.length > 0) { if (filters && filters.length > 0) {
const genreFilter = filters.find(f => f.type === "select" && f.name === "genre"); const genreFilter = filters.find(
const orderByFilter = filters.find(f => f.type === "select" && f.name === "orderby"); (f) => f.type === "select" && f.name === "genre",
);
const orderByFilter = filters.find(
(f) => f.type === "select" && f.name === "orderby",
);
if (genreFilter && genreFilter.state > 0) { if (genreFilter && genreFilter.state > 0) {
const selectedGenre = genreFilter.values[genreFilter.state]; const selectedGenre = genreFilter.values[genreFilter.state];
@@ -213,7 +227,9 @@ class DefaultExtension extends MProvider {
async getDetail(url) { async getDetail(url) {
// Ensure we have the full 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 res = await new Client().get(fullUrl, this.getHeaders());
const doc = new Document(res.body); const doc = new Document(res.body);
@@ -227,11 +243,15 @@ class DefaultExtension extends MProvider {
const imageUrl = imageElement ? this.getImageUrl(imageElement) : ""; const imageUrl = imageElement ? this.getImageUrl(imageElement) : "";
// Extract author // 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() || ""; const author = authorElement?.text?.trim() || "";
// Extract status // 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 statusText = statusElement?.text?.toLowerCase() || "";
const status = this.toStatus(statusText); const status = this.toStatus(statusText);
@@ -264,7 +284,7 @@ class DefaultExtension extends MProvider {
chapters.push({ chapters.push({
name: chapterName, name: chapterName,
url: chapterUrl, url: chapterUrl,
dateUpload dateUpload,
}); });
} }
} }
@@ -276,13 +296,15 @@ class DefaultExtension extends MProvider {
status, status,
author, author,
genre, genre,
chapters chapters,
}; };
} }
async getPageList(url) { async getPageList(url) {
// Ensure we have the full 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 res = await new Client().get(fullUrl, this.getHeaders());
const doc = new Document(res.body); const doc = new Document(res.body);
@@ -314,10 +336,10 @@ class DefaultExtension extends MProvider {
return [ return [
{ {
type: "header", 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", type: "select",
@@ -354,9 +376,9 @@ class DefaultExtension extends MProvider {
{ name: "Sports", value: "genre/sports" }, { name: "Sports", value: "genre/sports" },
{ name: "Supernatural", value: "genre/supernatural" }, { name: "Supernatural", value: "genre/supernatural" },
{ name: "Tragedy", value: "genre/tragedy" }, { name: "Tragedy", value: "genre/tragedy" },
{ name: "Webtoons", value: "genre/webtoons" } { name: "Webtoons", value: "genre/webtoons" },
], ],
state: 0 state: 0,
}, },
{ {
type: "select", type: "select",
@@ -366,10 +388,10 @@ class DefaultExtension extends MProvider {
{ name: "Latest", value: "latest" }, { name: "Latest", value: "latest" },
{ name: "Rating", value: "rating" }, { name: "Rating", value: "rating" },
{ name: "Most Views", value: "views" }, { name: "Most Views", value: "views" },
{ name: "New", value: "new" } { name: "New", value: "new" },
], ],
state: 0 state: 0,
} },
]; ];
} }