initial commit

This commit is contained in:
D. Scott Boggs 2023-10-05 06:15:44 -04:00
commit 876af2ffaf
6 changed files with 125 additions and 0 deletions

7
Dockerfile Normal file
View file

@ -0,0 +1,7 @@
FROM node
WORKDIR /project
ADD index.html index.js /project/
LABEL traefik.enable=true
LABEL traefik.http.routers.tws_links.rule=Host(`techwork.zone`)
LABEL traefik.http.routers.tws_links.tls.certresolver=letsencrypt
CMD [ "node", "index.js" ]

8
README.md Normal file
View file

@ -0,0 +1,8 @@
# TWS Links Page
This is just a simple page which shows a list of links, styled after the popular
LinkTree service. It's nothing more than a static HTML page with embedded CSS which is served by a barebones node.js server.
## Local testing
The only dependency is Node.js, and you can work with that by just loading the HTML file in your web browser without the server. Just run `node index.js`.

10
docker-compose.yml Normal file
View file

@ -0,0 +1,10 @@
version: '3.5'
services:
app:
build: .
networks: [web]
networks:
web:
external: true

75
index.html Normal file
View file

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tech Workers' Syndicate</title>
<style>
html,
body,
.links {
height: 90%;
background: #222;
font-family: Helvetica, Arial, sans-serif;
}
.links {
display: -webkit-flexbox;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
justify-content: center;
flex-direction: column;
list-style-type: none;
}
.links>a {
border: 1px solid orange;
border-radius: 0.5rem;
color: white;
padding: 1.5em;
margin: 1em;
width: 33%;
text-decoration: none;
text-align: center;
}
h1.title {
color: orange;
width: 100%;
text-align: center;
margin-top: 10%;
}
@media (max-height: 650px) {
.links {
display: block;
margin-bottom: 3em;
}
.links > a {
margin: 1em auto 1em auto;
display: block;
}
h1.title {
margin-bottom: 5%;
}
}
</style>
</head>
<body>
<h1 class="title">Tech Workers' Syndicate</h1>
<div class="links">
<a href="https://matrix.to/#/#tws:matrix.org">Join us!</a>
<a href="https://blog.techwork.zone/">Blog</a>
<a href="https://tams.tech/@syndicate" rel="me">Mastodon</a>
<a href="https://bsky.app/profile/techwork.zone" rel="me">BlueSky</a>
<a href="https://git.techwork.zone">Source Code</a>
</div>
</body>
</html>

15
index.js Normal file
View file

@ -0,0 +1,15 @@
const { readFile } = require('fs/promises')
const { Server } = require('http')
async function main() {
const webPage = await readFile('index.html', { encoding: 'utf-8' })
const server = new Server(
(_, res) => res.writeHead(200, {'Content-Type': 'text/html'}).end(webPage)
)
server.listen(1312, () => {
console.log('listening on 0.0.0.0:1312')
})
}
main()

10
shell.nix Normal file
View file

@ -0,0 +1,10 @@
# DEVELOPMENT shell environment
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
name = "TWS Links page";
nativeBuildInputs = with pkgs.buildPackages; [
nodejs git
];
}