css changes

This commit is contained in:
rift 2024-10-04 21:41:04 -05:00
parent 8f1feb8cff
commit df96ced6d9
2 changed files with 395 additions and 123 deletions

247
package-lock.json generated
View file

@ -16,8 +16,9 @@
"@fastify/static": "^7.0.4",
"@iconify-json/ph": "^1.2.0",
"@mercuryworkshop/bare-mux": "1.1.1",
"@mercuryworkshop/epoxy-tls": "2.1.4-1",
"@mercuryworkshop/epoxy-tls": "2.0.0-3",
"@mercuryworkshop/epoxy-transport": "2.0.1",
"@mercuryworkshop/libcurl-transport": "1.3.2",
"@titaniumnetwork-dev/ultraviolet": "3.1.2",
"astro": "^4.15.9",
"astro-icon": "^1.1.1",
@ -26,15 +27,20 @@
"fastify": "^4.28.1",
"form-data": "^4.0.0",
"formdata-node": "^6.0.3",
"libcurl.js-new": "npm:libcurl.js@^0.6.16",
"multer": "1.4.5-lts.1",
"nanostores": "^0.10.3",
"sequelize": "^6.37.3",
"sqlite3": "^5.1.7",
"svelte": "^4.2.19",
"svelte-french-toast": "^1.2.0",
"tailwindcss": "^3.4.13",
"typescript": "^5.6.2",
"vite-plugin-static-copy": "^1.0.6",
"wisp-server-node": "^1.1.7"
},
"devDependencies": {
"@biomejs/biome": "^1.9.3"
}
},
"node_modules/@alloc/quick-lru": {
@ -596,6 +602,161 @@
"node": ">=6.9.0"
}
},
"node_modules/@biomejs/biome": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.3.tgz",
"integrity": "sha512-POjAPz0APAmX33WOQFGQrwLvlu7WLV4CFJMlB12b6ZSg+2q6fYu9kZwLCOA+x83zXfcPd1RpuWOKJW0GbBwLIQ==",
"dev": true,
"hasInstallScript": true,
"bin": {
"biome": "bin/biome"
},
"engines": {
"node": ">=14.21.3"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/biome"
},
"optionalDependencies": {
"@biomejs/cli-darwin-arm64": "1.9.3",
"@biomejs/cli-darwin-x64": "1.9.3",
"@biomejs/cli-linux-arm64": "1.9.3",
"@biomejs/cli-linux-arm64-musl": "1.9.3",
"@biomejs/cli-linux-x64": "1.9.3",
"@biomejs/cli-linux-x64-musl": "1.9.3",
"@biomejs/cli-win32-arm64": "1.9.3",
"@biomejs/cli-win32-x64": "1.9.3"
}
},
"node_modules/@biomejs/cli-darwin-arm64": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.3.tgz",
"integrity": "sha512-QZzD2XrjJDUyIZK+aR2i5DDxCJfdwiYbUKu9GzkCUJpL78uSelAHAPy7m0GuPMVtF/Uo+OKv97W3P9nuWZangQ==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-darwin-x64": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.3.tgz",
"integrity": "sha512-vSCoIBJE0BN3SWDFuAY/tRavpUtNoqiceJ5PrU3xDfsLcm/U6N93JSM0M9OAiC/X7mPPfejtr6Yc9vSgWlEgVw==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-linux-arm64": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.3.tgz",
"integrity": "sha512-vJkAimD2+sVviNTbaWOGqEBy31cW0ZB52KtpVIbkuma7PlfII3tsLhFa+cwbRAcRBkobBBhqZ06hXoZAN8NODQ==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-linux-arm64-musl": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.3.tgz",
"integrity": "sha512-VBzyhaqqqwP3bAkkBrhVq50i3Uj9+RWuj+pYmXrMDgjS5+SKYGE56BwNw4l8hR3SmYbLSbEo15GcV043CDSk+Q==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-linux-x64": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.3.tgz",
"integrity": "sha512-x220V4c+romd26Mu1ptU+EudMXVS4xmzKxPVb9mgnfYlN4Yx9vD5NZraSx/onJnd3Gh/y8iPUdU5CDZJKg9COA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-linux-x64-musl": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.3.tgz",
"integrity": "sha512-TJmnOG2+NOGM72mlczEsNki9UT+XAsMFAOo8J0me/N47EJ/vkLXxf481evfHLlxMejTY6IN8SdRSiPVLv6AHlA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-win32-arm64": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.3.tgz",
"integrity": "sha512-lg/yZis2HdQGsycUvHWSzo9kOvnGgvtrYRgoCEwPBwwAL8/6crOp3+f47tPwI/LI1dZrhSji7PNsGKGHbwyAhw==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-win32-x64": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.3.tgz",
"integrity": "sha512-cQMy2zanBkVLpmmxXdK6YePzmZx0s5Z7KEnwmrW54rcXK3myCNbQa09SwGZ8i/8sLw0H9F3X7K4rxVNGU8/D4Q==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@emmetio/abbreviation": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/@emmetio/abbreviation/-/abbreviation-2.3.3.tgz",
@ -1640,10 +1801,9 @@
}
},
"node_modules/@mercuryworkshop/epoxy-tls": {
"version": "2.1.4-1",
"resolved": "https://registry.npmjs.org/@mercuryworkshop/epoxy-tls/-/epoxy-tls-2.1.4-1.tgz",
"integrity": "sha512-kRbW12tU4TAf9GuoLfyFYvUATqFZq6n9ScRSfwAECceOBWDlr+bACnSH45lLDXvjBKwxZotTyYE5aNc+Ow+M3Q==",
"license": "AGPL-3.0-only"
"version": "2.0.0-3",
"resolved": "https://registry.npmjs.org/@mercuryworkshop/epoxy-tls/-/epoxy-tls-2.0.0-3.tgz",
"integrity": "sha512-iC5CViTh2xn44xtjvDW4YW9qoeoJcCBOqcNmffBx3RHdK7FAzAWFHLTUBtdlnMVv6cjYZtV+eUTzxyreqlgOVA=="
},
"node_modules/@mercuryworkshop/epoxy-transport": {
"version": "2.0.1",
@ -1658,11 +1818,18 @@
"ws": "8.16.0"
}
},
"node_modules/@mercuryworkshop/epoxy-transport/node_modules/@mercuryworkshop/epoxy-tls": {
"version": "2.0.0-3",
"resolved": "https://registry.npmjs.org/@mercuryworkshop/epoxy-tls/-/epoxy-tls-2.0.0-3.tgz",
"integrity": "sha512-iC5CViTh2xn44xtjvDW4YW9qoeoJcCBOqcNmffBx3RHdK7FAzAWFHLTUBtdlnMVv6cjYZtV+eUTzxyreqlgOVA==",
"license": "LGPL-3.0-only"
"node_modules/@mercuryworkshop/libcurl-transport": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@mercuryworkshop/libcurl-transport/-/libcurl-transport-1.3.2.tgz",
"integrity": "sha512-1KJZu1JxgqsEnH9oZumwgv4BsCRREJxXlEX43cmS7s8ittDeozoI3kLci8x2b3P1nn8B3Jy3+zDRA+iEzzEl/w==",
"dependencies": {
"esbuild-plugin-umd-wrapper": "^2.0.0",
"libcurl.js": "^0.6.8",
"rollup": "^4.12.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-typescript2": "^0.36.0",
"ws": "8.16.0"
}
},
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
@ -6337,6 +6504,17 @@
"integrity": "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==",
"license": "MIT"
},
"node_modules/libcurl.js": {
"version": "0.6.16",
"resolved": "https://registry.npmjs.org/libcurl.js/-/libcurl.js-0.6.16.tgz",
"integrity": "sha512-aR56ZgHjzUVRVU3l+XQIBIuZwTc7k6CUrwbH0v6GAyXreL5rluWjLOc3GtDAgK9JEBZi1aVSrNdBtqE669NGCw=="
},
"node_modules/libcurl.js-new": {
"name": "libcurl.js",
"version": "0.6.16",
"resolved": "https://registry.npmjs.org/libcurl.js/-/libcurl.js-0.6.16.tgz",
"integrity": "sha512-aR56ZgHjzUVRVU3l+XQIBIuZwTc7k6CUrwbH0v6GAyXreL5rluWjLOc3GtDAgK9JEBZi1aVSrNdBtqE669NGCw=="
},
"node_modules/light-my-request": {
"version": "5.13.0",
"resolved": "https://registry.npmjs.org/light-my-request/-/light-my-request-5.13.0.tgz",
@ -8843,16 +9021,16 @@
}
},
"node_modules/prettier": {
"version": "2.8.7",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz",
"integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==",
"license": "MIT",
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
"integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
"optional": true,
"peer": true,
"bin": {
"prettier": "bin-prettier.js"
"prettier": "bin/prettier.cjs"
},
"engines": {
"node": ">=10.13.0"
"node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
@ -10511,6 +10689,17 @@
"node": ">=16"
}
},
"node_modules/svelte-french-toast": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/svelte-french-toast/-/svelte-french-toast-1.2.0.tgz",
"integrity": "sha512-5PW+6RFX3xQPbR44CngYAP1Sd9oCq9P2FOox4FZffzJuZI2mHOB7q5gJBVnOiLF5y3moVGZ7u2bYt7+yPAgcEQ==",
"dependencies": {
"svelte-writable-derived": "^3.1.0"
},
"peerDependencies": {
"svelte": "^3.57.0 || ^4.0.0"
}
},
"node_modules/svelte-hmr": {
"version": "0.16.0",
"resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.16.0.tgz",
@ -10523,6 +10712,17 @@
"svelte": "^3.19.0 || ^4.0.0"
}
},
"node_modules/svelte-writable-derived": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/svelte-writable-derived/-/svelte-writable-derived-3.1.1.tgz",
"integrity": "sha512-w4LR6/bYZEuCs7SGr+M54oipk/UQKtiMadyOhW0PTwAtJ/Ai12QS77sLngEcfBx2q4H8ZBQucc9ktSA5sUGZWw==",
"funding": {
"url": "https://ko-fi.com/pixievoltno1"
},
"peerDependencies": {
"svelte": "^3.2.1 || ^4.0.0-next.1 || ^5.0.0-next.94"
}
},
"node_modules/svelte2tsx": {
"version": "0.7.21",
"resolved": "https://registry.npmjs.org/svelte2tsx/-/svelte2tsx-0.7.21.tgz",
@ -12077,6 +12277,21 @@
"prettier": "2.8.7"
}
},
"node_modules/yaml-language-server/node_modules/prettier": {
"version": "2.8.7",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz",
"integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==",
"optional": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/yaml-language-server/node_modules/request-light": {
"version": "0.5.8",
"resolved": "https://registry.npmjs.org/request-light/-/request-light-0.5.8.tgz",

View file

@ -3,7 +3,10 @@ import Logo from "@components/Logo.astro";
import Layout from "@layouts/Layout.astro";
import { getLangFromUrl, useTranslations } from "../../i18n/utils";
export function getStaticPaths() {
const STATIC_PATHS = [{ params: { lang: "en_US" } }, { params: { lang: "jp" } }];
const STATIC_PATHS = [
{ params: { lang: "en_US" } },
{ params: { lang: "jp" } },
];
return STATIC_PATHS;
}
export const prerender = true;
@ -15,7 +18,9 @@ const t = useTranslations(lang);
<div
class="flex flex-wrap mt-16 justify-center content-center w-full bg-primary fixed inset-0 h-[calc(100%-4rem)] z-0 flex-col items-center"
>
<div class="w-full flex flex-col justify-center items-center content-center h-2/4">
<div
class="w-full flex flex-col justify-center items-center content-center h-2/4"
>
<div class="flex flex-row items-center mb-8">
<div class="h-32 w-32 fill-navbar-text-color">
<Logo />
@ -31,34 +36,56 @@ const t = useTranslations(lang);
class="transition-all duration-300 font-roboto h-14 rounded-t-2xl w-10/12 rounded-b-2xl border border-input-border-color bg-input p-2 text-center text-xl text-input-text placeholder:text-input-text roboto focus:outline-none md:w-3/12"
placeholder={t("home.placeholder")}
/>
<div id="omnibox" class="hidden p-1 transition-all duration-300 flex flex-col w-10/12 md:w-3/12 h-full flex-grow bg-input text-center items-center rounded-b-2xl border-input-border-color border-b border-r border-l">
<div
id="omnibox"
class="hidden p-1 transition-all duration-300 flex flex-col w-10/12 md:w-3/12 h-full flex-grow bg-input text-center items-center rounded-b-2xl border-input-border-color border-b border-r border-l"
>
</div>
</div>
<iframe id="neb-iframe" class="hidden z-100 w-full h-full absolute top-0 bottom-0 bg-primary"></iframe>
<iframe
id="neb-iframe"
class="hidden z-100 w-full h-full absolute top-0 bottom-0 bg-primary"
></iframe>
</div>
</Layout>
<script>
import { initSw, setTransport } from "@utils/registerSW.ts"; //../../utils/registerSW.ts
import { WispServerURLS, SearchEngines, Settings, cloak } from "@utils/settings";
import {
WispServerURLS,
SearchEngines,
Settings,
cloak,
} from "@utils/settings";
import { search } from "@utils/search.ts"; //../../utils/search.ts
//@ts-expect-error No types, expected. See: https://github.com/ading2210/libcurl.js for docs on how to use.
import { libcurl } from "libcurl.js-new/bundled";
let libcurlClient: boolean = false;
type Suggestion = {
phrase: string
}
phrase: string;
};
function proxy(term: string) {
const searchEngine = localStorage.getItem(Settings.ProxySettings.searchEngine);
const searchEngine = localStorage.getItem(
Settings.ProxySettings.searchEngine
);
const proxy = localStorage.getItem(Settings.ProxySettings.proxy);
const openIn = localStorage.getItem(Settings.ProxySettings.openIn);
const proxyUrl = __uv$config!.prefix + __uv$config.encodeUrl!(search(term, searchEngine ? SearchEngines[searchEngine] : SearchEngines.ddg));
const proxyUrl =
__uv$config!.prefix +
__uv$config.encodeUrl!(
search(
term,
searchEngine ? SearchEngines[searchEngine] : SearchEngines.ddg
)
);
if (openIn === "a:b" || openIn === "blob") {
return cloak(openIn as string, "https://google.com", `${window.location.origin}${proxyUrl}`);
}
else if(openIn === "direct") {
return window.location.href = proxyUrl;
}
else {
return cloak(
openIn as string,
"https://google.com",
`${window.location.origin}${proxyUrl}`
);
} else if (openIn === "direct") {
return (window.location.href = proxyUrl);
} else {
return proxyUrl;
}
}
@ -72,16 +99,18 @@ const t = useTranslations(lang);
input?.addEventListener("keypress", function (event: any) {
if (event.key === "Enter") {
initSw().then(() => {
setTransport(localStorage.getItem(Settings.ProxySettings.transport) as string).then(() => {
setTransport(
localStorage.getItem(Settings.ProxySettings.transport) as string
).then(() => {
iframe.classList.remove("hidden");
const url = proxy(input?.value);
if (url) {
iframe.src = url;
}
})
})
});
});
}
})
});
input?.addEventListener("input", async function () {
if (!libcurlClient) {
await libcurl.load_wasm();
@ -97,35 +126,63 @@ const t = useTranslations(lang);
omnibox.classList.add("hidden");
}
if (value.length >= 3) {
const resp = await libcurl.fetch(`https://api.duckduckgo.com/ac?q=${encodeURIComponent(value)}&format=json`);
const resp = await libcurl.fetch(
`https://api.duckduckgo.com/ac?q=${encodeURIComponent(value)}&format=json`
);
const data = await resp.json();
if (data) {
omnibox.innerHTML = "";
data.map((results: Suggestion) => {
let span = document.createElement("span");
let pTag = document.createElement("p");
span.classList.add("cursor-pointer", "border-b", "border-input-border-color", "last:rounded-b-xl", "last:border-none", "text-ellipsis", "whitespace-nowrap", "w-full", "text-input-text", "bg-primary", "h-9", "text-xl", "text-align-center", "overflow-hidden", "flex", "items-center", "justify-center", "hover:bg-lighter", "active:bg-primary");
span.classList.add(
"cursor-pointer",
"roboto",
"border-b",
"border-input-border-color",
"last:rounded-b-xl",
"last:border-none",
"text-ellipsis",
"whitespace-nowrap",
"w-full",
"text-input-text",
"h-9",
"text-xl",
"text-align-center",
"overflow-hidden",
"flex",
"items-center",
"justify-center",
"hover:bg-lighter",
"active:bg-primary"
);
span.addEventListener("click", function () {
//When the box is clicked, we want to fill the omnibox and hit enter. This allows us to re-use the existing event listener on the input.
const event = new KeyboardEvent("keypress", {
key: 'Enter',
code: 'Enter',
key: "Enter",
code: "Enter",
which: 13,
keyCode: 13
keyCode: 13,
});
input.value = results.phrase;
input.dispatchEvent(event);
});
pTag.classList.add("cursor-pointer", "text-ellipsis", "text-center", "w-full", "overflow-hidden", "whitespace-nowrap")
pTag.classList.add(
"cursor-pointer",
"text-ellipsis",
"text-center",
"w-full",
"overflow-hidden",
"whitespace-nowrap"
);
pTag.innerText = results.phrase;
span.appendChild(pTag);
omnibox.appendChild(span);
})
});
}
}
});
}
catch (_) {
} catch (_) {
//we purposely don't return anything
//console.debug(err);
}