From 04a4ce5b6783a5850cbf4e297519d3d83abd28f6 Mon Sep 17 00:00:00 2001 From: James Date: Sat, 3 May 2025 01:37:14 -0700 Subject: [PATCH] Add files via upload --- index.html | 15 ++++------ server.js | 68 ++++++++++++++++++++++++++++++++++++++++++++++ servermanager.html | 15 ++++------ shardwalker.html | 9 +++--- 4 files changed, 84 insertions(+), 23 deletions(-) create mode 100644 server.js diff --git a/index.html b/index.html index 8c399a8..bbe7b7a 100644 --- a/index.html +++ b/index.html @@ -32,17 +32,14 @@ -
- -
-

Welcome to Obli.Studios

Home of Shardwalker and the Obli.ServerManager platform.

diff --git a/server.js b/server.js new file mode 100644 index 0000000..0a647db --- /dev/null +++ b/server.js @@ -0,0 +1,68 @@ +// server.js (Node.js + Express backend) +const express = require('express'); +const fs = require('fs'); +const path = require('path'); +const bodyParser = require('body-parser'); +const cookieParser = require('cookie-parser'); +const jwt = require('jsonwebtoken'); +const app = express(); + +const SECRET_KEY = 'your_super_secret_key'; +const PASSWORD = 'shardwalker2025'; // set your password here +const PORT = 3000; + +app.use(express.static('public')); +app.use(bodyParser.json()); +app.use(cookieParser()); + +// Serve login check +app.get('/check-auth', (req, res) => { + const token = req.cookies.token; + if (!token) return res.status(401).json({ authenticated: false }); + + try { + jwt.verify(token, SECRET_KEY); + res.json({ authenticated: true }); + } catch (err) { + res.status(403).json({ authenticated: false }); + } +}); + +// Login route +app.post('/login', (req, res) => { + const { password } = req.body; + if (password === PASSWORD) { + const token = jwt.sign({ user: 'admin' }, SECRET_KEY, { expiresIn: '1d' }); + res.cookie('token', token, { httpOnly: true }); + res.json({ success: true }); + } else { + res.status(403).json({ success: false }); + } +}); + +// Get current roadmap +app.get('/api/roadmap', (req, res) => { + const data = fs.readFileSync(path.join(__dirname, 'roadmap.json')); + res.json(JSON.parse(data)); +}); + +// Update roadmap status +app.post('/api/roadmap', (req, res) => { + const token = req.cookies.token; + if (!token || !jwt.verify(token, SECRET_KEY)) { + return res.status(403).json({ success: false }); + } + const { id, status } = req.body; + const filePath = path.join(__dirname, 'roadmap.json'); + const roadmap = JSON.parse(fs.readFileSync(filePath)); + const phase = roadmap.find(p => p.id === id); + if (phase) { + phase.status = status; + fs.writeFileSync(filePath, JSON.stringify(roadmap, null, 2)); + res.json({ success: true }); + } else { + res.status(404).json({ success: false }); + } +}); + +app.listen(PORT, () => console.log(`Server running at http://localhost:${PORT}`)); diff --git a/servermanager.html b/servermanager.html index c0aa934..bad3d7f 100644 --- a/servermanager.html +++ b/servermanager.html @@ -24,17 +24,14 @@ -
- -
-

Obli.ServerManager

Manage your dedicated game servers with ease.

diff --git a/shardwalker.html b/shardwalker.html index 61ce873..89882ab 100644 --- a/shardwalker.html +++ b/shardwalker.html @@ -25,14 +25,13 @@ +

Shardwalker: The Mirror's Edge