parent
529f943646
commit
420cacd8c9
5 changed files with 152 additions and 158 deletions
132
package.json
132
package.json
|
|
@ -1,66 +1,66 @@
|
|||
{
|
||||
"name": "nebula",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "concurrently \"vite\" \"bare-server-node --port 8080\"",
|
||||
"build": "vite build",
|
||||
"bstart": "npm run build && tsx server.ts",
|
||||
"start": "tsx server.ts",
|
||||
"preview": "vite preview",
|
||||
"format": "prettier --write ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@fastify/compress": "^6.5.0",
|
||||
"@fastify/cookie": "^9.3.1",
|
||||
"@fastify/static": "^6.12.0",
|
||||
"@mercuryworkshop/bare-mux": "^1.0.5",
|
||||
"@mercuryworkshop/epoxy-transport": "^1.1.0",
|
||||
"@mercuryworkshop/libcurl-transport": "^1.2.2",
|
||||
"@nebula-services/dynamic": "0.7.2-patch.2",
|
||||
"@titaniumnetwork-dev/ultraviolet": "^3.0.0",
|
||||
"@tomphttp/bare-server-node": "2.0.3",
|
||||
"@tsparticles/engine": "^3.3.0",
|
||||
"@tsparticles/react": "^3.0.0",
|
||||
"@tsparticles/slim": "^3.3.0",
|
||||
"@types/express": "^4.17.21",
|
||||
"chalk": "^5.3.0",
|
||||
"classnames": "^2.5.1",
|
||||
"compression": "^1.7.4",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"crypto-js": "^4.2.0",
|
||||
"express": "^4.18.3",
|
||||
"fastify": "^4.26.2",
|
||||
"framer-motion": "^10.18.0",
|
||||
"i18next": "^23.10.1",
|
||||
"i18next-browser-languagedetector": "^7.2.0",
|
||||
"localforage": "^1.10.0",
|
||||
"million": "^2.6.4",
|
||||
"preact": "^10.19.6",
|
||||
"preact-iso": "^2.4.0",
|
||||
"preact-render-to-string": "^6.4.0",
|
||||
"preact-router": "^4.1.2",
|
||||
"rammerhead": "https://github.com/NebulaServices/rammerhead/releases/download/rammerhead-1.2.41-nebula.8/rammerhead-1.2.41-nebula.7.tgz",
|
||||
"react-helmet": "^6.1.0",
|
||||
"react-i18next": "^13.5.0",
|
||||
"react-icons": "^4.12.0",
|
||||
"react-toastify": "^9.1.3",
|
||||
"tsx": "^4.7.1",
|
||||
"wisp-server-node": "^1.0.2",
|
||||
"ws": "^8.16.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@preact/preset-vite": "^2.8.1",
|
||||
"autoprefixer": "^10.4.18",
|
||||
"concurrently": "^8.2.2",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-preact": "^1.3.0",
|
||||
"postcss": "^8.4.35",
|
||||
"prettier": "^3.2.5",
|
||||
"prettier-plugin-tailwindcss": "^0.5.12",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "^5.4.2",
|
||||
"vite": "^5.1.6",
|
||||
"vite-plugin-static-copy": "^1.0.1"
|
||||
}
|
||||
}
|
||||
{
|
||||
"name": "nebula",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "concurrently \"vite\" \"bare-server-node --port 8080\"",
|
||||
"build": "vite build",
|
||||
"bstart": "npm run build && tsx server.ts",
|
||||
"start": "tsx server.ts",
|
||||
"preview": "vite preview",
|
||||
"format": "prettier --write ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@fastify/compress": "^6.5.0",
|
||||
"@fastify/cookie": "^9.3.1",
|
||||
"@fastify/static": "^6.12.0",
|
||||
"@mercuryworkshop/bare-mux": "^1.0.5",
|
||||
"@mercuryworkshop/epoxy-transport": "^1.1.0",
|
||||
"@mercuryworkshop/libcurl-transport": "^1.2.2",
|
||||
"@nebula-services/dynamic": "0.7.2-patch.2",
|
||||
"@titaniumnetwork-dev/ultraviolet": "^3.0.0",
|
||||
"@tomphttp/bare-server-node": "2.0.3",
|
||||
"@tsparticles/engine": "^3.3.0",
|
||||
"@tsparticles/react": "^3.0.0",
|
||||
"@tsparticles/slim": "^3.3.0",
|
||||
"@types/express": "^4.17.21",
|
||||
"chalk": "^5.3.0",
|
||||
"classnames": "^2.5.1",
|
||||
"compression": "^1.7.4",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"crypto-js": "^4.2.0",
|
||||
"express": "^4.18.3",
|
||||
"fastify": "^4.26.2",
|
||||
"framer-motion": "^10.18.0",
|
||||
"i18next": "^23.10.1",
|
||||
"i18next-browser-languagedetector": "^7.2.0",
|
||||
"localforage": "^1.10.0",
|
||||
"million": "^2.6.4",
|
||||
"preact": "^10.19.6",
|
||||
"preact-iso": "^2.4.0",
|
||||
"preact-render-to-string": "^6.4.0",
|
||||
"preact-router": "^4.1.2",
|
||||
"rammerhead": "https://github.com/NebulaServices/rammerhead/releases/download/rammerhead-1.2.41-nebula.8/rammerhead-1.2.41-nebula.7.tgz",
|
||||
"react-helmet": "^6.1.0",
|
||||
"react-i18next": "^13.5.0",
|
||||
"react-icons": "^4.12.0",
|
||||
"react-toastify": "^9.1.3",
|
||||
"tsx": "^4.7.1",
|
||||
"wisp-server-node": "^1.0.2",
|
||||
"ws": "^8.16.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@preact/preset-vite": "^2.8.1",
|
||||
"autoprefixer": "^10.4.18",
|
||||
"concurrently": "^8.2.2",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-preact": "^1.3.0",
|
||||
"postcss": "^8.4.35",
|
||||
"prettier": "^3.2.5",
|
||||
"prettier-plugin-tailwindcss": "^0.5.12",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "^5.4.2",
|
||||
"vite": "^5.1.6",
|
||||
"vite-plugin-static-copy": "^1.0.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,80 +1,76 @@
|
|||
import { FaAngleDown } from "react-icons/fa";
|
||||
import { useState, useEffect } from "preact/hooks";
|
||||
import { changeTransport } from "../../util/transports.ts";
|
||||
const wispUrl =
|
||||
localStorage.getItem("wispUrl") ||
|
||||
(location.protocol === "https:" ? "wss://" : "ws://") +
|
||||
location.host +
|
||||
"/wisp/";
|
||||
|
||||
interface Option {
|
||||
id: string;
|
||||
label: string; // Translations CAN be passed
|
||||
}
|
||||
|
||||
const TransportDropdown = ({
|
||||
storageKey,
|
||||
options,
|
||||
refresh
|
||||
}: {
|
||||
storageKey: string;
|
||||
options: Option[];
|
||||
refresh: boolean;
|
||||
}) => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
const [choice, setChoice] = useState(() => {
|
||||
return localStorage.getItem(storageKey) || options[0]?.id || "";
|
||||
});
|
||||
|
||||
// update on localstorage change
|
||||
useEffect(() => {
|
||||
setChoice(localStorage.getItem(storageKey) || options[0]?.id || "");
|
||||
}, [storageKey, options]);
|
||||
|
||||
return (
|
||||
<div className="relative text-center">
|
||||
<div
|
||||
className={`font-roboto flex h-14 w-56 cursor-pointer flex-col items-center justify-center border border-input-border-color bg-input text-center text-xl ${
|
||||
isOpen ? "rounded-t-2xl" : "rounded-2xl"
|
||||
}`}
|
||||
onClick={() => setIsOpen(!isOpen)}
|
||||
>
|
||||
<div className="flex h-full w-full select-none flex-row items-center">
|
||||
<div className="h-full w-1/4"></div>
|
||||
<div className="flex w-2/4 flex-col items-center text-input-text">
|
||||
{options.find((o) => o.id === choice)?.label}
|
||||
</div>
|
||||
<div className="flex w-1/4 flex-col items-center text-input-text">
|
||||
<FaAngleDown />
|
||||
</div>
|
||||
</div>
|
||||
{isOpen && (
|
||||
<div className="absolute top-full w-full">
|
||||
{options.map((option, index) => (
|
||||
<div
|
||||
key={option.id}
|
||||
className={`border border-input-border-color bg-input p-2 text-input-text hover:bg-dropdown-option-hover-color ${
|
||||
index === options.length - 1 ? "rounded-b-2xl" : ""
|
||||
}`}
|
||||
onClick={() => {
|
||||
setIsOpen(false);
|
||||
setChoice(option.id);
|
||||
localStorage.setItem(storageKey, option.id);
|
||||
changeTransport(option.id, wispUrl);
|
||||
if (refresh === true) {
|
||||
window.location.reload();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{option.label}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default TransportDropdown;
|
||||
import { FaAngleDown } from "react-icons/fa";
|
||||
import { useState, useEffect } from "preact/hooks"
|
||||
import { changeTransport } from "../../util/transports.ts";
|
||||
const wispUrl = localStorage.getItem("wispUrl") || (location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/wisp/";
|
||||
|
||||
interface Option {
|
||||
id: string;
|
||||
label: string; // Translations CAN be passed
|
||||
}
|
||||
|
||||
const TransportDropdown = ({
|
||||
storageKey,
|
||||
options,
|
||||
refresh
|
||||
}: {
|
||||
storageKey: string;
|
||||
options: Option[];
|
||||
refresh: boolean;
|
||||
}) => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
const [choice, setChoice] = useState(() => {
|
||||
return localStorage.getItem(storageKey) || options[0]?.id || "";
|
||||
});
|
||||
|
||||
// update on localstorage change
|
||||
useEffect(() => {
|
||||
setChoice(localStorage.getItem(storageKey) || options[0]?.id || "");
|
||||
}, [storageKey, options]);
|
||||
|
||||
return (
|
||||
<div className="relative text-center">
|
||||
<div
|
||||
className={`font-roboto flex h-14 w-56 cursor-pointer flex-col items-center justify-center border border-input-border-color bg-input text-center text-xl ${
|
||||
isOpen ? "rounded-t-2xl" : "rounded-2xl"
|
||||
}`}
|
||||
onClick={() => setIsOpen(!isOpen)}
|
||||
>
|
||||
<div className="flex h-full w-full select-none flex-row items-center">
|
||||
<div className="h-full w-1/4"></div>
|
||||
<div className="flex w-2/4 flex-col items-center text-input-text">
|
||||
{options.find((o) => o.id === choice)?.label}
|
||||
</div>
|
||||
<div className="flex w-1/4 flex-col items-center text-input-text">
|
||||
<FaAngleDown />
|
||||
</div>
|
||||
</div>
|
||||
{isOpen && (
|
||||
<div className="absolute top-full w-full">
|
||||
{options.map((option, index) => (
|
||||
<div
|
||||
key={option.id}
|
||||
className={`border border-input-border-color bg-input p-2 text-input-text hover:bg-dropdown-option-hover-color ${
|
||||
index === options.length - 1 ? "rounded-b-2xl" : ""
|
||||
}`}
|
||||
onClick={() => {
|
||||
setIsOpen(false);
|
||||
setChoice(option.id);
|
||||
localStorage.setItem(storageKey, option.id);
|
||||
changeTransport(option.id, wispUrl);
|
||||
if (refresh === true) {
|
||||
window.location.reload();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{option.label}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default TransportDropdown;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { Settings } from "./pages/Settings/";
|
|||
import { AboutBlank } from "./AboutBlank";
|
||||
import { Faq } from "./pages/Faq";
|
||||
|
||||
//import the transport util
|
||||
//import the transport util
|
||||
import { setTransport } from "./util/transports";
|
||||
|
||||
import "./style.css";
|
||||
|
|
@ -22,9 +22,7 @@ export default function Routes() {
|
|||
scope: "/~/"
|
||||
})
|
||||
.then(() => {
|
||||
console.log(
|
||||
"Service worker registered successfully setting transport"
|
||||
);
|
||||
console.log("Service worker registered successfully setting transport");
|
||||
setTransport();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
export function isIOS() {
|
||||
if (/iPad|iPhone|iPod/.test(navigator.userAgent)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export function isIOS() {
|
||||
if (/iPad|iPhone|iPod/.test(navigator.userAgent)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ registerRemoteListener(navigator.serviceWorker.controller!);
|
|||
|
||||
//changeTransport(
|
||||
// localStorage.getItem("transport") || "libcurl",
|
||||
// localStorage.getItem("wispUrl") || wispUrl
|
||||
// localStorage.getItem("wispUrl") || wispUrl
|
||||
//);
|
||||
|
||||
// helper function for ../routes.tsx
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue