transition from parchment to downloads
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Downloads</title>
|
||||
<title>Parchment</title>
|
||||
<link rel="icon" href="Quill.png">
|
||||
<style>
|
||||
body {
|
||||
@@ -25,6 +25,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="draggable"></div>
|
||||
<webview src="http://localhost:3020" style="width:100vw; height:100vh;"></webview>
|
||||
<webview src="http://localhost:80" style="width:100vw; height:100vh;"></webview>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -19,13 +19,15 @@ class Server {
|
||||
UIPath = path.join(__dirname, '../ui')
|
||||
|
||||
registerRoutes(router) {
|
||||
router.get('/', this.index)
|
||||
router.get('/*', this.get)
|
||||
return router
|
||||
}
|
||||
|
||||
index = async (req, res) => {
|
||||
let filePath = path.join(this.UIPath, "index.html");
|
||||
res.sendFile(filePath)
|
||||
return
|
||||
|
||||
let html = await fs.readFile(filePath, 'utf-8');
|
||||
|
||||
let downloads = await getAllDownloadsFiles()
|
||||
@@ -42,15 +44,16 @@ class Server {
|
||||
|
||||
get = async (req, res) => {
|
||||
let url = req.url
|
||||
let filePath;
|
||||
if(url.startsWith("/_")) {
|
||||
filePath = path.join(this.UIPath, url);
|
||||
} else if(url.includes("75820185")) {
|
||||
filePath = path.join(this.UIPath, url.split("75820185")[1]);
|
||||
} else {
|
||||
filePath = path.join(this.UIPath, "index.html");
|
||||
}
|
||||
|
||||
let filePath = path.join(this.UIPath, url);
|
||||
|
||||
res.sendFile(filePath, (err) => {
|
||||
if (err) {
|
||||
console.error(`Error serving ${filePath}:`, err);
|
||||
res.status(err.status || 500).send('File not found or error serving file.');
|
||||
}
|
||||
});
|
||||
res.sendFile(filePath);
|
||||
}
|
||||
|
||||
logRequest(req, res, next) {
|
||||
@@ -93,7 +96,7 @@ class Server {
|
||||
|
||||
const server = http.createServer(app);
|
||||
initWebSocket(server);
|
||||
const PORT = 3020;
|
||||
const PORT = 80;
|
||||
server.listen(PORT, () => {
|
||||
console.log("\n")
|
||||
console.log(chalk.yellow("**************Downloads****************"))
|
||||
|
||||
Reference in New Issue
Block a user