mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-12 22:10:01 -04:00
no more eslint errors, just warnings
This commit is contained in:
parent
e5a0843b5f
commit
51ce240bf5
11 changed files with 29 additions and 22 deletions
|
@ -47,6 +47,7 @@ export default [
|
|||
"no-undef": "off",
|
||||
"no-empty": "off",
|
||||
"no-debugger": "off",
|
||||
"no-shadow": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
|
|
|
@ -26,6 +26,7 @@ export default function (client: ScramjetClient, self: typeof window) {
|
|||
if (thisArg === proxy) {
|
||||
return Reflect.apply(target, map, argArray);
|
||||
}
|
||||
|
||||
return Reflect.apply(target, thisArg, argArray);
|
||||
},
|
||||
});
|
||||
|
@ -34,7 +35,7 @@ export default function (client: ScramjetClient, self: typeof window) {
|
|||
if (!this.has(target, prop)) return undefined;
|
||||
|
||||
if (value instanceof Attr) {
|
||||
let attr = value;
|
||||
const attr = value;
|
||||
|
||||
return new Proxy(attr, {
|
||||
get(target, prop) {
|
||||
|
@ -69,15 +70,18 @@ export default function (client: ScramjetClient, self: typeof window) {
|
|||
},
|
||||
ownKeys(target) {
|
||||
const keys = Reflect.ownKeys(target);
|
||||
|
||||
return keys.filter((key) => this.has(target, key));
|
||||
},
|
||||
has(target, prop) {
|
||||
if (typeof prop === "symbol") return Reflect.has(target, prop);
|
||||
if (prop.startsWith("data-scramjet-")) return false;
|
||||
if (map[prop]?.name?.startsWith("data-scramjet-")) return false;
|
||||
|
||||
return Reflect.has(target, prop);
|
||||
},
|
||||
});
|
||||
|
||||
return proxy;
|
||||
},
|
||||
});
|
||||
|
|
|
@ -60,7 +60,8 @@ export function createGlobalProxy(
|
|||
set(target, prop, value) {
|
||||
if (prop === "location") {
|
||||
client.url = value;
|
||||
return;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return Reflect.set(target, prop, value);
|
||||
|
|
|
@ -8,7 +8,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":
|
||||
|
|
|
@ -8,7 +8,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
|
|||
// the empty object is the "pollutant" which can reconstruct the real realm
|
||||
// i explain more in postmessage.ts
|
||||
Object.defineProperty(self.Object.prototype, config.globals.setrealmfn, {
|
||||
value(pollution: {}) {
|
||||
value(pollution: object) {
|
||||
// this is bad!! sites could detect this
|
||||
Object.defineProperty(this, POLLUTANT, {
|
||||
value: pollution,
|
||||
|
|
|
@ -2,8 +2,8 @@ import { iswindow, isworker } from "..";
|
|||
import { SCRAMJETCLIENT } from "../../symbols";
|
||||
import { ScramjetClient } from "../client";
|
||||
import { config } from "../../shared";
|
||||
import { argdbg } from "./err";
|
||||
import { indirectEval } from "./eval";
|
||||
// import { argdbg } from "./err";
|
||||
// import { indirectEval } from "./eval";
|
||||
|
||||
export function createWrapFn(client: ScramjetClient, self: typeof globalThis) {
|
||||
return function (identifier: any, args: any) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ScramjetConfig, ScramjetFlags } from "./types";
|
||||
import { ScramjetFlags } from "./types";
|
||||
|
||||
if (!("$scramjet" in self)) {
|
||||
// @ts-expect-error ts stuff
|
||||
|
@ -27,7 +27,7 @@ export function loadCodecs() {
|
|||
}
|
||||
|
||||
export function flagEnabled(flag: keyof ScramjetFlags, url: URL): boolean {
|
||||
let value = $scramjet.config.defaultFlags[flag];
|
||||
const value = $scramjet.config.defaultFlags[flag];
|
||||
for (const regex in $scramjet.config.siteFlags) {
|
||||
const partialflags = $scramjet.config.siteFlags[regex];
|
||||
if (new RegExp(regex).test(url.href) && flag in partialflags) {
|
||||
|
|
|
@ -24,7 +24,8 @@ export function rewriteJs(js: string | ArrayBuffer, meta: URLMeta) {
|
|||
const text = typeof js === "string" ? js : new TextDecoder().decode(js);
|
||||
|
||||
console.log("naiive");
|
||||
return rewriteJsNaiive(text);
|
||||
|
||||
return rewriteJsNaiive(text);
|
||||
}
|
||||
|
||||
// const before = performance.now();
|
||||
|
|
|
@ -10,7 +10,7 @@ export function rewriteWorkers(
|
|||
) {
|
||||
let str = "";
|
||||
|
||||
let script = (script) => {
|
||||
const script = (script) => {
|
||||
if (type === "module") {
|
||||
str += `import "${$scramjet.config.files[script]}"\n`;
|
||||
} else {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { defineConfig, devices } from '@playwright/test';
|
||||
import { defineConfig, devices } from "@playwright/test";
|
||||
|
||||
/**
|
||||
* Read environment variables from file.
|
||||
|
@ -12,7 +12,7 @@ import { defineConfig, devices } from '@playwright/test';
|
|||
* See https://playwright.dev/docs/test-configuration.
|
||||
*/
|
||||
export default defineConfig({
|
||||
testDir: './tests',
|
||||
testDir: "./tests",
|
||||
/* Run tests in files in parallel */
|
||||
fullyParallel: true,
|
||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||
|
@ -22,21 +22,21 @@ export default defineConfig({
|
|||
/* Opt out of parallel tests on CI. */
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||
reporter: 'html',
|
||||
reporter: "html",
|
||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||
use: {
|
||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||
// baseURL: 'http://127.0.0.1:3000',
|
||||
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: 'on-first-retry',
|
||||
trace: "on-first-retry",
|
||||
},
|
||||
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
name: "chromium",
|
||||
use: { ...devices["Desktop Chrome"] },
|
||||
},
|
||||
|
||||
// {
|
||||
|
@ -47,8 +47,8 @@ export default defineConfig({
|
|||
|
||||
/* Run your local dev server before starting the tests */
|
||||
webServer: {
|
||||
command: 'cd .. && pnpm run dev',
|
||||
url: 'http://127.0.0.1:1337',
|
||||
command: "cd .. && pnpm run dev",
|
||||
url: "http://127.0.0.1:1337",
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { test, expect, type Page } from '@playwright/test';
|
||||
import { test, expect } from "@playwright/test";
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('http://localhost:1337');
|
||||
await page.goto("http://localhost:1337");
|
||||
});
|
||||
|
||||
test.describe("Page loaded", () => {
|
||||
test("should display the title", async ({ page }) => {
|
||||
const title = await page.locator('h1').textContent();
|
||||
expect(title).toBe('Percury Unblocker');
|
||||
const title = await page.locator("h1").textContent();
|
||||
expect(title).toBe("Percury Unblocker");
|
||||
});
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue