diff --git a/augment.d.ts b/augment.d.ts new file mode 100644 index 0000000..6c9e3c3 --- /dev/null +++ b/augment.d.ts @@ -0,0 +1,3 @@ +declare global { + var __uv$config: any; +} diff --git a/src/ProxyFrame.tsx b/src/ProxyFrame.tsx index 14c6138..e60062f 100644 --- a/src/ProxyFrame.tsx +++ b/src/ProxyFrame.tsx @@ -1,18 +1,24 @@ +// @ts-ignore import { RammerheadEncode } from "./RammerheadEncode"; import { useEffect, useState } from "preact/hooks"; -export function ProxyFrame(props: { url: string }) { // pass the URL encoded with encodeURIcomponent +export function ProxyFrame(props: { url: string }) { + // pass the URL encoded with encodeURIcomponent var localProxy = localStorage.getItem("proxy") || "automatic"; var [ProxiedUrl, setProxiedUrl] = useState(undefined); var decodedUrl = decodeURIComponent(props.url); - 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 + 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 if (localProxy === "rammerhead") { RammerheadEncode(decodedUrl).then((result: string) => { setProxiedUrl(result); window.location.href = result; }); + } else if (localProxy === "ultraviolet") { + window.location.href = + __uv$config.prefix + __uv$config.encodeUrl(decodedUrl); } }, [localProxy]); diff --git a/tsconfig.json b/tsconfig.json index 6f88ae5..7139d8b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,6 @@ "jsx": "react-jsx", "jsxImportSource": "preact", "skipLibCheck": true, - "paths": { - } + "paths": {} } }