Add ultraviolet

This commit is contained in:
rift 2023-12-21 10:24:16 -06:00
parent ae499f760c
commit 5270ad40ab
3 changed files with 12 additions and 4 deletions

View file

@ -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<string | undefined>(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]);