diff --git a/ephemeral b/ephemeral new file mode 100755 index 0000000..3dc7cb2 --- /dev/null +++ b/ephemeral @@ -0,0 +1,2 @@ +#!/usr/bin/env tsx +await import("./index.ts") diff --git a/index.ts b/index.ts index 82a7bbd..438dd2a 100755 --- a/index.ts +++ b/index.ts @@ -18,32 +18,38 @@ import { epoxyPath } from "@mercuryworkshop/epoxy-transport"; // @ts-expect-error stfu import { baremuxPath } from "@mercuryworkshop/bare-mux"; const devMode = argv.includes("--dev"); -const usingMasqr = argv.includes("--masqr"); +const usingMasqr = process.env.MASQR || argv.includes("--masqr"); const noIpLeak = argv.includes("--no-ip-leak"); +const port = + process.env.PORT || + (argv.includes("--port") && argv[argv.indexOf("--port") + 1]) || + 8080; config.config(); +process.chdir(import.meta.url.replace("file://", "").replace("index.ts", "")); if (argv.includes("-h") || argv.includes("--help")) { console.log(` -\x1b[34;49;1mEphemeral ---------- -\x1B[32m - default: Run in production mode - --dev: Run in development mode - --help, -h: Display this help message - --masqr: Enable masqr - --no-ip-leak: only allow going to asdf.com +\x1b[34;49mEphemeral +\x1b[37;49m +default: Run in production mode +--port : Specify the port to run on +--dev: Run in development mode +--help, -h: Display this help message +--masqr: Enable masqr +--no-ip-leak: only allow going to asdf.com `); process.exit(0); } const bare = createBareServer("/bend/", { maintainer: { website: "https://z1g-project.vercel.app", + // todo: change this + email: "tgt@incognitotgt.me", }, }); const vite = await createViteServer({ server: { middlewareMode: true }, }); const app = express(); -const port = process.env.PORT || 8080; const corsOptions = { origin: `http://localhost:${port}`, methods: "GET,HEAD,PUT,PATCH,POST,DELETE", @@ -65,6 +71,26 @@ const setCjsHeaders = { }; app.use(compression(compressionOptions)); app.use(cors(corsOptions)); +app.get("/json/apps", async (_, response) => { + try { + const data = await fetch("https://incognitotgt.me/ephemeral/apps.json") + .then(statusValidator) + .then((response) => response.json()) + .then((response) => Array(20).fill(response).flat()) + .catch(statusCatcher); + + response.json({ status: "success", data }); + } catch (error) { + console.log(error); + response.status(500).json({ + status: "error", + error: { + message: "An error occurred while retrieving the apps", + detail: error, + }, + }); + } +}); if (!devMode) { app.use(express.static("dist", setCjsHeaders)); } else { @@ -106,26 +132,6 @@ app.get("/search", async (request, response) => { }); } }); -app.get("/json/apps", async (_, response) => { - try { - const data = await fetch("https://incognitotgt.me/ephemeral/apps.json") - .then(statusValidator) - .then((response) => response.json()) - .then((response) => Array(20).fill(response).flat()) - .catch(statusCatcher); - - response.json({ status: "success", data }); - } catch (error) { - console.log(error); - response.status(500).json({ - status: "error", - error: { - message: "An error occurred while retrieving the apps", - detail: error, - }, - }); - } -}); if (!devMode) { app.get("*", (_, response) => { response.sendFile(path.resolve("dist", "index.html")); @@ -164,9 +170,8 @@ server.on("upgrade", (req: IncomingMessage, socket: Socket, head) => { server.listen({ port: port, }); -console.log( - `\x1b[34;49;1m[Ephemeral] \x1B[32mINFO: Running on port ${port} in ${devMode ? "dev" : "production"} mode -\x1b[34;49;1m[Ephemeral] \x1B[32mINFO: Configured with Masqr: ${masqr} -\x1b[34;49;1m[Ephemeral] \x1B[32mINFO: Configured with IP Leak Protection: ${noIpLeak} - `, -); +console.log(` +\x1b[34;49;1m[Ephemeral] \x1B[32mINFO: Running on port ${port} in ${devMode ? "dev" : "production"} mode +Configured with Masqr: ${masqr} +Configured with IP Leak Protection: ${noIpLeak} +`); diff --git a/package.json b/package.json index 296c3d2..c16a3db 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,17 @@ { "name": "ephemeral", "private": true, - "version": "0.7.0", + "version": "0.8.0", "type": "module", "scripts": { "preinstall": "npx only-allow pnpm", "ephemeral": "tsx index.ts", - "dev": "pnpm ephemeral --dev", + "dev": "tsx index.ts --dev", "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "format": "prettier --write .", "bstart": "pnpm build && pnpm start", - "start": "pnpm ephemeral" + "start": "tsx index.ts" }, "dependencies": { "@mercuryworkshop/bare-mux": "^1.0.5", diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx deleted file mode 100644 index 095e20e..0000000 --- a/src/components/Navbar.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { Link } from "react-router-dom"; -import { - NavigationMenu, - NavigationMenuItem, - NavigationMenuLink, - NavigationMenuList, - navigationMenuTriggerStyle, -} from "@/components/ui/navigation-menu"; -const links: { - href: string; - text: string; -}[] = [ - { href: "/", text: "Home" }, - { href: "/settings", text: "Settings" }, - { href: "/apps", text: "Apps" }, -]; -export default function Navbar() { - return ( -
-
- Ephemeral -
-
- - - {links.map((link) => ( - - - {link.text} - - - ))} - - -
-
- ); -} diff --git a/src/layout.tsx b/src/layout.tsx index 5e76fa9..f0e7f92 100644 --- a/src/layout.tsx +++ b/src/layout.tsx @@ -4,7 +4,7 @@ import Meta from "@/components/Meta"; import { Toaster } from "@/components/ui/toaster"; import { ThemeProvider } from "@/components/theme-provider"; import { Link } from "react-router-dom"; -import { LucideHome, Settings, LayoutGrid } from "lucide-react"; +import { LucideHome, Settings, LayoutGrid, CircleDashed } from "lucide-react"; import { NavigationMenu, NavigationMenuItem, @@ -27,7 +27,10 @@ function Navbar() { return (
- Ephemeral + + + Ephemeral +
diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index 1782f8b..052a2e6 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -2,7 +2,7 @@ import ProxySettings from "./settings/ProxySettings"; import CloakSettings from "./settings/CloakSettings"; import SearchSettings from "./settings/SearchSettings"; import Header from "@/components/Header"; -import { Info } from "lucide-react"; +import { Info, CircleDashed } from "lucide-react"; import { Button } from "@/components/ui/button"; import { ModeToggle } from "@/components/mode-toggle"; import lastPushDate from "@/push-date?raw"; @@ -41,15 +41,14 @@ export default function Settings() { - - Ephemeral 0.7.0 - Beta + + + Ephemeral 0.8.0 - Beta - Ephemeral Ephemeral is a powerful proxy with Ultraviolet and other features, made by the z1g Project.