From 5d3ade330b817f9cfa625b8bcaff5bb85b14f393 Mon Sep 17 00:00:00 2001 From: KF7EEL Date: Wed, 8 Dec 2021 20:56:57 -0800 Subject: [PATCH] add dashboard only mode for FreeDMR and HBLink --- web/app.py | 97 +++++++++++++++------------- web/config-SAMPLE.py | 8 +++ web/templates/flask_user_layout.html | 10 ++- 3 files changed, 69 insertions(+), 46 deletions(-) diff --git a/web/app.py b/web/app.py index e2a88cb..25adc08 100644 --- a/web/app.py +++ b/web/app.py @@ -648,7 +648,7 @@ def hbnet_web_service(): field_2 = '''

Terms of Use

-

By using ''' + title + ''', you agree not to do anything malicious. You agree to use the system with respect and courtesy to others. Please operate with the laws of your country.

+

By using ''' + title + ''', you agree not to do anything malicious. You agree to use the system with respect and courtesy to others. Please operate within the laws of your country.

''', @@ -657,7 +657,7 @@ def hbnet_web_service(): db.session.add(tos_entry_add) home_entry_add = Misc( field_1 = 'home_page', - field_2 = '

Welcome to ' + title + '

.', + field_2 = '

Welcome to ' + title + '.

', time = datetime.datetime.utcnow() ) db.session.add(home_entry_add) @@ -764,6 +764,12 @@ def hbnet_web_service(): db.session.commit() + # Use this to pass variables into Jinja2 templates + @app.context_processor + def global_template_config(): + return dict(global_config={'mode': mode}) + + # The Home page is accessible to anyone @app.route('/') def home_page(): @@ -886,51 +892,52 @@ def hbnet_web_service(): """, icon=folium.Icon(color="blue", icon="record"), tooltip='' + i.callsign + '').add_to(f_map) - for l in peer_l: -## print(time.time() - l.time().total_seconds() > 3600 ) -## print(datetime.datetime.now() - timedelta(days = 2)) -## if datetime.datetime.now() - timedelta(days = 2) > timedelta(days = 2): -## print('greater') -## folium.Marker([float(l[1][1]), float(l[1][2])], popup=''' -##
-##

''' + l[1][0] + '''

-##
-## ''' + l[1][5] + ''' -##
-## ''' + l[1][1] + ''', ''' + l[1][2] + ''' -##
-## ''' + l[1][3] + ''' -##
-## ''' + l[1][4] + ''' -##
-## ''' + l[1][6] + ''' -##
-##
-## ''', icon=folium.Icon(color="red", icon="record"), tooltip='' + l[1][0] + '').add_to(f_map) + if mode == 'FULL': + for l in peer_l: + ## print(time.time() - l.time().total_seconds() > 3600 ) + ## print(datetime.datetime.now() - timedelta(days = 2)) + ## if datetime.datetime.now() - timedelta(days = 2) > timedelta(days = 2): + ## print('greater') + ## folium.Marker([float(l[1][1]), float(l[1][2])], popup=''' + ##
+ ##

''' + l[1][0] + '''

+ ##
+ ## ''' + l[1][5] + ''' + ##
+ ## ''' + l[1][1] + ''', ''' + l[1][2] + ''' + ##
+ ## ''' + l[1][3] + ''' + ##
+ ## ''' + l[1][4] + ''' + ##
+ ## ''' + l[1][6] + ''' + ##
+ ##
+ ## ''', icon=folium.Icon(color="red", icon="record"), tooltip='' + l[1][0] + '').add_to(f_map) - folium.Marker([float(l.lat), float(l.lon)], popup=''' - - - - - - -
- - - - - - - - - -
-

''' + l.callsign + '''

-
''' + l.loc + '''
-
+ folium.Marker([float(l.lat), float(l.lon)], popup=''' + + + + + + +
+ + + + + + + + + +
+

''' + l.callsign + '''

+
''' + l.loc + '''
+
-''', icon=folium.Icon(color="red", icon="record"), tooltip='' + l.callsign + '').add_to(f_map) + ''', icon=folium.Icon(color="red", icon="record"), tooltip='' + l.callsign + '').add_to(f_map) content = f_map._repr_html_() return render_template('map.html', markup_content = Markup(content)) diff --git a/web/config-SAMPLE.py b/web/config-SAMPLE.py index cdc0a04..7b92640 100644 --- a/web/config-SAMPLE.py +++ b/web/config-SAMPLE.py @@ -24,6 +24,14 @@ url = 'http://localhost:8080' # Replace below with some random string such as an SHA256 secret_key = 'SUPER SECRET LONG KEY' +# Mode is used to disable certain features of the web service. +# This is primarily used to to turn the web service into a generic APRS/SMS dashboard. +# This gives the ability to have a dashboard with FreeDMR or HBLink, without the unecessary features of HBNet. +# Options are: +# FULL - Normal HBNet web service +# DASH_ONLY - To be used with FreeDMR or HBLink +mode = 'FULL' + # Timezone to show time stamps in. Stored in DB as UTC. Offset in hours. hbnet_tz = -1 diff --git a/web/templates/flask_user_layout.html b/web/templates/flask_user_layout.html index e18793f..0a8728f 100644 --- a/web/templates/flask_user_layout.html +++ b/web/templates/flask_user_layout.html @@ -48,8 +48,10 @@ + {% if global_config['mode'] == 'FULL' %} @@ -95,17 +97,22 @@