just make eslint happier

This commit is contained in:
wearrrrr 2024-09-22 20:48:56 -05:00
parent 96103460b8
commit dc80bf1170
6 changed files with 16 additions and 11 deletions

View file

@ -112,6 +112,7 @@ export class ScramjetClient {
);
}
// eslint-disable-next-line @typescript-eslint/no-this-alias
const client = this;
this.meta = {
get origin() {
@ -121,13 +122,15 @@ export class ScramjetClient {
if (iswindow) {
const base = client.global.document.querySelector("base");
if (base) {
let url = base.getAttribute(`href`);
let frag = url.indexOf("#");
let url = base.getAttribute("href");
const frag = url.indexOf("#");
url = url.substring(0, frag === -1 ? undefined : frag);
if (!url) return client.url;
return new URL(url, client.url.origin);
}
}
return client.url;
},
};

View file

@ -1,7 +1,7 @@
import { SCRAMJETCLIENT } from "../../symbols";
import { ScramjetClient } from "../client";
import { nativeGetOwnPropertyDescriptor } from "../natives";
import { config, decodeUrl, htmlRules, unrewriteHtml } from "../../shared";
import { decodeUrl, htmlRules, unrewriteHtml } from "../../shared";
import {
encodeUrl,
rewriteCss,
@ -134,7 +134,7 @@ export default function (client: ScramjetClient, self: typeof window) {
apply(ctx) {
const [name, value] = ctx.args;
const rule = htmlRules.find((rule) => {
const ruleList = htmlRules.find((rule) => {
const r = rule[name];
if (!r) return false;
if (r === "*") return true;
@ -143,8 +143,8 @@ export default function (client: ScramjetClient, self: typeof window) {
return r.includes(ctx.this.tagName.toLowerCase());
});
if (rule) {
ctx.args[1] = rule.fn(value, client.meta, client.cookieStore);
if (ruleList) {
ctx.args[1] = ruleList.fn(value, client.meta, client.cookieStore);
ctx.fn.call(ctx.this, `data-scramjet-${ctx.args[0]}`, value);
}
},
@ -246,7 +246,7 @@ export default function (client: ScramjetClient, self: typeof window) {
client.Trap("Node.prototype.ownerDocument", {
get(ctx) {
return client.documentProxy;
// return client.documentProxy;
const doc = ctx.get() as Document | null;
if (!doc) return null;

View file

@ -1,7 +1,7 @@
import { encodeUrl } from "../shared";
// import { encodeUrl } from "../shared";
import { ScramjetClient } from "./client";
import { indirectEval } from "./shared/eval";
import { config } from "../shared";
// import { config } from "../shared";
import { getOwnPropertyDescriptorHandler } from "./helpers";
export function createGlobalProxy(

View file

@ -6,6 +6,7 @@ export function argdbg(arg, recurse = []) {
switch (typeof arg) {
case "string":
if (arg.includes("localhost:1337/scramjet/") && arg.includes("m3u8"))
// eslint-disable-next-line no-debugger
debugger;
break;
case "object":

View file

@ -43,7 +43,7 @@ export default function (client: ScramjetClient, self: Self) {
);
// subtracting that from the index of the scramtag gives us the starting index of the function relative to the entire file
let absindex = abstagindex - scramtagstart;
const absindex = abstagindex - scramtagstart;
const scramtagend = stringified.indexOf("*/", scramtagstart);
const tag = stringified.substring(firstspace + 1, scramtagend);
@ -75,6 +75,7 @@ export default function (client: ScramjetClient, self: Self) {
}
newString += stringified.slice(i);
return ctx.return(newString);
},
});

View file

@ -1,7 +1,7 @@
import { encodeUrl } from "../../shared";
import { ScramjetClient } from "../client";
export default function (client: ScramjetClient, self: Self) {
export default function (client: ScramjetClient, _self: Self) {
client.Proxy("importScripts", {
apply(ctx) {
for (const i in ctx.args) {