51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
from flask import Flask, render_template
|
|
from flask_minify import minify
|
|
from flask_compress import Compress
|
|
import waitress
|
|
import ping3
|
|
|
|
isProdution = True
|
|
|
|
# READ README YOU STUPID FUCK
|
|
|
|
app = Flask(__name__.split('.')[0])
|
|
Compress(app)
|
|
if isProdution:
|
|
minify(app=app, html=True, js=True, cssless=True)
|
|
|
|
|
|
def isUp(host: str) -> bool:
|
|
return bool(ping3.ping(host, timeout = 1))
|
|
|
|
@app.route('/')
|
|
def main():
|
|
url = "drath.cc"
|
|
links = ["isheatwork", "manga", "cloud", "movies", "slots"]
|
|
return render_template('index.html.j2', links=sorted(links), url=url)
|
|
|
|
@app.route('/status/funbox')
|
|
def funbox():
|
|
return str(isUp("192.168.1.1"))
|
|
|
|
@app.route('/status/proxmox')
|
|
def proxmox():
|
|
return str(isUp("10.0.1.2"))
|
|
|
|
@app.route('/status/opnsense')
|
|
def opnsense():
|
|
return str(isUp("10.0.1.1"))
|
|
|
|
@app.route('/status/server')
|
|
def server():
|
|
return str(isUp("10.0.1.200"))
|
|
|
|
@app.route('/http/<status>')
|
|
def httpcodes(status):
|
|
return render_template('error.html.j2', status=status, host="10.0.0.102")
|
|
|
|
if __name__ == '__main__':
|
|
if isProdution:
|
|
print("Starting waitress server")
|
|
waitress.serve(app, host='0.0.0.0', port=8080)
|
|
else:
|
|
app.run(host='0.0.0.0', port=8080, debug=True) |