diff --git a/app.py b/app.py index 6e8de59..183f633 100644 --- a/app.py +++ b/app.py @@ -19,14 +19,6 @@ logger = logging.getLogger() from EagleEyev3 import * from settings import config -logging.info(f"Using EagleEyev3 version {EagleEyev3.__version__}") - - -app = Flask(__name__) - -SESSION_TYPE = 'filesystem' -app.config.from_object(__name__) -Session(app) # check if it could pull in a config object from settings.py @@ -46,6 +38,37 @@ else: +logging.info(f"Using EagleEyev3 version {EagleEyev3.__version__}") + + +app = Flask(__name__) + +SESSION_TYPE = 'filesystem' +app.config.from_object(__name__) +Session(app) + + +# flask routes +# +# Endpoint Methods Rule +# --------------------- ------- ------------------------------- +# accounts GET /accounts +# camera__preivew_image GET /camera//preview_image +# camera_detail GET /camera//events/ +# camera_detail GET /camera//events +# camera_live_preivew GET /camera//preview +# camera_status_plot GET /camera//status_plot +# cameras GET /cameras +# index GET / +# landing GET /landing +# login_callback GET /login_callback +# logout GET /logout +# static GET /static/ +# switch_account GET /switch_account + + + + @app.route('/landing') def landing(): @@ -93,6 +116,18 @@ def index(): een.get_list_of_cameras() een.get_list_of_accounts() + if len(een.accounts) > 0 and een.active_account == None: + # they need to pick and account + + logging.info(f"redirecting to accounts.html because they don't have an active account { een.active_account }") + + values = { + "current_user": een.current_user, + "accounts": een.accounts, + "active_account": een.active_account + } + redirect(url_for('accounts')) + values = { "current_user": een.current_user, "cameras": een.cameras, @@ -186,7 +221,8 @@ def switch_account(): if (account): - # use the include code parameter to complete login process + # switch into account + logging.info(f"attempting to switch into account {account}") een.login_from_reseller(target_account_id=account) diff --git a/requirements.txt b/requirements.txt index f51ce4c..9ef13a1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ Werkzeug==2.3.6 gunicorn==20.1.0 cachelib==0.10.2 Flask-Session==0.5.0 -EagleEyev3>=0.0.13 +EagleEyev3>=0.0.14 tqdm pandas numpy diff --git a/templates/camera_events_partial.html b/templates/camera_events_partial.html index 0e1ba36..4de6de4 100644 --- a/templates/camera_events_partial.html +++ b/templates/camera_events_partial.html @@ -2,22 +2,22 @@
{{ template_values['camera'].name }}
{% if template_values['events'] %} diff --git a/templates/cameras_partial.html b/templates/cameras_partial.html index 4bbbb53..d58baa0 100644 --- a/templates/cameras_partial.html +++ b/templates/cameras_partial.html @@ -5,7 +5,7 @@ {% if camera.is_online() %}
- {{ camera.name }} + {{ camera.name }}
{% endif %} @@ -33,7 +33,7 @@ {% if camera.is_offline() %} {% endif %} {% endfor %} - +