fix websockets

This commit is contained in:
velzie 2024-09-19 17:52:24 -04:00
parent 83e6374131
commit ae771f444d
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
2 changed files with 47 additions and 4 deletions

View file

@ -9,6 +9,7 @@ import {
rewriteJs,
rewriteSrcset,
} from "../../shared";
import type { URLMeta } from "../../shared/rewriters/url";
export default function (client: ScramjetClient, self: typeof window) {
const attrObject = {
@ -65,7 +66,16 @@ export default function (client: ScramjetClient, self: typeof window) {
) {
value = encodeUrl(value, client.meta);
} else if (attr === "srcdoc") {
value = rewriteHtml(value, client.cookieStore, undefined, true);
value = rewriteHtml(
value,
client.cookieStore,
{
// srcdoc preserves parent origin i think
base: new URL(client.url.origin),
origin: new URL(client.url.origin),
} as URLMeta,
true
);
} else if (["srcset", "imagesrcset"].includes(attr)) {
value = rewriteSrcset(value, client.meta);
}