diff --git a/hns-links.service b/hns-links.service new file mode 100644 index 0000000..007d891 --- /dev/null +++ b/hns-links.service @@ -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 \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..dd460ca --- /dev/null +++ b/install.sh @@ -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 \ No newline at end of file diff --git a/server.py b/server.py new file mode 100644 index 0000000..5de80df --- /dev/null +++ b/server.py @@ -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() diff --git a/templates/assets/img/dashboard.png b/templates/assets/img/dashboard.png new file mode 100644 index 0000000..501f5e7 Binary files /dev/null and b/templates/assets/img/dashboard.png differ diff --git a/templates/assets/img/example_hnsau.png b/templates/assets/img/example_hnsau.png new file mode 100644 index 0000000..b8c16da Binary files /dev/null and b/templates/assets/img/example_hnsau.png differ diff --git a/templates/assets/img/example_page.png b/templates/assets/img/example_page.png new file mode 100644 index 0000000..3382c16 Binary files /dev/null and b/templates/assets/img/example_page.png differ diff --git a/templates/index.html b/templates/index.html index f30bf76..284a22c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -22,7 +22,7 @@
 HNS Links @@ -34,20 +34,20 @@
-

The best solution for your HNS Domain

+

Easy to use links page for Handshake domains

-
-
-
+
+
+
-
+
@@ -65,6 +65,14 @@
+
+
+
+
Add wallet addresses for HIP05
+

Allow anyone to send HNS to @yourdomain by adding your domain in the page info.

+
+
+