Revert "dont use _self on every single a and base tag" (breaks google)

This reverts commit be0df961f4.
This commit is contained in:
Toshit Chawda 2025-03-13 15:40:24 -07:00
parent be0df961f4
commit 9d17ea0073
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
2 changed files with 9 additions and 0 deletions

View file

@ -7,6 +7,9 @@ export default function (client: ScramjetClient) {
apply(ctx) { apply(ctx) {
if (ctx.args[0]) ctx.args[0] = rewriteUrl(ctx.args[0], client.meta); if (ctx.args[0]) ctx.args[0] = rewriteUrl(ctx.args[0], client.meta);
if (["_parent", "_top", "_unfencedTop"].includes(ctx.args[1]))
ctx.args[1] = "_self";
const realwin = ctx.call(); const realwin = ctx.call();
if (!realwin) return ctx.return(realwin); if (!realwin) return ctx.return(realwin);

View file

@ -186,6 +186,12 @@ export const htmlRules: {
fn: (value: string, meta: URLMeta) => rewriteCss(value, meta), fn: (value: string, meta: URLMeta) => rewriteCss(value, meta),
style: "*", style: "*",
}, },
{
fn: (value: string) => {
if (["_parent", "_top", "_unfencedTop"].includes(value)) return "_self";
},
target: ["a", "base"],
},
]; ];
// i need to add the attributes in during rewriting // i need to add the attributes in during rewriting