mirror of
https://github.com/uw935/vatsimfox.git
synced 2026-09-17 04:48:58 +00:00
hotfix: userid
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img align="center" src="media/cover.png">
|
<img align="center" src="media/cover.png">
|
||||||
<h3 align="center">VATSIM Fox</h3>
|
<h3 align="center">VATSIM Fox — v1.2</h3>
|
||||||
<p align="center">Website to find out your detailed VATSIM stastic</p>
|
<p align="center">Website to find out your detailed VATSIM stastic</p>
|
||||||
</p>
|
</p>
|
||||||
<br>
|
<br>
|
||||||
@@ -37,6 +37,8 @@ python -m venv venv
|
|||||||
# downloading requirements && upgrading pip
|
# downloading requirements && upgrading pip
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
python -m pip install -r requirements.txt
|
python -m pip install -r requirements.txt
|
||||||
|
# starting application
|
||||||
|
python -m flask run --host 0.0.0.0 --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
## Feature
|
## Feature
|
||||||
|
|||||||
+4
-1
@@ -19,7 +19,10 @@ def errorhandler_page(_):
|
|||||||
@app.route("/api/request")
|
@app.route("/api/request")
|
||||||
def request_handler():
|
def request_handler():
|
||||||
if request_string := request.args.get("request_string"):
|
if request_string := request.args.get("request_string"):
|
||||||
|
try:
|
||||||
return requests.get(f"{VATSIM_API_URL}{request_string}").json()
|
return requests.get(f"{VATSIM_API_URL}{request_string}").json()
|
||||||
|
except requests.exceptions.JSONDecodeError:
|
||||||
|
return jsonify({"result": "not found"})
|
||||||
|
|
||||||
return jsonify({"result": "not found"})
|
return jsonify({"result": "not found"})
|
||||||
|
|
||||||
@@ -31,7 +34,7 @@ def viewer_page(cid):
|
|||||||
if "detail" in user and user["detail"] == "Not Found":
|
if "detail" in user and user["detail"] == "Not Found":
|
||||||
return abort(404)
|
return abort(404)
|
||||||
|
|
||||||
return render_template("viewer.html", data=(user, ))
|
return render_template("viewer.html", user=user)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ $.getJSON("/static/data/airports.json", function(json) {
|
|||||||
|
|
||||||
// Map creation
|
// Map creation
|
||||||
const MAP_ELEMENT = L.map("fox_map");
|
const MAP_ELEMENT = L.map("fox_map");
|
||||||
const MAP_DEFAULT_TARGET = L.latLng("47.50737", "19.04611");
|
const MAP_DEFAULT_ZOOM_VIEW = 2;
|
||||||
const MAP_DEFAULT_ZOOM_VIEW = 14;
|
const MAP_DEFAULT_TARGET = L.latLng("0", "0");
|
||||||
let line = null;
|
let line = null;
|
||||||
|
|
||||||
MAP_ELEMENT.setView(MAP_DEFAULT_TARGET, MAP_DEFAULT_ZOOM_VIEW);
|
MAP_ELEMENT.setView(MAP_DEFAULT_TARGET, MAP_DEFAULT_ZOOM_VIEW);
|
||||||
|
|
||||||
L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png", {
|
L.tileLayer("https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png", {
|
||||||
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
|
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
|
||||||
subdomains: "abcd",
|
subdomains: "abcd",
|
||||||
maxZoom: 20,
|
maxZoom: 20,
|
||||||
@@ -143,7 +143,7 @@ function showFlight(flight) {
|
|||||||
// Function to show ATC session
|
// Function to show ATC session
|
||||||
function showSession(session) {
|
function showSession(session) {
|
||||||
if (!session) return;
|
if (!session) return;
|
||||||
|
console.log(session);
|
||||||
$(".atc_callsign").text(session["connection_id"]["callsign"]);
|
$(".atc_callsign").text(session["connection_id"]["callsign"]);
|
||||||
$(".atc_start_time").text(session["connection_id"]["start"].replace("T", " "));
|
$(".atc_start_time").text(session["connection_id"]["start"].replace("T", " "));
|
||||||
$(".atc_end_time").text(session["connection_id"]["end"].replace("T", " "));
|
$(".atc_end_time").text(session["connection_id"]["end"].replace("T", " "));
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{% extends "/include/template.html" %}
|
{% extends "/include/template.html" %}
|
||||||
{% block title %}User {{user_cid}} statistic — VATSIM Fox{% endblock %}
|
{% block title %}User {{user["id"]}} statistic — VATSIM Fox{% endblock %}
|
||||||
{% block header_css %}
|
{% block header_css %}
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='viewer.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='viewer.css') }}">
|
||||||
<link href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" rel="stylesheet"/>
|
<link href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" rel="stylesheet"/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
<h2 class="text-center text-primary mb-4">{{data[0]["id"]}}</h2>
|
<h2 class="text-center text-primary mb-4">{{user["id"]}}</h2>
|
||||||
<p class="fs-4 text-secondary">Date of registration: <span class="date_registration"></span></p>
|
<p class="fs-4 text-secondary">Date of registration: <span class="date_registration"></span></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
|
|
||||||
<div class="col-md" style="height: 321px;">
|
<div class="col-md" style="height: 321px;">
|
||||||
<div class="h-auto p-5 bg-light border rounded-3">
|
<div class="h-auto p-5 bg-light border rounded-3">
|
||||||
<h2 class="atc_callsign">UUEE_DEL</h2>
|
<h2 class="atc_callsign">Callsign</h2>
|
||||||
<span>
|
<span>
|
||||||
<b>Start time:</b>
|
<b>Start time:</b>
|
||||||
<span class="atc_start_time"></span>
|
<span class="atc_start_time"></span>
|
||||||
@@ -133,11 +133,11 @@
|
|||||||
{% block javascript_code %}
|
{% block javascript_code %}
|
||||||
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>
|
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
const USER_CID = '{{data[0]["id"]}}';
|
const USER_CID = '{{user["id"]}}';
|
||||||
const FLIGHTPLANS_API_URL = "/api/request?request_string=members/" + USER_CID + "/flightplans";
|
const FLIGHTPLANS_API_URL = "/api/request?request_string=members/" + USER_CID + "/flightplans";
|
||||||
const ATC_API_URL = "/api/request?request_string=members/" + USER_CID + "/atc";
|
const ATC_API_URL = "/api/request?request_string=members/" + USER_CID + "/atc";
|
||||||
|
|
||||||
$(".date_registration").text("{{data[0]['reg_date']}}".replace("T", " "));
|
$(".date_registration").text("{{user['reg_date']}}".replace("T", " "));
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="{{ url_for('static', filename='viewer.js') }}"></script>
|
<script type="text/javascript" src="{{ url_for('static', filename='viewer.js') }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user