- Created .dockerignore and .gitignore files to exclude unnecessary files from Docker builds. - Added Dockerfile for multi-stage build setup, including dependencies and production environment configuration. - Introduced docker-compose.yml for service orchestration, including FlareSolverr and the main application. - Implemented core functionality for downloading manga chapters, including utilities for handling file paths and chapter metadata. - Added ESLint configuration for code quality and consistency. - Included JSDoc configuration for documentation generation. - Established initial package.json and package-lock.json with necessary dependencies for the project.
56 lines
2.0 KiB
JavaScript
56 lines
2.0 KiB
JavaScript
/**
|
|
* ManhwaSusu-specific URLs and DOM selectors. Adjust here if routes or markup change.
|
|
* @see https://manhwasusu.com/read/{slug}/ — series + chapter index
|
|
*/
|
|
|
|
/** Hostnames that this adapter is intended for (for friendly checks only). */
|
|
const MANHWASUSU_HOSTS = /** @type {const} */ (["manhwasusu.com", "www.manhwasusu.com"]);
|
|
|
|
/** Canonical site origin used as Referer for CDN panel downloads. */
|
|
const MANHWASUSU_ORIGIN = "https://manhwasusu.com/";
|
|
|
|
/** Default sample listing used by the fetch CLI when no URL is overridden. */
|
|
const DEFAULT_LISTING_URL = "https://manhwasusu.com/read/switch-on-season-2/";
|
|
|
|
/** Path shape: `/read/{seriesSlug}/chapter-{id}/` (SSR uses trailing slash optional). */
|
|
const CHAPTER_PATHNAME_PATTERN = /^\/read\/[^/]+\/chapter-[^/]+$/iu;
|
|
|
|
/**
|
|
* Reader lazily fills `src` from `data-src`; class `imgku` wraps panel images on chapter pages.
|
|
* @type {readonly [string, ...string[]]}
|
|
*/
|
|
const READER_IMG_SELECTORS = ["img.imgku"];
|
|
|
|
/**
|
|
* Browser-like headers for CDN image GETs (captured from manhwasusu.com reader → manhwature.com).
|
|
* Referer must be the site origin; chapter URLs are often rejected by the CDN.
|
|
* @type {Readonly<Record<string, string>>}
|
|
*/
|
|
const CDN_IMAGE_HEADERS = {
|
|
Accept: "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
|
|
"Accept-Language": "en-US,en;q=0.9,id;q=0.8",
|
|
"Cache-Control": "no-cache",
|
|
Pragma: "no-cache",
|
|
"Sec-CH-UA":
|
|
'"Chromium";v="146", "Not-A.Brand";v="24", "Microsoft Edge";v="146"',
|
|
"Sec-CH-UA-Mobile": "?0",
|
|
"Sec-CH-UA-Platform": '"Windows"',
|
|
"Sec-Fetch-Dest": "image",
|
|
"Sec-Fetch-Mode": "no-cors",
|
|
"Sec-Fetch-Site": "cross-site",
|
|
"Sec-Fetch-Storage-Access": "active",
|
|
Referer: MANHWASUSU_ORIGIN,
|
|
"User-Agent":
|
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " +
|
|
"(KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0",
|
|
};
|
|
|
|
module.exports = {
|
|
CDN_IMAGE_HEADERS,
|
|
CHAPTER_PATHNAME_PATTERN,
|
|
DEFAULT_LISTING_URL,
|
|
MANHWASUSU_HOSTS,
|
|
MANHWASUSU_ORIGIN,
|
|
READER_IMG_SELECTORS,
|
|
};
|