mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 23:10:02 -04:00
chore: prettier
This commit is contained in:
parent
b3eeb91a2d
commit
9db2842c95
4 changed files with 19 additions and 19 deletions
|
@ -108,7 +108,7 @@ export class ScramjetClient {
|
|||
resolve(data.port);
|
||||
}
|
||||
});
|
||||
}),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ export class ScramjetClient {
|
|||
h.construct = function (
|
||||
constructor: any,
|
||||
argArray: any[],
|
||||
newTarget: AnyFunction,
|
||||
newTarget: AnyFunction
|
||||
) {
|
||||
let returnValue: any = undefined;
|
||||
let earlyreturn = false;
|
||||
|
@ -364,7 +364,7 @@ export class ScramjetClient {
|
|||
RawTrap<T>(
|
||||
target: any,
|
||||
prop: string,
|
||||
descriptor: Trap<T>,
|
||||
descriptor: Trap<T>
|
||||
): PropertyDescriptor {
|
||||
if (!target) return;
|
||||
if (!prop) return;
|
||||
|
|
|
@ -26,13 +26,13 @@ function newmeta(url: URL): URLMeta {
|
|||
export async function swfetch(
|
||||
this: ScramjetServiceWorker,
|
||||
request: Request,
|
||||
client: Client | null,
|
||||
client: Client | null
|
||||
) {
|
||||
const urlParam = new URLSearchParams(new URL(request.url).search);
|
||||
|
||||
if (urlParam.has("url")) {
|
||||
return Response.redirect(
|
||||
encodeUrl(urlParam.get("url"), newmeta(new URL(urlParam.get("url")))),
|
||||
encodeUrl(urlParam.get("url"), newmeta(new URL(urlParam.get("url"))))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ export async function swfetch(
|
|||
const url = new URL(decodeUrl(requesturl));
|
||||
|
||||
const activeWorker: FakeServiceWorker | null = this.serviceWorkers.find(
|
||||
(w) => w.origin === url.origin,
|
||||
(w) => w.origin === url.origin
|
||||
);
|
||||
|
||||
if (
|
||||
|
@ -63,7 +63,7 @@ export async function swfetch(
|
|||
}
|
||||
if (url.origin == new URL(request.url).origin) {
|
||||
throw new Error(
|
||||
"attempted to fetch from same origin - this means the site has obtained a reference to the real origin, aborting",
|
||||
"attempted to fetch from same origin - this means the site has obtained a reference to the real origin, aborting"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ export async function swfetch(
|
|||
response,
|
||||
this.cookieStore,
|
||||
client,
|
||||
this,
|
||||
this
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("ERROR FROM SERVICE WORKER FETCH", err);
|
||||
|
@ -134,7 +134,7 @@ async function handleResponse(
|
|||
response: BareResponseFetch,
|
||||
cookieStore: CookieStore,
|
||||
client: Client,
|
||||
swtarget: ScramjetServiceWorker,
|
||||
swtarget: ScramjetServiceWorker
|
||||
): Promise<Response> {
|
||||
let responseBody: string | ArrayBuffer | ReadableStream;
|
||||
const responseHeaders = rewriteHeaders(response.rawHeaders, newmeta(url));
|
||||
|
@ -151,7 +151,7 @@ async function handleResponse(
|
|||
|
||||
await cookieStore.setCookies(
|
||||
maybeHeaders instanceof Array ? maybeHeaders : [maybeHeaders],
|
||||
url,
|
||||
url
|
||||
);
|
||||
|
||||
for (const header in responseHeaders) {
|
||||
|
@ -169,7 +169,7 @@ async function handleResponse(
|
|||
await response.text(),
|
||||
cookieStore,
|
||||
newmeta(url),
|
||||
true,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
responseBody = response.body;
|
||||
|
@ -188,7 +188,7 @@ async function handleResponse(
|
|||
responseBody = rewriteWorkers(
|
||||
await response.arrayBuffer(),
|
||||
workertype,
|
||||
newmeta(url),
|
||||
newmeta(url)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -76,7 +76,7 @@ export class ScramjetServiceWorker extends EventTarget {
|
|||
clients = clients.filter(
|
||||
(client) =>
|
||||
client.type === "window" &&
|
||||
!new URL(client.url).pathname.startsWith(this.config.prefix),
|
||||
!new URL(client.url).pathname.startsWith(this.config.prefix)
|
||||
);
|
||||
|
||||
if (clients.length === 0) throw new Error("No clients found");
|
||||
|
@ -99,7 +99,7 @@ export class ScramjetServiceWorker extends EventTarget {
|
|||
clients = clients.filter(
|
||||
(client) =>
|
||||
client.type === "window" &&
|
||||
!new URL(client.url).pathname.startsWith(this.config.prefix),
|
||||
!new URL(client.url).pathname.startsWith(this.config.prefix)
|
||||
);
|
||||
|
||||
if (clients.length === 0) throw new Error("No clients found");
|
||||
|
@ -130,7 +130,7 @@ export class ScramjetServiceWorker extends EventTarget {
|
|||
const type = new URL(request.url).searchParams.get("type");
|
||||
|
||||
const origin = new URL(
|
||||
decodeURIComponent(new URL(request.url).searchParams.get("origin")),
|
||||
decodeURIComponent(new URL(request.url).searchParams.get("origin"))
|
||||
);
|
||||
|
||||
let promise = this.dataworkerpromises[id];
|
||||
|
|
|
@ -49,7 +49,7 @@ const store = $store(
|
|||
"/bare/",
|
||||
proxy: "",
|
||||
},
|
||||
{ ident: "settings", backing: "localstorage", autosave: "auto" },
|
||||
{ ident: "settings", backing: "localstorage", autosave: "auto" }
|
||||
);
|
||||
connection.setTransport("/libcurl/index.mjs", [{ wisp: store.wispurl }]);
|
||||
function App() {
|
||||
|
@ -146,7 +146,7 @@ function App() {
|
|||
if (url === "about:blank") return;
|
||||
|
||||
this.url = $scramjet.codecs.plain.decode(
|
||||
url.substring((location.href + "/scramjet").length),
|
||||
url.substring((location.href + "/scramjet").length)
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -193,7 +193,7 @@ function App() {
|
|||
<div class=${[flex, "nav"]} style="width: 60%">
|
||||
<button on:click=${() => frame.back()}><-</button>
|
||||
<input class="bar" style="flex: 1" bind:value=${use(this.url)} on:input=${(
|
||||
e,
|
||||
e
|
||||
) => {
|
||||
this.url = e.target.value;
|
||||
}} on:keyup=${(e) => e.keyCode == 13 && (store.url = this.url) && handleSubmit()}></input>
|
||||
|
@ -227,6 +227,6 @@ padding-bottom: 100px;
|
|||
background-size: contain;
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
`,
|
||||
`
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue