-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
101 lines (96 loc) · 3.09 KB
/
index.html
File metadata and controls
101 lines (96 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>pred-man-cli</title>
<script>
(() => {
const matchesAuthHost = (url) => {
try {
const u = new URL(url, document.baseURI);
return (
u.hostname === "relay.dynamicauth.com" ||
/\.dynamicauth\.com$/.test(u.hostname)
);
} catch {
return false;
}
};
const markCredentialless = (iframe) => {
try {
iframe.credentialless = true;
} catch {}
};
try {
const desc = Object.getOwnPropertyDescriptor(
HTMLIFrameElement.prototype,
"src"
);
if (desc && desc.set) {
const originalSet = desc.set;
Object.defineProperty(HTMLIFrameElement.prototype, "src", {
configurable: true,
enumerable: desc.enumerable,
get: desc.get,
set(value) {
if (matchesAuthHost(value)) markCredentialless(this);
return originalSet.call(this, value);
},
});
}
} catch {}
try {
const originalSetAttribute = Element.prototype.setAttribute;
Element.prototype.setAttribute = function (name, value) {
if (
this instanceof HTMLIFrameElement &&
name &&
name.toLowerCase() === "src" &&
matchesAuthHost(value)
) {
markCredentialless(this);
}
return originalSetAttribute.call(this, name, value);
};
} catch {}
try {
const checkAndMark = (iframe) => {
const value = iframe.getAttribute("src") || iframe.src;
if (value && matchesAuthHost(value)) markCredentialless(iframe);
};
const observer = new MutationObserver((mutations) => {
for (const m of mutations) {
if (m.type === "childList") {
for (const node of m.addedNodes) {
if (node instanceof HTMLIFrameElement) {
checkAndMark(node);
} else if (node && node.querySelectorAll) {
node.querySelectorAll("iframe").forEach(checkAndMark);
}
}
} else if (
m.type === "attributes" &&
m.target instanceof HTMLIFrameElement &&
m.attributeName === "src"
) {
checkAndMark(m.target);
}
}
});
observer.observe(document.documentElement, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ["src"],
});
} catch {}
})();
</script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>