Prettier Format

This commit is contained in:
MotorTruck1221 2023-12-26 03:51:37 -07:00
parent 3a9024d1e0
commit ad67368a45
42 changed files with 1650 additions and 1609 deletions

8
.prettierignore Normal file
View file

@ -0,0 +1,8 @@
# Build artifacts
dist/
# Other things that don't need to be reformatted
public/uv/
public/dynamic/
pnpm-lock.yaml
package-lock.json

View file

@ -1,4 +1,5 @@
# Nebula rewrite
`npm i -g pnpm tsx`
`git clone https://github.com/NebulaServices/Nebula.git`
`git switch rewrite`

View file

@ -1,7 +1,7 @@
import fastify from 'fastify';
import fastifyStatic from '@fastify/static';
import { fileURLToPath } from 'url';
import path from 'path';
import fastify from "fastify";
import fastifyStatic from "@fastify/static";
import { fileURLToPath } from "url";
import path from "path";
import createRammerhead from "rammerhead/src/server/index.js";
import { createBareServer } from "@tomphttp/bare-server-node";
import { createServer } from "http";
@ -71,15 +71,15 @@ const serverFactory = (handler, opts) => {
const app = fastify({ logger: true, serverFactory });
app.register(fastifyStatic, {
root: path.join(__dirname, 'dist'),
prefix: '/',
root: path.join(__dirname, "dist"),
prefix: "/",
serve: true,
wildcard: false,
wildcard: false
});
app.setNotFoundHandler((req, res) => {
res.sendFile('index.html') // SPA catch-all
})
res.sendFile("index.html"); // SPA catch-all
});
app.listen({
port: 8080

View file

@ -1,13 +1,23 @@
import { motion } from "framer-motion"
import { IframeHeader } from "./IframeHeader"
import { motion } from "framer-motion";
import { IframeHeader } from "./IframeHeader";
export function Iframe(props: { url: string }) {
return (
<>
<IframeHeader url={props.url} />
<motion.div className="w-full h-[calc(100%_-_4rem)] bg-primary" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: 0.5 }} >
<iframe id="iframe" src={ props.url } className="w-full h-full border-none bg-primary" />
<motion.div
className="h-[calc(100%_-_4rem)] w-full bg-primary"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.5 }}
>
<iframe
id="iframe"
src={props.url}
className="h-full w-full border-none bg-primary"
/>
</motion.div>
</>
)
);
}

View file

@ -1,10 +1,10 @@
import { useState } from "preact/hooks";
import { useTranslation } from "react-i18next";
import { Link } from "preact-router";
import { RiPictureInPictureExitFill, RiFullscreenFill } from "react-icons/ri"
import { RiPictureInPictureExitFill, RiFullscreenFill } from "react-icons/ri";
export function IframeHeader(props: { url: string }) {
const { t } = useTranslation()
const { t } = useTranslation();
const [showPopout, setShowPopout] = useState(false);
const [showFullScreen, setFullScreen] = useState(false);
if (showPopout) {
@ -15,19 +15,34 @@ export function IframeHeader(props: { url: string }) {
setFullScreen(false);
}
return (
<div id="iframeNav" className="flex h-16 flex-row items-center justify-between bg-navbar-color px-4">
<div
id="iframeNav"
className="flex h-16 flex-row items-center justify-between bg-navbar-color px-4"
>
<Link href="/" class="w-1/2">
<div className="flex flex-row items-center">
<img src="/logo.png" className="h-16 w-16 transition-all duration-1000 hover:rotate-[360deg]"></img>
<h1 className="font-roboto text-2xl font-bold text-navbar-text-color md:text-4xl"> {t("header.title")} </h1>
<img
src="/logo.png"
className="h-16 w-16 transition-all duration-1000 hover:rotate-[360deg]"
></img>
<h1 className="font-roboto text-2xl font-bold text-navbar-text-color md:text-4xl">
{" "}
{t("header.title")}{" "}
</h1>
</div>
</Link>
<div id="navItems" class="w-1/2">
<div className="flex flex-row items-center justify-end gap-3 mr-4">
<RiPictureInPictureExitFill className="h-6 w-6 cursor-pointer transition-all duration-0500 text-navbar-text-color hover:scale-110 hover:brightness-125" onClick={() => setShowPopout(true)} />
<RiFullscreenFill className="h-6 w-6 cursor-pointer transition-all duration-0500 text-navbar-text-color hover:scale-110 hover:brightness-125 active:rotate-90" onClick={() => setFullScreen(true)} />
<div className="mr-4 flex flex-row items-center justify-end gap-3">
<RiPictureInPictureExitFill
className="duration-0500 h-6 w-6 cursor-pointer text-navbar-text-color transition-all hover:scale-110 hover:brightness-125"
onClick={() => setShowPopout(true)}
/>
<RiFullscreenFill
className="duration-0500 h-6 w-6 cursor-pointer text-navbar-text-color transition-all hover:scale-110 hover:brightness-125 active:rotate-90"
onClick={() => setFullScreen(true)}
/>
</div>
</div>
</div>
)
};
);
}

View file

@ -25,4 +25,3 @@ export function App() {
}
render(<App />, document.getElementById("app"));

View file

@ -48,8 +48,7 @@ export function ProxyFrame(props: { url: string }) {
if (proxyMode == "direct") {
window.location.href = ProxiedUrl;
}
else if (proxyMode == "aboutblank") {
} else if (proxyMode == "aboutblank") {
const newWindow = window.open("about:blank", "_blank");
const newDocument = newWindow.document.open();
newDocument.write(`
@ -70,7 +69,7 @@ export function ProxyFrame(props: { url: string }) {
</body>
</html>
`);
newDocument.close()
newDocument.close();
window.location.replace("/");
}
@ -78,7 +77,9 @@ export function ProxyFrame(props: { url: string }) {
<div class="h-screen w-screen bg-primary">
{proxyMode === "direct" && <h1>Loading {localProxy}...</h1>}
{proxyMode === "aboutblank" && <h1>Loading {localProxy}...</h1>}
{proxyMode === "embed" && <Iframe url={ProxiedUrl} normalUrl={decodedUrl} />}
{proxyMode === "embed" && (
<Iframe url={ProxiedUrl} normalUrl={decodedUrl} />
)}
</div>
);
}

View file

@ -30,7 +30,7 @@ const Proxy = ({ id, active }) => {
>
<motion.div
variants={settingsPageVariant}
className="content-card flex flex-row flex-wrap justify-left w-full gap-4"
className="content-card justify-left flex w-full flex-row flex-wrap gap-4"
>
<div class="flex h-64 w-80 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-7 text-center">
<div class="p-2 text-3xl">{t("settings.proxy.title")}</div>
@ -40,7 +40,11 @@ const Proxy = ({ id, active }) => {
<div class="flex h-64 w-80 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-7 text-center">
<div class="p-2 text-3xl">{t("settings.proxymodes.title")}</div>
<div class="text-md p-4">{t("settings.proxymodes.subtitle")}</div>
<Dropdown storageKey="proxyMode" options={proxyModes} refresh={false} />
<Dropdown
storageKey="proxyMode"
options={proxyModes}
refresh={false}
/>
</div>
</motion.div>
</motion.div>

View file

@ -66,10 +66,10 @@ const TabComponent = ({ tabs, defaultIndex = 0 }) => {
setActiveTabIndex(index);
};
const { t } = useTranslation()
const { t } = useTranslation();
return (
<div class="flex flex-col items-center w-full h-full">
<div class="flex h-full w-full flex-col items-center">
<div className="container h-full w-full">
<div className="tabs-component">
<ul className="tab-links" role="tablist">

View file

@ -1,7 +1,7 @@
import TabComponent from "./TabComponent";
import { HeaderRoute } from "../../components/HeaderRoute";
import tabs from "./tabs";
import { Helmet } from "react-helmet"
import { Helmet } from "react-helmet";
export function Settings() {
return (

View file

@ -17,7 +17,10 @@ export function DiscordPage() {
{t("discord.button1")}
</button>
</a>
<a href="${window.location.href = '/go/' + encodeURIComponent(https://discord.gg/unblocker)}" class="p-6">
<a
href="${window.location.href = '/go/' + encodeURIComponent(https://discord.gg/unblocker)}"
class="p-6"
>
<button class="font-roboto h-14 w-56 rounded-2xl border border-input-border-color bg-input p-2 text-center text-xl placeholder:text-input-text focus:outline-none">
{t("discord.button2")}
</button>

View file

@ -1,4 +1,5 @@
export function RammerheadEncode(baseUrl) { // Hellhead
export function RammerheadEncode(baseUrl) {
// Hellhead
const mod = (n, m) => ((n % m) + m) % m;
const baseDictionary =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~-";

View file

@ -12,10 +12,9 @@ export default {
input: "var(--input-background-color)",
"input-text": "var(--input-text-color)",
"input-border-color": "var(--input-border-color)",
"dropdown-option-hover-color": "var(--dropdown-option-hover-color)",
"dropdown-option-hover-color": "var(--dropdown-option-hover-color)"
},
extend: {}
},
plugins: []
};