diff --git a/README.md b/README.md index 851074f..9a11eb1 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,18 @@ Once you satellite is added you need to add it to a collection. Currently the "D Go back to the site home and your satellite will now show. You can select it to get more details and show the orbit and next pass. +# Updating TLE files + +``` +python update_tle.py +``` + +Its recommended to schedule that file via cron (no more than once a day) + +# Security + +This has not been designed to be exposed to the internet. Don't do it! + # Rotator Control This is still a work in progress, but essentially I have [Node-Red](https://nodered.org/) installed on the same pi. My flow contains a websocket component that listens for az/el requests. More information on this soon. diff --git a/app/routes_jsapi.py b/app/routes_jsapi.py index 91c9680..2a0198b 100644 --- a/app/routes_jsapi.py +++ b/app/routes_jsapi.py @@ -4,6 +4,7 @@ from app.forms import CreateCollectionForm, AddSatelliteCollectionForm from sqlalchemy import and_ from app import config +import requests from app.satellite_functions import calc_current_pos, get_next_pass, get_orbit @@ -45,6 +46,16 @@ def satellite_data(collection_id): return jsonify(data) +@app.route('/browser/tle_api/') +def tle_api(norad_id): + req = requests.get("https://db.satnogs.org/api/tle/?format=json&norad_cat_id=" + norad_id) + + if req.status_code == 200: + data = req.json() + return jsonify(data) + + return jsonify([{}]) + diff --git a/app/templates/add_satellite_form.html b/app/templates/add_satellite_form.html index 549f0d8..a2fd5b8 100644 --- a/app/templates/add_satellite_form.html +++ b/app/templates/add_satellite_form.html @@ -63,7 +63,7 @@ } else { $.ajax({ - url: "https://db.satnogs.org/api/tle/?format=json&norad_cat_id=" + noradid, + url: "/browser/tle_api/" + noradid, type: 'GET', dataType: 'json', success: function (res) { diff --git a/requirements.txt b/requirements.txt index ae7f7a3..e7016f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,29 +1,18 @@ Bootstrap-Flask==2.0.1 -certifi==2020.6.20 -chardet==4.0.0 -click==8.0.3 -colorzero==1.1 -distro==1.5.0 -dominate==2.6.0 Flask==2.0.3 Flask-Bootstrap==3.3.7.1 Flask-SQLAlchemy==2.5.1 Flask-WTF==1.0.0 -gpiozero==1.6.2 idna==2.10 itsdangerous==2.1.0 Jinja2==3.0.3 jplephem==2.17 MarkupSafe==2.1.0 -python-apt==2.2.1 requests==2.25.1 -RPi.GPIO==0.7.0 sgp4==2.20 six==1.16.0 skyfield==1.42 -spidev==3.5 SQLAlchemy==1.4.31 -ssh-import-id==5.10 urllib3==1.26.5 visitor==0.1.3 Werkzeug==2.0.3