commit 6a578a1c62ffa2345ce958be429df271096f88d5
parent 1ab11ac2754f2967125e79919a2e2a3df2b3b6a4
Author: Alisa Lain <60989682+al1-ce@users.noreply.github.com>
Date: Thu, 10 Jul 2025 01:11:17 +0300
Fix url navigation
Diffstat:
5 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/index.js b/index.js
@@ -10,15 +10,24 @@ app.use(express.static( path.join(__dirname, "public"), { extensions: ["html", "
// app.get("/", (req, res) => serve_html(res, "../pages/main", "index.html"))
-// app.get("/test", (req, res) => res.send("Express test"));
+// app.get("/", (req, res) => res.send("Express test"));
app.all("*", (req, res) => {
- // console.log("url: ", req.baseUrl);
- // console.log("path: ", req.path);
- if (fs.existsSync(path.join(__dirname, "public", req.path + ".md"))) {
+ let mdpath = path.join(__dirname, "public", req.baseUrl + req.path + ".md");
+ // console.log(mdpath);
+
+ // res.status(404).send(
+ // " " + "base: " + req.baseUrl +
+ // " " + "path: " + req.path +
+ // " " + "dnam: " + __dirname +
+ // " " + mdpath +
+ // " " + (fs.existsSync(mdpath) ? "true" : "false")
+ // );
+ if (fs.existsSync(mdpath)) {
res.sendFile(path.join(__dirname, "public/index.html"));
} else {
res.status(404).sendFile(path.join(__dirname, "public/404.html"));
+ // res.status(404).send(mdpath);
}
})
diff --git a/public/404.html b/public/404.html
@@ -22,13 +22,11 @@
</head>
<body>
- <div id="scanlines"></div>
-
<div class="block heavy wide">
<br>
<h1 class="upper glitch">Error: 404</h1><br>
<h2 class="glitch">You've strayed from a set path.</h2>
- <a href="/">Back?</a>
+ <a href="/">Go Back?</a>
</div>
<script src="/js/index.js"></script>
diff --git a/public/index.html b/public/index.html
@@ -14,22 +14,10 @@
<body>
<style>
- .app-name, .sidebar-nav, .sidebar-toggle-button {
+ .app-name, .sidebar-nav, .sidebar-toggle-button, .sidebar {
display: none !important;
}
- .sidebar {
- position: fixed !important;
- }
-
- .sidebar+.content {
- margin-left: 0 !important;
- }
-
- .sidebar, .sidebar-toggle, .sidebar+.content {
- transition: none !important;
- }
-
.app-nav.no-badge {
right: 80px;
}
@@ -186,7 +174,8 @@
let sbar = document.querySelector(".sidebar > .search");
document.getElementById("app-nav").insertBefore(sbar, document.getElementById("nav-edit"));
- document.querySelector(".sidebar").remove();
+ // have to keep it for search
+ // document.querySelector(".sidebar").remove();
let result = document.querySelector(".search > .results-panel");
let input = document.querySelector(".search input");
result.addEventListener("click", function() {
diff --git a/public/wiki/CNameless_Rumia.md b/public/wiki/CNameless_Rumia.md
@@ -0,0 +1 @@
+is a dude
diff --git a/vercel.json b/vercel.json
@@ -0,0 +1,15 @@
+{
+ "version": 2,
+ "builds": [
+ {
+ "src": "./index.js",
+ "use": "@vercel/node"
+ }
+ ],
+ "routes": [
+ {
+ "src": "/(.*)",
+ "dest": "/"
+ }
+ ]
+}