1
0
Fork 0

No longer serving HTML directly serving image to end user

This commit is contained in:
grumbulon 2022-04-04 12:54:08 -04:00
parent 8d70e670ee
commit 2bbda3e363
4 changed files with 7 additions and 60 deletions

View File

@ -3,6 +3,7 @@
It's like foxrudor.de for anime girls, but worse
## Server Install
Clone the repo to where ever you will be hosting this and run the following command to install the dependencies.
```
@ -12,12 +13,15 @@ npm install
Now that the dependencies are taken care of you can verify it runs with `npm start` in the root directory of the project. If it tells you it is listening on a port you're probably good to go.
## Running as a service
I don't know anything so I spent some time (10 minutes) creating the provided sample systemd service file.
I don't know anything so I spent some time (10 minutes) creating the provided sample systemd service file.
The user in the file needs accesss to the assets directory under `./waifurudor.de/src/public/` so the """app""" can pull images from Danbooru.
## Nginx
Yeah I set up a .conf file for this for my test instance but it sucks and you could probably do better so I won't share it just know it is possible to actually run this as a website.
### What's next
I have some small improvements in mind before I give up and call this "done".
I have some small improvements in mind before I give up and call this "done".

View File

@ -4,12 +4,10 @@ import express from "express";
const app = express();
const port = 3000;
app.use("/assets", express.static("src/public/assets"));
app.get("/", (req, res) => {
res.set("Cache-Control", "no-store");
main();
res.sendFile("src/public/index.html", { root: "." });
res.sendFile("src/public/assets/waifu.png", { root: "." });
});
app.listen(port, () => {

View File

@ -1,38 +0,0 @@
body {
background-color: black;
}
.parent {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: auto;
grid-column-gap: 0px;
grid-row-gap: 30px;
}
.container {
font-size: 1.2em;
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
}
.center-screen {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
max-width: 950px;
}
.imgbox {
display: grid;
height: 100%;
}
.img-container {
max-width: 100%;
max-height: 100vh;
margin: auto;
}

View File

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="assets/main.css" />
<title>Waifu</title>
</head>
<body>
<div class="center-screen container">
<div class="parent">
<div class="imgbox">
<img src="./assets/waifu.png" class="img-container" />
</div>
</div>
</div>
</body>
</html>