Compare commits
2 Commits
ac054156ef
...
494a7e28a6
Author | SHA1 | Date | |
---|---|---|---|
494a7e28a6 | |||
076303d475 |
7
master/assets/css/index.css
Normal file
7
master/assets/css/index.css
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
html {
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
from flask import Flask, make_response, redirect, request, jsonify
|
from flask import Flask, make_response, redirect, request, jsonify, render_template, send_from_directory
|
||||||
import dotenv
|
import dotenv
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
@ -459,30 +459,15 @@ def home():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# Create html page
|
# Create html page
|
||||||
html = "<h1>Welcome</h1><br>"
|
workerhtml = ""
|
||||||
html += "<h2>Create a site</h2>"
|
|
||||||
html += "<form action='/add-site' method='POST'>"
|
|
||||||
html += "<p>Domain: <input type='text' name='domain'></p>"
|
|
||||||
html += "<p>Licence key: <input type='text' name='licence'></p>"
|
|
||||||
html += "<input type='submit' value='Create site'>"
|
|
||||||
html += "</form>"
|
|
||||||
|
|
||||||
html += "<br><h2>Stats</h2><br>"
|
|
||||||
html += "<h3>Workers</h3>"
|
|
||||||
html += "<ul>"
|
|
||||||
for worker in workers:
|
for worker in workers:
|
||||||
html += "<li>Name: " + worker.split(':')[0] + " | IP: " + worker.split(':')[2].strip('\n') + "</li>"
|
workerhtml += "<li>Name: " + worker.split(':')[0] + " | IP: " + worker.split(':')[2].strip('\n') + "</li>"
|
||||||
html += "</ul>"
|
sitehtml = ""
|
||||||
html += "<h3>Sites</h3>"
|
|
||||||
html += "<p>Total sites: " + str(len(sites)) + "</p>"
|
|
||||||
html += "<ul>"
|
|
||||||
for site in sites:
|
for site in sites:
|
||||||
html += "<li>Domain: <a href=\"https://" + site.split(':')[0] + "\" target=\"_blank\">"+site.split(':')[0]+"</a> | Worker: " + site.split(':')[1].strip('\n') + "</li>"
|
sitehtml += "<li>Domain: <a href=\"https://" + site.split(':')[0] + "\" target=\"_blank\">"+site.split(':')[0]+"</a> | Worker: " + site.split(':')[1].strip('\n') + "</li>"
|
||||||
html += "</ul>"
|
|
||||||
html += "<h3>Number of unclaimed licences: " + str(len(licences)) + "</h3>"
|
|
||||||
|
|
||||||
html += "<h2><a href='/admin'>Admin</a></h2>"
|
|
||||||
return html
|
return render_template('index.html', workers=workerhtml, site_count = str(len(sites)), sites = sitehtml, licences = str(len(licences)))
|
||||||
|
|
||||||
# Admin page
|
# Admin page
|
||||||
@app.route('/admin')
|
@app.route('/admin')
|
||||||
@ -776,7 +761,10 @@ def login():
|
|||||||
def failed_login():
|
def failed_login():
|
||||||
return "<h1>Failed login</h1><br><form action='/login' method='POST'><input type='password' name='password'><input type='submit' value='Login'></form>"
|
return "<h1>Failed login</h1><br><form action='/login' method='POST'><input type='password' name='password'><input type='submit' value='Login'></form>"
|
||||||
|
|
||||||
|
# Assets
|
||||||
|
@app.route('/assets/<path:path>')
|
||||||
|
def send_report(path):
|
||||||
|
return send_from_directory('assets', path)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
34
master/templates/index.html
Normal file
34
master/templates/index.html
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en-au">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>HNS Hosting Wordpress</title>
|
||||||
|
<link rel="stylesheet" href="/assets/css/index.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>HNS Hosting Wordpress</h1>
|
||||||
|
<p>Intro blurb</p>
|
||||||
|
<br>
|
||||||
|
<div id="new">
|
||||||
|
<h2>Create a new site</h2>
|
||||||
|
<form action='/add-site' method='POST'>
|
||||||
|
<p>Domain: <input type='text' name='domain'></p>
|
||||||
|
<p>Licence key: <input type='text' name='licence'></p>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div id="stats">
|
||||||
|
<h2>Stats</h2>
|
||||||
|
<h3>Workers</h3>
|
||||||
|
<ul>{{workers}}</ul>
|
||||||
|
<h3>Sites</h3>
|
||||||
|
<p>Total sites: {{site_count}}</p>
|
||||||
|
<ul>{{sites}}</ul>
|
||||||
|
<br>
|
||||||
|
<h3>Unclaimed licences: {{licences}}</h3>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<h2><a href="/admin">Admin</a></h2>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -61,11 +61,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
mysql:
|
mysql:
|
||||||
data:
|
data:
|
||||||
driver: local
|
|
||||||
driver_opts:
|
|
||||||
o: "size=5g,uid=1000"
|
|
||||||
device: tmpfs
|
|
||||||
type: tmpfs
|
|
||||||
""" > docker-compose.yml
|
""" > docker-compose.yml
|
||||||
|
|
||||||
# Start the containers
|
# Start the containers
|
||||||
|
Loading…
Reference in New Issue
Block a user