Add ultraviolet
This commit is contained in:
parent
ae499f760c
commit
5270ad40ab
3 changed files with 12 additions and 4 deletions
3
augment.d.ts
vendored
Normal file
3
augment.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
declare global {
|
||||||
|
var __uv$config: any;
|
||||||
|
}
|
||||||
|
|
@ -1,18 +1,24 @@
|
||||||
|
// @ts-ignore
|
||||||
import { RammerheadEncode } from "./RammerheadEncode";
|
import { RammerheadEncode } from "./RammerheadEncode";
|
||||||
import { useEffect, useState } from "preact/hooks";
|
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 localProxy = localStorage.getItem("proxy") || "automatic";
|
||||||
var [ProxiedUrl, setProxiedUrl] = useState<string | undefined>(undefined);
|
var [ProxiedUrl, setProxiedUrl] = useState<string | undefined>(undefined);
|
||||||
|
|
||||||
var decodedUrl = decodeURIComponent(props.url);
|
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") {
|
if (localProxy === "rammerhead") {
|
||||||
RammerheadEncode(decodedUrl).then((result: string) => {
|
RammerheadEncode(decodedUrl).then((result: string) => {
|
||||||
setProxiedUrl(result);
|
setProxiedUrl(result);
|
||||||
window.location.href = result;
|
window.location.href = result;
|
||||||
});
|
});
|
||||||
|
} else if (localProxy === "ultraviolet") {
|
||||||
|
window.location.href =
|
||||||
|
__uv$config.prefix + __uv$config.encodeUrl(decodedUrl);
|
||||||
}
|
}
|
||||||
}, [localProxy]);
|
}, [localProxy]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
"jsxImportSource": "preact",
|
"jsxImportSource": "preact",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"paths": {
|
"paths": {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue