mirror of
https://github.com/craigerl/aprsd.git
synced 2025-08-03 22:12:30 -04:00
Added aprsd web index page
This patch adds an index page for the flask web server that users can hit at /
This commit is contained in:
parent
53cdccde10
commit
f211e5cabb
@ -40,8 +40,7 @@ class APRSDFlask(flask_classful.FlaskView):
|
|||||||
users = self.users
|
users = self.users
|
||||||
|
|
||||||
def index(self):
|
def index(self):
|
||||||
return "Hello"
|
return flask.render_template("index.html", message=self.stats())
|
||||||
# return flask.render_template("index.html", message=msg)
|
|
||||||
|
|
||||||
@auth.login_required
|
@auth.login_required
|
||||||
def messages(self):
|
def messages(self):
|
||||||
@ -89,7 +88,7 @@ def init_flask(config):
|
|||||||
)
|
)
|
||||||
server = APRSDFlask()
|
server = APRSDFlask()
|
||||||
server.set_config(config)
|
server.set_config(config)
|
||||||
# flask_app.route('/', methods=['GET'])(server.index)
|
flask_app.route("/", methods=["GET"])(server.index)
|
||||||
flask_app.route("/stats", methods=["GET"])(server.stats)
|
flask_app.route("/stats", methods=["GET"])(server.stats)
|
||||||
flask_app.route("/messages", methods=["GET"])(server.messages)
|
flask_app.route("/messages", methods=["GET"])(server.messages)
|
||||||
flask_app.route("/save", methods=["GET"])(server.save)
|
flask_app.route("/save", methods=["GET"])(server.save)
|
||||||
|
@ -1,4 +1,44 @@
|
|||||||
<html>
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||||
|
|
||||||
<body><h1>{{ message }}</h1></body>
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/components/prism-json.js"></script>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.css">
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript"">
|
||||||
|
|
||||||
|
function start_update() {
|
||||||
|
|
||||||
|
(function statsworker() {
|
||||||
|
$.ajax({
|
||||||
|
url: "/stats",
|
||||||
|
type: 'GET',
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
//data = JSON.parse(response)
|
||||||
|
const html_pretty = Prism.highlight(JSON.stringify(data, null, '\t'), Prism.languages.json, 'json');
|
||||||
|
$("#app").html(html_pretty)
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
setTimeout(statsworker, 60000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#app").text("Starting PEEPIS")
|
||||||
|
start_update();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<pre id="app" class="language-json">{{ stats }}</pre>
|
||||||
|
<canvas id="messsageChart"></canvas>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user