mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-13 20:10:01 -04:00
Prettier Format
This commit is contained in:
parent
3a9024d1e0
commit
ad67368a45
42 changed files with 1650 additions and 1609 deletions
8
.prettierignore
Normal file
8
.prettierignore
Normal 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
|
|
@ -1,4 +1,5 @@
|
||||||
# Nebula rewrite
|
# Nebula rewrite
|
||||||
|
|
||||||
`npm i -g pnpm tsx`
|
`npm i -g pnpm tsx`
|
||||||
`git clone https://github.com/NebulaServices/Nebula.git`
|
`git clone https://github.com/NebulaServices/Nebula.git`
|
||||||
`git switch rewrite`
|
`git switch rewrite`
|
||||||
|
|
18
server.ts
18
server.ts
|
@ -1,7 +1,7 @@
|
||||||
import fastify from 'fastify';
|
import fastify from "fastify";
|
||||||
import fastifyStatic from '@fastify/static';
|
import fastifyStatic from "@fastify/static";
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from "url";
|
||||||
import path from 'path';
|
import path from "path";
|
||||||
import createRammerhead from "rammerhead/src/server/index.js";
|
import createRammerhead from "rammerhead/src/server/index.js";
|
||||||
import { createBareServer } from "@tomphttp/bare-server-node";
|
import { createBareServer } from "@tomphttp/bare-server-node";
|
||||||
import { createServer } from "http";
|
import { createServer } from "http";
|
||||||
|
@ -71,15 +71,15 @@ const serverFactory = (handler, opts) => {
|
||||||
const app = fastify({ logger: true, serverFactory });
|
const app = fastify({ logger: true, serverFactory });
|
||||||
|
|
||||||
app.register(fastifyStatic, {
|
app.register(fastifyStatic, {
|
||||||
root: path.join(__dirname, 'dist'),
|
root: path.join(__dirname, "dist"),
|
||||||
prefix: '/',
|
prefix: "/",
|
||||||
serve: true,
|
serve: true,
|
||||||
wildcard: false,
|
wildcard: false
|
||||||
});
|
});
|
||||||
|
|
||||||
app.setNotFoundHandler((req, res) => {
|
app.setNotFoundHandler((req, res) => {
|
||||||
res.sendFile('index.html') // SPA catch-all
|
res.sendFile("index.html"); // SPA catch-all
|
||||||
})
|
});
|
||||||
|
|
||||||
app.listen({
|
app.listen({
|
||||||
port: 8080
|
port: 8080
|
||||||
|
|
|
@ -1,13 +1,23 @@
|
||||||
import { motion } from "framer-motion"
|
import { motion } from "framer-motion";
|
||||||
import { IframeHeader } from "./IframeHeader"
|
import { IframeHeader } from "./IframeHeader";
|
||||||
|
|
||||||
export function Iframe(props: { url: string }) {
|
export function Iframe(props: { url: string }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<IframeHeader url={ props.url } />
|
<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 }} >
|
<motion.div
|
||||||
<iframe id="iframe" src={ props.url } className="w-full h-full border-none bg-primary" />
|
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>
|
</motion.div>
|
||||||
</>
|
</>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { useState } from "preact/hooks";
|
import { useState } from "preact/hooks";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "preact-router";
|
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 }) {
|
export function IframeHeader(props: { url: string }) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation();
|
||||||
const [showPopout, setShowPopout] = useState(false);
|
const [showPopout, setShowPopout] = useState(false);
|
||||||
const [showFullScreen, setFullScreen] = useState(false);
|
const [showFullScreen, setFullScreen] = useState(false);
|
||||||
if (showPopout) {
|
if (showPopout) {
|
||||||
|
@ -15,19 +15,34 @@ export function IframeHeader(props: { url: string }) {
|
||||||
setFullScreen(false);
|
setFullScreen(false);
|
||||||
}
|
}
|
||||||
return (
|
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">
|
<Link href="/" class="w-1/2">
|
||||||
<div className="flex flex-row items-center">
|
<div className="flex flex-row items-center">
|
||||||
<img src="/logo.png" className="h-16 w-16 transition-all duration-1000 hover:rotate-[360deg]"></img>
|
<img
|
||||||
<h1 className="font-roboto text-2xl font-bold text-navbar-text-color md:text-4xl"> {t("header.title")} </h1>
|
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>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
<div id="navItems" class="w-1/2">
|
<div id="navItems" class="w-1/2">
|
||||||
<div className="flex flex-row items-center justify-end gap-3 mr-4">
|
<div className="mr-4 flex flex-row items-center justify-end gap-3">
|
||||||
<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)} />
|
<RiPictureInPictureExitFill
|
||||||
<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)} />
|
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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
};
|
}
|
||||||
|
|
|
@ -25,4 +25,3 @@ export function App() {
|
||||||
}
|
}
|
||||||
|
|
||||||
render(<App />, document.getElementById("app"));
|
render(<App />, document.getElementById("app"));
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,7 @@ export function ProxyFrame(props: { url: string }) {
|
||||||
|
|
||||||
if (proxyMode == "direct") {
|
if (proxyMode == "direct") {
|
||||||
window.location.href = ProxiedUrl;
|
window.location.href = ProxiedUrl;
|
||||||
}
|
} 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();
|
||||||
newDocument.write(`
|
newDocument.write(`
|
||||||
|
@ -70,7 +69,7 @@ export function ProxyFrame(props: { url: string }) {
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
`);
|
`);
|
||||||
newDocument.close()
|
newDocument.close();
|
||||||
window.location.replace("/");
|
window.location.replace("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +77,9 @@ export function ProxyFrame(props: { url: string }) {
|
||||||
<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>}
|
||||||
{proxyMode === "aboutblank" && <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>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ const Proxy = ({ id, active }) => {
|
||||||
>
|
>
|
||||||
<motion.div
|
<motion.div
|
||||||
variants={settingsPageVariant}
|
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="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>
|
<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="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="p-2 text-3xl">{t("settings.proxymodes.title")}</div>
|
||||||
<div class="text-md p-4">{t("settings.proxymodes.subtitle")}</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>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
|
@ -66,10 +66,10 @@ const TabComponent = ({ tabs, defaultIndex = 0 }) => {
|
||||||
setActiveTabIndex(index);
|
setActiveTabIndex(index);
|
||||||
};
|
};
|
||||||
|
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
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="container h-full w-full">
|
||||||
<div className="tabs-component">
|
<div className="tabs-component">
|
||||||
<ul className="tab-links" role="tablist">
|
<ul className="tab-links" role="tablist">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import TabComponent from "./TabComponent";
|
import TabComponent from "./TabComponent";
|
||||||
import { HeaderRoute } from "../../components/HeaderRoute";
|
import { HeaderRoute } from "../../components/HeaderRoute";
|
||||||
import tabs from "./tabs";
|
import tabs from "./tabs";
|
||||||
import { Helmet } from "react-helmet"
|
import { Helmet } from "react-helmet";
|
||||||
|
|
||||||
export function Settings() {
|
export function Settings() {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -17,7 +17,10 @@ export function DiscordPage() {
|
||||||
{t("discord.button1")}
|
{t("discord.button1")}
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</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">
|
<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")}
|
{t("discord.button2")}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
export function RammerheadEncode(baseUrl) { // Hellhead
|
export function RammerheadEncode(baseUrl) {
|
||||||
|
// Hellhead
|
||||||
const mod = (n, m) => ((n % m) + m) % m;
|
const mod = (n, m) => ((n % m) + m) % m;
|
||||||
const baseDictionary =
|
const baseDictionary =
|
||||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~-";
|
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~-";
|
||||||
|
|
|
@ -12,10 +12,9 @@ export default {
|
||||||
input: "var(--input-background-color)",
|
input: "var(--input-background-color)",
|
||||||
"input-text": "var(--input-text-color)",
|
"input-text": "var(--input-text-color)",
|
||||||
"input-border-color": "var(--input-border-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: {}
|
extend: {}
|
||||||
},
|
},
|
||||||
plugins: []
|
plugins: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue