diff options
author | terminaldweller <thabogre@gmail.com> | 2021-11-11 06:12:32 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2021-11-11 06:12:32 +0000 |
commit | 00301734db0e9492ac636f8e99db65b34542224d (patch) | |
tree | 142b7e8b9293b5536d1f7e5f5a717073eac37c1f | |
parent | http2 WIP (diff) | |
download | blog-00301734db0e9492ac636f8e99db65b34542224d.tar.gz blog-00301734db0e9492ac636f8e99db65b34542224d.zip |
changes the layout of the bloghttps
Diffstat (limited to '')
-rw-r--r-- | Dockerfile | 1 | ||||
-rw-r--r-- | css/master.css | 3 | ||||
-rw-r--r-- | docker-compose-test.yaml | 17 | ||||
-rw-r--r-- | docker-compose.yaml | 7 | ||||
-rwxr-xr-x | server.js | 48 | ||||
-rw-r--r-- | static/about.html | 23 | ||||
-rw-r--r-- | views/archive.ejs | 19 | ||||
-rw-r--r-- | views/index.ejs | 9 |
8 files changed, 108 insertions, 19 deletions
@@ -9,6 +9,7 @@ COPY ./package.* /server/ RUN cd /server && npm install --production COPY ./css /server/css/ COPY ./views /server/views/ +COPY ./static /server/static/ COPY ./mds /server/mds/ COPY ./server.js /server/ ENTRYPOINT ["/server/server.js"] diff --git a/css/master.css b/css/master.css index 0f819e3..fd79a28 100644 --- a/css/master.css +++ b/css/master.css @@ -17,7 +17,8 @@ body { font-family: "DejaVuSansMono NF", Helvetica, monospace; overflow-wrap: break-word; float: left; - width: 78%; + /* width: 78%; */ + width: 95%; } .sidenav { diff --git a/docker-compose-test.yaml b/docker-compose-test.yaml new file mode 100644 index 0000000..73981ef --- /dev/null +++ b/docker-compose-test.yaml @@ -0,0 +1,17 @@ +version: "3.7" +services: + web: + image: web + build: + context: ./ + networks: + - webnet + ports: + - "19009:9000" + cap_drop: + - ALL + environment: + - SERVER_DEPLOYMENT_TYPE=test + - SERVER_LISTEN_PORT=9000 +networks: + webnet: diff --git a/docker-compose.yaml b/docker-compose.yaml index 1c70974..8eb2079 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,8 +8,13 @@ services: - webnet restart: unless-stopped ports: - - "9000:9000" + - "19009:9000" volumes: - /etc/letsencrypt/archive/blog.terminaldweller.com/:/certs/ + cap_drop: + - ALL + environment: + - SERVER_DEPLOYMENT_TYPE=deployment + - SERVER_LISTEN_PORT=9000 networks: webnet: @@ -23,6 +23,7 @@ const spdy = require("spdy"); const app = express(); app.use(express.static(path.join(__dirname, "css"))); +app.use(express.static(path.join(__dirname, "static"))); app.set("views", path.join(__dirname, "views")); app.set("view engine", "ejs"); app.engine("ejs", require("ejs").__express); @@ -60,6 +61,21 @@ app.get("/health", (req, res) => { res.send(response); }); +app.get("/about", (req, res) => { + res.type("text/html"); + res.sendFile(path.join(__dirname, "static/about.html")); +}); + +app.get("/archive", (req, res) => { + res.type("text/html"); + res.render("archive", { + cache: true, + data: { + mds: fs.readdirSync(path.join(__dirname, "mds"), "utf-8"), + }, + }); +}); + app.get("/robots.txt", (req, res) => { res.type("text/plain"); let robots_txt = "Sitemap: http://blog.terminaldweller.com\n"; @@ -84,7 +100,7 @@ async function enumerateDir() { return await fs.readdirSync(path.join(__dirname, "mds")); } -app.use(sitemap(enumerateDir, "http://blog.terminaldweller.com")); +app.use(sitemap(enumerateDir, "https://blog.terminaldweller.com")); app.use((req, res) => { return res.status(404).send({ message: "Path" + req.url + "not found!" }); @@ -94,12 +110,24 @@ app.use((err, req, res) => { return res.status(500).send({ error: err }); }); -spdy - .createServer( - { - key: fs.readFileSync("/certs/privkey1.pem", "utf-8"), - cert: fs.readFileSync("/certs/fullchain1.pem", "utf-8"), - }, - app - ) - .listen(9000); +if (process.env.SERVER_DEPLOYMENT_TYPE == "deployment") { + spdy + .createServer( + { + key: fs.readFileSync("/certs/privkey1.pem", "utf-8"), + cert: fs.readFileSync("/certs/fullchain1.pem", "utf-8"), + }, + app + ) + .listen(process.env.SERVER_LISTEN_PORT || 9000); +} else if (process.env.SERVER_DEPLOYMENT_TYPE == "test") { + spdy + .createServer( + { + key: fs.readFileSync("/certs/server.key", "utf-8"), + cert: fs.readFileSync("/certs/server.cert", "utf-8"), + }, + app + ) + .listen(process.env.SERVER_LISTEN_PORT || 9000); +} diff --git a/static/about.html b/static/about.html new file mode 100644 index 0000000..ad9ed10 --- /dev/null +++ b/static/about.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width" /> + <title>About</title> + <link + rel="stylesheet" + href="/master.css" + type="text/css" + media="screen" + title="no title" + charset="utf-8" + /> + </head> + <body> + <p>Email: thabogre@gmail.com</p> + <p> + You can find my github + <a href="https://github.com/terminaldweller">here</a> + </p> + </body> +</html> diff --git a/views/archive.ejs b/views/archive.ejs new file mode 100644 index 0000000..36191de --- /dev/null +++ b/views/archive.ejs @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width"> + <title>Archive</title> + <link rel="stylesheet" href="/master.css" type="text/css" media="screen" title="no title" charset="utf-8"> + </head> + <body> + <script>0</script> + <div class="article"> + <% data.mds.forEach(function(md) { %> + <ul> + <li><a href=<%= "/mds/"+md %> target="_self" rel="noreferrer noopener" type="text/html"><%= md %></a></li> + </ul> + <% }) %> + </div> + </body> +</html> diff --git a/views/index.ejs b/views/index.ejs index 8c2fe43..7ce83a8 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -8,15 +8,10 @@ </head> <body> <script>0</script> - <div class="sidenav"> - <% data.mds.forEach(function(md) { %> - <ul> - <li><a href=<%= "/mds/"+md %> target="_self" rel="noreferrer noopener" type="text/html"><%= md %></a></li> - </ul> - <% }) %> - </div> <div class="article"> <%- data.blogHttp %> + <a href="/about">About</a> + <a href="/archive">Archive</a> </div> </body> </html> |