Skip to content

Commit

Permalink
forzar modo oscuro en nuevo frontend de wuolah y fix a pro
Browse files Browse the repository at this point in the history
  • Loading branch information
pablouser1 committed Jun 3, 2024
1 parent a38e9a1 commit 4e5df69
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "wuolahextra",
"displayName": "WuolahExtra",
"description": "UserScript para Wuolah",
"version": "1.5.2",
"version": "1.5.3",
"homepage": "https://github.com/pablouser1/WuolahExtra",
"license": "MIT",
"author": "Pablo Ferreiro",
Expand Down
33 changes: 30 additions & 3 deletions src/constants/Hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ export default class Hooks {
endpoint: /^\/v2\/me$/,
func: Hooks.makePro,
},
{
id: "force-dark",
endpoint: /^\/v2\/user-preferences\/me$/,
func: Hooks.forceDark,
cond: () => GM_config.get("force_dark"),
},
{
id: "no-ui-ads",
endpoint: /^\/v2\/a-d-s$/,
Expand Down Expand Up @@ -59,7 +65,9 @@ export default class Hooks {

// -- After -- //
/**
* Reemplaza solicitud de /me y hacer al usuario pro
* Reemplaza solicitud de /me
*
* Hace usuario PRO y le da suscripción PRO+
*/
static makePro(res: Response) {
if (res.ok) {
Expand All @@ -68,7 +76,26 @@ export default class Hooks {
res
.clone()
.json()
.then((d) => ({ ...d, isPro: true }));
.then((d) => ({ ...d, isPro: true, subscriptionId: "prod_OiP9d4lmwvm0Ba", subscriptionTier: "tier_3", verifiedSubscriptionTier: true }));
res.json = json;
}
}

/**
* Fuerza modo oscuro en el nuevo frontend de Wuolah
*/
static forceDark(res: Response) {
if (res.ok) {
Misc.log("Forzando tema oscuro", Log.INFO);
const json = () =>
res
.clone()
.json()
.then((d) => ({
...d, item: {
theme: "wuolah-theme-dark"
}
}));
res.json = json;
}
}
Expand Down Expand Up @@ -118,7 +145,7 @@ export default class Hooks {
buf = await handlePDF(buf);
}

zip.file(doc.name, buf, {binary: true})
zip.file(doc.name, buf, { binary: true })
i++;
} else {
failed = true;
Expand Down
7 changes: 6 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ GM_config.init({
label: "Desactivar analíticas",
default: true,
},
force_dark: {
type: "checkbox",
label: "Forzar modo oscuro",
default: false,
},
folder_download: {
type: "checkbox",
label: "[EXPERIMENTAL] Descargar carpeta",
title: "¡Esta función aún está en desarrollo!",
default: false,
},
}
},
events: {
init: () => {
Expand Down

0 comments on commit 4e5df69

Please sign in to comment.