Skip to content

Commit

Permalink
reverted uv version due to to issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pyro committed Mar 24, 2024
1 parent 366c845 commit 25fbb57
Show file tree
Hide file tree
Showing 20 changed files with 543 additions and 146 deletions.
48 changes: 48 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import http from 'node:http';
import { createBareServer } from '@tomphttp/bare-server-node';
import express from 'express';
import { hostname } from "node:os";

const httpServer = http.createServer();

const app = express();

app.use(express.static("src"));

const bareServer = createBareServer('/y/');



httpServer.on('request', (req, res) => {
if (bareServer.shouldRoute(req)) {
bareServer.routeRequest(req, res);
} else {
app(req, res);
}
});

httpServer.on('upgrade', (req, socket, head) => {
if (bareServer.shouldRoute(req)) {
bareServer.routeUpgrade(req, socket, head);
} else {
socket.end();
}
});

httpServer.on('listening', () => {
const address = httpServer.address();
console.log("Listening on:");
console.log(`\thttp://localhost:${address.port}`);
console.log(`\thttp://${hostname()}:${address.port}`);
console.log(
`\thttp://${
address.family === "IPv6" ? `[${address.address}]` : address.address
}:${address.port}`
);
});



httpServer.listen({
port: 8080,
});
80 changes: 79 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@nlux/core": "^0.12.1",
"@nlux/openai": "^0.12.1",
"@titaniumnetwork-dev/ultraviolet": "^3.0.0",
"@tomphttp/bare-server-node": "^2.0.3",
"express": "^4.18.2",
"flowbite": "^2.3.0",
"wisp-server-node": "^1.0.2"
Expand Down
68 changes: 0 additions & 68 deletions server.mjs

This file was deleted.

4 changes: 2 additions & 2 deletions src/frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
</script>

<body>
<script src="dist/bundle.js" defer></script>
<script src="dist/config.js" defer></script>
<script src="uv/uv.bundle.js" defer></script>
<script src="uv/uv.config.js" defer></script>
<script src="js/frame.js"></script>
<iframe src=""
style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"
Expand Down
2 changes: 0 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

gtag('config', 'G-FDX137ZK6F');
</script>
<script src="baremux/bare.cjs"></script>
<script src="epoxy/index.js"></script>
<script src="uv/uv.bundle.js"></script>
<script src="uv/uv.config.js"></script>
<script src="js/main.js"></script>
Expand Down
29 changes: 18 additions & 11 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,26 @@ function urlify(input) {
return input;
}

async function registerSW() {
console.log("hi");
if (!navigator.serviceWorker) {
if (location.protocol !== "https:")
throw new Error("Service workers cannot be registered without https.");

throw new Error("Your browser doesn't support service workers.");
const stockSW = "../sw.js";
const swAllowedHostnames = ["localhost", "127.0.0.1"];

async function registerSW() {
if (!navigator.serviceWorker) {
if (
location.protocol !== "https:" &&
!swAllowedHostnames.includes(location.hostname)
)
throw new Error("Service workers cannot be registered without https.");

throw new Error("Your browser doesn't support service workers.");
}

await navigator.serviceWorker.register(stockSW, {
scope: __uv$config.prefix,
});
}

await navigator.serviceWorker.register("/uv/sw.js", {
scope: __uv$config.prefix
});
}


window.addEventListener("load", async function () {
await registerSW();
Expand Down
3 changes: 0 additions & 3 deletions src/js/pframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ const plugins = [
];

window.addEventListener("load", async function () {
let wispUrl = (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/";
BareMux.SetTransport("EpxMod.EpoxyClient", { wisp: wispUrl });
await registerSW();
const searchField = document.getElementById("searchField");
const searchButton = document.getElementById("searchButton");
const urlParams = new URLSearchParams(window.location.search);
Expand Down
2 changes: 0 additions & 2 deletions src/library.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

gtag('config', 'G-FDX137ZK6F');
</script>
<script src="baremux/bare.cjs" defer></script>
<script src="epoxy/index.js" defer></script>
<script src="uv/uv.bundle.js" defer></script>
<script src="uv/uv.config.js" defer></script>
<script src="js/main.js"></script>
Expand Down
2 changes: 0 additions & 2 deletions src/marketplace.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

gtag('config', 'G-FDX137ZK6F');
</script>
<script src="baremux/bare.cjs" defer></script>
<script src="epoxy/index.js" defer></script>
<script src="uv/uv.bundle.js" defer></script>
<script src="uv/uv.config.js" defer></script>

Expand Down
7 changes: 0 additions & 7 deletions src/pframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@

gtag('config', 'G-FDX137ZK6F');
</script>
<script src="baremux/bare.cjs"></script>
<script src="epoxy/index.js"></script>
<script>
let wispUrl = (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/";
BareMux.SetTransport("EpxMod.EpoxyClient", { wisp: wispUrl });
</script>
<script src="uv/uv.bundle.js"></script>
<script src="uv/uv.config.js"></script>
<script src="js/main.js"></script>
Expand All @@ -31,7 +25,6 @@
<body>
<script src="js/pframe.js"></script>


<nav class="bg-gray-100 border-gray-300 ">
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
<div class="flex md:order-2">
Expand Down
3 changes: 0 additions & 3 deletions src/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@
gtag('config', 'G-FDX137ZK6F');
</script>
</script>
<script src="baremux/bare.cjs"></script>
<script src="epoxy/index.js"></script>
<script src="uv/uv.bundle.js"></script>
<script src="uv/uv.config.js"></script>
<script src="js/main.js"></script>


<style>
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration,
Expand Down
3 changes: 0 additions & 3 deletions src/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@

gtag('config', 'G-FDX137ZK6F');
</script>

<script src="baremux/bare.cjs" defer></script>
<script src="epoxy/index.js" defer></script>
<script src="uv/uv.bundle.js" defer></script>
<script src="uv/uv.config.js" defer></script>
<script src="js/main.js"></script>
Expand Down
Loading

0 comments on commit 25fbb57

Please sign in to comment.