From 0ed69852a35a9d82417596e1dcf240636c958d39 Mon Sep 17 00:00:00 2001 From: Aidan Date: Wed, 4 Dec 2024 20:34:11 -0500 Subject: [PATCH] updates to ui, add donation page, update docs, add sharding --- .gitignore | 3 ++- README.md | 30 +++++++++++++--------------- app.js | 24 +++++++++++++++++------ docker-compose.yml.example | 1 + donations.json.example | 7 +++++++ src/donate.ejs | 26 +++++++++++++++++++++++++ src/index.ejs | 40 ++++++++++++-------------------------- src/register.ejs | 28 ++++++-------------------- src/services.ejs | 38 +++++++++++++++--------------------- src/shards/footer.ejs | 3 +++ src/shards/header.ejs | 14 +++++++++++++ src/shards/nav.ejs | 24 +++++++++++++++++++++++ src/success.ejs | 17 ++-------------- 13 files changed, 145 insertions(+), 110 deletions(-) create mode 100644 donations.json.example create mode 100644 src/donate.ejs create mode 100644 src/shards/footer.ejs create mode 100644 src/shards/header.ejs create mode 100644 src/shards/nav.ejs diff --git a/.gitignore b/.gitignore index 2a81c15..6b282ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules/ package-lock.json docker-compose.yml -register,log \ No newline at end of file +register,log +donations.json \ No newline at end of file diff --git a/README.md b/README.md index cc66259..5f471a3 100644 --- a/README.md +++ b/README.md @@ -12,18 +12,20 @@ Landing page for p0ntus mail ```bash mv docker-compose.yml.example docker-compose.yml ``` -3. Make the `self` script executable +3. Copy the example `donations.json` ```bash - chmod +x self + mv donations.json.example donations.json ``` -4. Use `self` script to serve files into `public/` directory +4. Install dependencies ```bash - ./self start + npm install + ``` +4. Start the server + ```bash + node app.js ``` -You will now have to use a server (NGINX, Apache2, etc.) to serve files from the `./public` directory. You may use the example `default.conf` with NGINX if you wish. - -Make changes from the `./src` directory, and `self` will copy them over. +You will now have a fully functioning Node.js Express server, which will be running on port `3000`. ## With Docker You can also use Docker to self-host pontus-mail's frontend. Make sure you have docker-compose or docker-compose-plugin installed on your system. 1. Clone the repo @@ -35,17 +37,13 @@ You can also use Docker to self-host pontus-mail's frontend. Make sure you have ```bash mv docker-compose.yml.example docker-compose.yml ``` -3. Make the `self` script executable +3. Copy the example `donations.json` ```bash - chmod +x self + mv donations.json.example donations.json ``` -4. Start Docker containers +4. Start and build Docker containers ```bash - docker compose up -d - ``` -5. Use `self` script to serve files into `public/` directory - ```bash - ./self start + docker compose up -d --build ``` -You will now have a fully functioning NGINX server, serving the pontus-mail website from the `./public` directory. Make your changes in the `./src` directory, if any. \ No newline at end of file +You will now have a fully functioning Node.js Express server, which will be running on the port specified in `docker-compose.yml`, and internally on port `3000`. \ No newline at end of file diff --git a/app.js b/app.js index 5f4f6aa..bcb027d 100644 --- a/app.js +++ b/app.js @@ -1,9 +1,9 @@ const express = require('express'); const bodyParser = require('body-parser'); const path = require('path'); +const fs = require('fs'); //const winston = require('winston'); //const rateLimit = require('express-rate-limit'); -//const fs = require('fs'); //const logger = winston.createLogger({ // level: 'info', @@ -38,7 +38,7 @@ app.use(bodyParser.urlencoded({ extended: false })); app.use(express.static(path.join(__dirname, 'public'))); app.get('/', (req, res) => { - res.render('index'); + res.render('index', { currentPage: 'home' }); }); //app.post('/register', registerLimiter, (req, res) => { @@ -58,12 +58,24 @@ app.get('/', (req, res) => { // res.render('success'); //}); -app.get('/register', (req, res) => { - res.render('register'); +app.get('/services', (req, res) => { + res.render('services', { currentPage: 'services' }); }); -app.get('/services', (req, res) => { - res.render('services'); +app.get('/register', (req, res) => { + res.render('register', { currentPage: 'register' }); +}); + +app.get('/donate', (req, res) => { + const donations = JSON.parse(fs.readFileSync('donations.json', 'utf8')); + res.render('donate', { + currentPage: 'donate', + bitcoin: donations.bitcoin, + litecoin: donations.litecoin, + ethereum: donations.ethereum, + current: donations.current, + goal: donations.goal + }); }); const PORT = process.env.PORT || 3000; diff --git a/docker-compose.yml.example b/docker-compose.yml.example index c505482..ce09d68 100644 --- a/docker-compose.yml.example +++ b/docker-compose.yml.example @@ -8,5 +8,6 @@ services: volumes: - ./register.log:/usr/src/app/register.log - ./exclusions.json:/usr/src/app/exclusions.json + - ./donations.json:/usr/src/app/donations.json environment: - NODE_ENV=production \ No newline at end of file diff --git a/donations.json.example b/donations.json.example new file mode 100644 index 0000000..0ce80ba --- /dev/null +++ b/donations.json.example @@ -0,0 +1,7 @@ +{ + "bitcoin": "bitcoinaddresshere", + "litecoin": "litecoinaddresshere", + "ethereum": "ethereumaddresshere", + "current": 0, + "goal": 55 +} \ No newline at end of file diff --git a/src/donate.ejs b/src/donate.ejs new file mode 100644 index 0000000..168445e --- /dev/null +++ b/src/donate.ejs @@ -0,0 +1,26 @@ +<%- include('shards/header', { title: 'Donate - p0ntus mail' }) %> +
+ <%- include('shards/nav', { currentPage: 'donate' }) %> + Current donation progress this month +
+
+
$<%= current %> / $<%= goal %>
+
+
+ Current: $<%= current %> + Goal: $<%= goal %> +
+

This goal represents the cost of the server and its operation, based on the bill from the previous month.

+
+ Donate with Cryptocurrency +
+
+
Bitcoin
+

<%= bitcoin %>

+
Ethereum
+

<%= ethereum %>

+
Litecoin
+

<%= litecoin %>

+
+
+<%- include('shards/footer') %> \ No newline at end of file diff --git a/src/index.ejs b/src/index.ejs index fa968e8..4ddb93d 100644 --- a/src/index.ejs +++ b/src/index.ejs @@ -1,34 +1,18 @@ - - - - - - p0ntus mail - - - - - - - - +<%- include('shards/header', { title: 'p0ntus mail' }) %>
-

p0ntus mail.

-

simple, mindful, secure email.

- + <%- include('shards/nav', { currentPage: 'home' }) %> + Welcome to p0ntus mail +
+

Hello, and thanks for checking our my personal email server.

+

If you're just curious, check out the "Services" page. If you'd like to sign up, simply use the "Register" link.

Where can I direct your request?
-

If you aren't a current user

- Register +
If you aren't a current user
+ Register
-

If you are a current user

- Webmail - Account +
If you are a current user
+ Webmail + Account
- - - \ No newline at end of file +<%- include('shards/footer') %> \ No newline at end of file diff --git a/src/register.ejs b/src/register.ejs index b30f954..6309b18 100644 --- a/src/register.ejs +++ b/src/register.ejs @@ -1,30 +1,14 @@ - - - - - - Register - p0ntus mail - - - - - - - +<%- include('shards/header', { title: 'Register - p0ntus mail' }) %>
-

Register

-

Registration is done via email

- Please contact signupp0ntus.com with the following info: + <%- include('shards/nav', { currentPage: 'register' }) %> + Register
-
    + Please contact signupp0ntus.com with the following info: +
    • Name that goes in email header (full name/username/alias)
    • Desired email address (e.g., yourname@p0ntus.com)
    • Reason for wanting an email
    • Telegram username
    -
    - Return to Home
- - - \ No newline at end of file +<%- include('shards/footer') %> \ No newline at end of file diff --git a/src/services.ejs b/src/services.ejs index 4382236..0fdb62e 100644 --- a/src/services.ejs +++ b/src/services.ejs @@ -1,25 +1,10 @@ - - - - - - Services - p0ntus mail - - - - - - - +<%- include('shards/header', { title: 'Services - p0ntus mail' }) %>
-

p0ntus mail.

-

simple, mindful, secure email.

- + <%- include('shards/nav', { currentPage: 'services' }) %> What we do
+

p0ntus mail is an email server I personally host ana manage, avaliable free of charge to the public. p0ntus mail is free, and powered by user donations.

+

Here is what we have to offer you:

@@ -54,7 +39,16 @@
+ What you get +
+

Upon creating your account, you will be allocated an account with the following:

+
    +
  • 4000 MB storage
  • +
  • Webmail access
  • +
  • IMAP/SMTP access (soon)
  • +
  • Spam protection
  • +
  • 5 outgoing messages per hour
  • +
+

You may request for additional storage, or increased account limits by contacting adminp0ntus.com. We operate under a "fair use" policy.

- - - \ No newline at end of file +<%- include('shards/footer') %> \ No newline at end of file diff --git a/src/shards/footer.ejs b/src/shards/footer.ejs new file mode 100644 index 0000000..1c8afde --- /dev/null +++ b/src/shards/footer.ejs @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/shards/header.ejs b/src/shards/header.ejs new file mode 100644 index 0000000..1f6e35d --- /dev/null +++ b/src/shards/header.ejs @@ -0,0 +1,14 @@ + + + + + + <%= title %> + + + + + + + + \ No newline at end of file diff --git a/src/shards/nav.ejs b/src/shards/nav.ejs new file mode 100644 index 0000000..9e7e23d --- /dev/null +++ b/src/shards/nav.ejs @@ -0,0 +1,24 @@ +

p0ntus mail.

+

simple, mindful, secure email.

+ \ No newline at end of file diff --git a/src/success.ejs b/src/success.ejs index 3aa8f2c..83a9bd4 100644 --- a/src/success.ejs +++ b/src/success.ejs @@ -1,15 +1,4 @@ - - - - - - Success - p0ntus mail - - - - - - +<%- include('shards/header', { title: 'p0ntus mail' }) %>

Success

Your registration request has been submitted

@@ -17,6 +6,4 @@
Return to Home
- - - \ No newline at end of file +<%- include('shards/footer') %> \ No newline at end of file