feat: Update web page and added install script

This commit is contained in:
Nathan Woodburn 2024-02-24 19:30:26 +11:00
parent 0f2afdfa37
commit 631df4d676
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
7 changed files with 87 additions and 6 deletions

14
hns-links.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=NGINX Manager
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/python3 /root/hns-links/server.py
WorkingDirectory=/root/hns-links
Restart=always
User=root
Group=root
[Install]
WantedBy=multi-user.target

26
install.sh Normal file
View File

@ -0,0 +1,26 @@
#!/bin/bash
# Make sure script is running as root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Install nginx
sudo apt update
sudo apt install nginx python3-pip -y
cd /root
git clone https://git.woodburn.au/nathanwoodburn/hns-links.git
cd hns-links
mkdir avatars
mkdir sites
cp example/example.json sites/example.json
cp example/example.jpg avatars/example.jpg
chmod +x *.sh
python3 -m pip install -r requirements.txt
# Install python script as a service
sudo cp ./hns-links.service /etc/systemd/system/hns-links.service
sudo systemctl start hns-links
sudo systemctl enable hns-links

33
server.py Normal file
View File

@ -0,0 +1,33 @@
from flask import Flask
from server import app
import main
from gunicorn.app.base import BaseApplication
class GunicornApp(BaseApplication):
def __init__(self, app, options=None):
self.options = options or {}
self.application = app
super().__init__()
def load_config(self):
for key, value in self.options.items():
if key in self.cfg.settings and value is not None:
self.cfg.set(key.lower(), value)
def load(self):
return self.application
if __name__ == '__main__':
workers = 1
threads = 2
workers = int(workers)
threads = int(threads)
options = {
'bind': '0.0.0.0:5000',
'workers': workers,
'threads': threads,
}
gunicorn_app = GunicornApp(app, options)
print('Starting server with ' + str(workers) + ' workers and ' + str(threads) + ' threads', flush=True)
gunicorn_app.run()

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@ -22,7 +22,7 @@
<div class="container"><a class="navbar-brand d-flex align-items-center" href="/"><img src="/assets/img/favicon.png" width="45px"><span>&nbsp;HNS Links</span></a><button data-bs-toggle="collapse" class="navbar-toggler" data-bs-target="#navcol-1"><span class="visually-hidden">Toggle navigation</span><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navcol-1">
<ul class="navbar-nav mx-auto">
<li class="nav-item"><a class="nav-link active" href="/index.html">Home</a></li>
<li class="nav-item"><a class="nav-link active" href="/">Home</a></li>
<li class="nav-item"><a class="nav-link active" href="/#contact">Contact</a></li>
</ul><button class="btn btn-primary shadow" type="button" onclick="{{varo}}">Create/edit site</button>
</div>
@ -34,20 +34,20 @@
<div class="row pt-5">
<div class="col-md-8 col-xl-6 text-center text-md-start mx-auto">
<div class="text-center">
<h1 class="fw-bold">The best solution for your HNS Domain</h1>
<h1 class="fw-bold">Easy to use links page for Handshake domains</h1>
</div>
</div>
<div class="col-12 col-lg-10 mx-auto">
<div class="position-relative" style="display: flex;flex-wrap: wrap;justify-content: flex-end;">
<div style="position: relative;flex: 0 0 45%;transform: translate3d(-15%, 35%, 0);"><img class="img-fluid" data-bss-parallax="" data-bss-parallax-speed="0.8" src="/assets/img/products/3.jpg"></div>
<div style="position: relative;flex: 0 0 45%;transform: translate3d(-5%, 20%, 0);"><img class="img-fluid" data-bss-parallax="" data-bss-parallax-speed="0.4" src="/assets/img/products/2.jpg"></div>
<div style="position: relative;flex: 0 0 60%;transform: translate3d(0, 0%, 0);"><img class="img-fluid" data-bss-parallax="" data-bss-parallax-speed="0.25" src="/assets/img/products/1.jpg"></div>
<div style="position: relative;flex: 0 0 45%;transform: translate3d(-15%, 35%, 0);"><img class="img-fluid" data-bss-parallax="" data-bss-parallax-speed="0.8" src="/assets/img/example_page.png"></div>
<div style="position: relative;flex: 0 0 45%;transform: translate3d(-5%, 20%, 0);"><img class="img-fluid" data-bss-parallax="" data-bss-parallax-speed="0.4" src="/assets/img/example_hnsau.png"></div>
<div style="position: relative;flex: 0 0 60%;transform: translate3d(0, 0%, 0);"><img class="img-fluid" data-bss-parallax="" data-bss-parallax-speed="0.25" src="/assets/img/dashboard.png" style="border-width: 1px;border-style: solid;border-radius: 10px;"></div>
</div>
</div>
</div>
</div>
</header>
<section>
<section style="background: rgb(39,38,46);">
<div class="container bg-dark py-5">
<div class="row">
<div class="col-md-8 col-xl-6 text-center mx-auto">
@ -65,6 +65,14 @@
</div>
</div>
</div>
<div class="col mb-5">
<div class="card shadow-sm">
<div class="card-body px-4 py-5 px-md-5">
<h5 class="fw-bold card-title">Add wallet addresses for HIP05</h5>
<p class="text-muted card-text mb-4">Allow anyone to send HNS to @yourdomain by adding your domain in the page info.</p>
</div>
</div>
</div>
<div class="col mb-5">
<div class="card shadow-sm">
<div class="card-body px-4 py-5 px-md-5">