mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-17 13:30:00 -04:00
The hackiest workaround in the history of hacky workarounds
This commit is contained in:
parent
1865161d73
commit
2b1e62c830
1 changed files with 32 additions and 21 deletions
|
@ -25,29 +25,38 @@ export function ProxyFrame(props: { url: string }) {
|
||||||
let proxyRef;
|
let proxyRef;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// For now we can redirect to the results. In the future we will add an if statement looking for the users proxy display choice
|
const fetchData = async () => {
|
||||||
if (localProxy === "rammerhead") {
|
try {
|
||||||
RammerheadEncode(decodedUrl).then((result: string) => {
|
let result: any = "";
|
||||||
|
if (localProxy === "rammerhead") {
|
||||||
|
result = await RammerheadEncode(decodedUrl);
|
||||||
|
} else if (localProxy === "ultraviolet") {
|
||||||
|
result =
|
||||||
|
window.__uv$config.prefix +
|
||||||
|
window.__uv$config.encodeUrl(decodedUrl);
|
||||||
|
} else if (localProxy === "dynamic") {
|
||||||
|
result =
|
||||||
|
window.__dynamic$config.prefix + encodeURIComponent(decodedUrl);
|
||||||
|
} else {
|
||||||
|
result =
|
||||||
|
window.__uv$config.prefix +
|
||||||
|
window.__uv$config.encodeUrl(decodedUrl);
|
||||||
|
}
|
||||||
setProxiedUrl(result);
|
setProxiedUrl(result);
|
||||||
});
|
} catch (error) {
|
||||||
} else if (localProxy === "ultraviolet") {
|
console.error("Error fetching data:", error);
|
||||||
setProxiedUrl(
|
}
|
||||||
window.__uv$config.prefix + window.__uv$config.encodeUrl(decodedUrl)
|
};
|
||||||
);
|
|
||||||
} else if (localProxy === "dynamic") {
|
fetchData();
|
||||||
setProxiedUrl(
|
}, [localProxy, decodedUrl]);
|
||||||
window.__dynamic$config.prefix + encodeURIComponent(decodedUrl)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// use UV for automatic
|
|
||||||
setProxiedUrl(
|
|
||||||
window.__uv$config.prefix + window.__uv$config.encodeUrl(decodedUrl)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}, [localProxy]);
|
|
||||||
|
|
||||||
if (proxyMode == "direct") {
|
if (proxyMode == "direct") {
|
||||||
window.location.href = ProxiedUrl;
|
console.log(ProxiedUrl);
|
||||||
|
console.log(!(ProxiedUrl == undefined));
|
||||||
|
if (!(ProxiedUrl == undefined)) {
|
||||||
|
window.location.href = ProxiedUrl; // This is the hackiest workaround in the history of hacky workarounds
|
||||||
|
}
|
||||||
} else if (proxyMode == "aboutblank") {
|
} else if (proxyMode == "aboutblank") {
|
||||||
const newWindow = window.open("about:blank", "_blank");
|
const newWindow = window.open("about:blank", "_blank");
|
||||||
const newDocument = newWindow.document.open();
|
const newDocument = newWindow.document.open();
|
||||||
|
@ -72,7 +81,9 @@ export function ProxyFrame(props: { url: string }) {
|
||||||
newDocument.close();
|
newDocument.close();
|
||||||
window.location.replace("/");
|
window.location.replace("/");
|
||||||
}
|
}
|
||||||
|
if (!ProxiedUrl == undefined) {
|
||||||
|
window.location.href = ProxiedUrl;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div class="h-screen w-screen bg-primary">
|
<div class="h-screen w-screen bg-primary">
|
||||||
{proxyMode === "direct" && <h1>Loading {localProxy}...</h1>}
|
{proxyMode === "direct" && <h1>Loading {localProxy}...</h1>}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue