-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.js
More file actions
41 lines (38 loc) · 1.8 KB
/
Copy pathconfig.js
File metadata and controls
41 lines (38 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Shared config for AnimePahe One-Click Downloader.
// Injected first into every content script AND importScripts()'d by the service worker,
// so it must stay DOM-free at top level (plain data only).
//
// All site-specific selectors live here: when animepahe / pahe.win / kwik change their
// markup, this is the ONLY file you need to edit.
globalThis.APD_CONFIG = {
// animepahe rotates TLDs; keep this in sync with manifest matches/host_permissions.
animepaheTlds: ['com', 'org', 'si', 'pw', 'ru', 'moe', 'ac', 'im'],
selectors: {
play: {
// Verified live: the "#pickDownload" dropdown holds <a class="dropdown-item"
// href="https://pahe.win/..."> options. We match on the href so we don't depend on the id.
option: 'a[href^="https://pahe.win/"]',
},
// pahe.win has no stable "continue" selector — its href is just the kwik URL, so content-pahe.js
// finds it by scanning anchors/scripts for `kwikRe` instead of a brittle class selector.
kwik: {
// Verified live: <form method="POST" action=".../d/<code>"> with a hidden _token and a
// <button type="submit">Download (NNN MB)</button>.
form: 'form',
submitBtn: 'button[type="submit"], form button',
tokenInput: 'input[name="_token"]',
},
},
// Matches a kwik file/download URL in either /f/ (file) or /d/ (download) form.
// Verified live against e.g. https://kwik.cx/f/t001hrrIKo6n
kwikRe: /https?:\/\/kwik\.(?:cx|si)\/[fd]\/[A-Za-z0-9_-]+/,
behavior: {
paheScanIntervalMs: 500,
paheMaxWaitMs: 20000,
kwikScanIntervalMs: 300,
kwikMaxWaitMs: 20000,
closeTabAfterMs: 8000, // fallback close for the helper tab if the completion signal is missed
overallTimeoutMs: 45000, // SW watchdog: reveal/clean up a stuck request after this long
revealTabOnFailure: true,
},
};