man
This commit is contained in:
39
app/main.py
39
app/main.py
@@ -1,12 +1,10 @@
|
|||||||
from flask import Flask, render_template, request, send_from_directory
|
from flask import Flask, render_template, request
|
||||||
from flask_minify import minify
|
from flask_minify import minify
|
||||||
from flask_compress import Compress
|
from flask_compress import Compress
|
||||||
from http.client import responses
|
from http.client import responses
|
||||||
import ping3
|
import ping3
|
||||||
import hashlib
|
|
||||||
|
|
||||||
isProdution = True
|
isProdution = True
|
||||||
fwdir = "/dps-750ab-17_idf"
|
|
||||||
|
|
||||||
# READ README YOU STUPID FUCK
|
# READ README YOU STUPID FUCK
|
||||||
|
|
||||||
@@ -15,42 +13,15 @@ Compress(app)
|
|||||||
if isProdution:
|
if isProdution:
|
||||||
minify(app=app, html=True, js=True, cssless=True)
|
minify(app=app, html=True, js=True, cssless=True)
|
||||||
|
|
||||||
|
|
||||||
def isUp(host: str) -> bool:
|
def isUp(host: str) -> bool:
|
||||||
return bool(ping3.ping(host, timeout = 1))
|
return bool(ping3.ping(host, timeout = 1))
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def main():
|
def main():
|
||||||
url = "drath.cc"
|
url = "drath.cc"
|
||||||
links = ["isheatwork", "manga", "cloud", "movies", "slots"]
|
links = ["isheatwork", "books", "manga", "cloud", "movies", "slots"]
|
||||||
return render_template('index.html.j2', links=sorted(links), url=url)
|
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('/dps-750ab-17_idf/sha256')
|
|
||||||
def psu_sha256():
|
|
||||||
with open(fwdir + "/dps-750ab-17_idf.elf", "rb") as f:
|
|
||||||
elf = f.read()
|
|
||||||
return hashlib.sha256(elf).hexdigest()
|
|
||||||
|
|
||||||
@app.route('/dps-750ab-17_idf/firmware.bin')
|
|
||||||
def psu_firmware():
|
|
||||||
return send_from_directory(fwdir, 'dps-750ab-17_idf.bin')
|
|
||||||
|
|
||||||
@app.route('/http/<status>')
|
@app.route('/http/<status>')
|
||||||
def httpcodes(status):
|
def httpcodes(status):
|
||||||
status = int(status.replace('\'', ''))
|
status = int(status.replace('\'', ''))
|
||||||
@@ -62,6 +33,10 @@ def httpcodes(status):
|
|||||||
site=request.host,
|
site=request.host,
|
||||||
isup="up" if isUp("10.0.1.200") else "down"
|
isup="up" if isUp("10.0.1.200") else "down"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@app.route('/updater')
|
||||||
|
def updater():
|
||||||
|
return render_template('updater.html.j2')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host='0.0.0.0', port=8080, debug=True)
|
app.run(host='0.0.0.0', port=8080, debug=not isProdution)
|
||||||
Reference in New Issue
Block a user