mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 06:20:02 -04:00
chore: prettier
This commit is contained in:
parent
70779ffe5b
commit
a94f969a7b
6 changed files with 13 additions and 15 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
@ -49,7 +49,7 @@ jobs:
|
||||||
- name: upload pages artifact
|
- name: upload pages artifact
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: './staticbuild'
|
path: "./staticbuild"
|
||||||
- name: deploy to github
|
- name: deploy to github
|
||||||
id: deployment
|
id: deployment
|
||||||
uses: actions/deploy-pages@v4
|
uses: actions/deploy-pages@v4
|
||||||
|
|
|
@ -63,7 +63,9 @@ export default function (client: ScramjetClient, self: typeof window) {
|
||||||
ownKeys(target) {
|
ownKeys(target) {
|
||||||
return Reflect.ownKeys(target)
|
return Reflect.ownKeys(target)
|
||||||
.filter((f) => typeof f === "string" && f.startsWith(client.url.host))
|
.filter((f) => typeof f === "string" && f.startsWith(client.url.host))
|
||||||
.map((f) => typeof f === "string" ? f.substring(client.url.host.length + 1) : f);
|
.map((f) =>
|
||||||
|
typeof f === "string" ? f.substring(client.url.host.length + 1) : f
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
getOwnPropertyDescriptor(target, property) {
|
getOwnPropertyDescriptor(target, property) {
|
||||||
|
|
|
@ -22,13 +22,12 @@ export function createGlobalProxy(
|
||||||
return new Proxy(self, {
|
return new Proxy(self, {
|
||||||
get(target, prop) {
|
get(target, prop) {
|
||||||
if (prop === "location") return client.locationProxy;
|
if (prop === "location") return client.locationProxy;
|
||||||
if (typeof prop === "string" && UNSAFE_GLOBALS.includes(prop)) return client.wrapfn(self[prop]);
|
if (typeof prop === "string" && UNSAFE_GLOBALS.includes(prop))
|
||||||
|
return client.wrapfn(self[prop]);
|
||||||
if (prop === "$scramjet") return;
|
if (prop === "$scramjet") return;
|
||||||
if (prop === "eval") return indirectEval.bind(client);
|
if (prop === "eval") return indirectEval.bind(client);
|
||||||
|
|
||||||
const value = Reflect.get(target, prop);
|
const value = Reflect.get(target, prop);
|
||||||
if (typeof prop === "string" && UNSAFE_GLOBALS.includes(prop))
|
|
||||||
return client.wrapfn(value);
|
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
|
|
|
@ -47,9 +47,6 @@ export function createWrapFn(client: ScramjetClient, self: typeof globalThis) {
|
||||||
} else if (isworker && identifier instanceof self.WorkerGlobalScope) {
|
} else if (isworker && identifier instanceof self.WorkerGlobalScope) {
|
||||||
return client.globalProxy;
|
return client.globalProxy;
|
||||||
}
|
}
|
||||||
if (identifier == self.eval) {
|
|
||||||
return indirectEval.bind(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
return identifier;
|
return identifier;
|
||||||
};
|
};
|
||||||
|
|
|
@ -139,7 +139,7 @@ export const htmlRules: {
|
||||||
return unrewriteBlob(value);
|
return unrewriteBlob(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rewriteUrl(value, meta);
|
return rewriteUrl(value, meta);
|
||||||
},
|
},
|
||||||
src: ["video", "audio"],
|
src: ["video", "audio"],
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,13 +16,13 @@ function tryCanParseURL(url: string, origin?: string | URL): URL | null {
|
||||||
export function rewriteBlob(url: string, meta: URLMeta) {
|
export function rewriteBlob(url: string, meta: URLMeta) {
|
||||||
const blob = new URL(url.substring("blob:".length));
|
const blob = new URL(url.substring("blob:".length));
|
||||||
|
|
||||||
return "blob:" + meta.origin.origin + blob.pathname;
|
return "blob:" + meta.origin.origin + blob.pathname;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unrewriteBlob(url: string) {
|
export function unrewriteBlob(url: string) {
|
||||||
const blob = new URL(url.substring("blob:".length));
|
const blob = new URL(url.substring("blob:".length));
|
||||||
|
|
||||||
return "blob:" + location.origin + blob.pathname;
|
return "blob:" + location.origin + blob.pathname;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function rewriteUrl(url: string | URL, meta: URLMeta) {
|
export function rewriteUrl(url: string | URL, meta: URLMeta) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue