mirror of https://github.com/kf7eel/hbnet.git
add dashboard only mode for FreeDMR and HBLink
This commit is contained in:
parent
aa3271255f
commit
5d3ade330b
97
web/app.py
97
web/app.py
|
|
@ -648,7 +648,7 @@ def hbnet_web_service():
|
|||
field_2 = '''<div class="panel panel-default">
|
||||
<div class="panel-heading" style="text-align: center;"><h4>Terms of Use</h4></div>
|
||||
<div class="panel-body">
|
||||
<p>By using <strong>''' + title + '''</strong>, 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.</p>
|
||||
<p>By using <strong>''' + title + '''</strong>, 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.</p>
|
||||
|
||||
</div>
|
||||
</div>''',
|
||||
|
|
@ -657,7 +657,7 @@ def hbnet_web_service():
|
|||
db.session.add(tos_entry_add)
|
||||
home_entry_add = Misc(
|
||||
field_1 = 'home_page',
|
||||
field_2 = '<p>Welcome to <strong>' + title + '</strong></p>.',
|
||||
field_2 = '<p>Welcome to <strong>' + title + '</strong>.</p>',
|
||||
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():
|
|||
</table>
|
||||
</i>
|
||||
""", icon=folium.Icon(color="blue", icon="record"), tooltip='<strong>' + i.callsign + '</strong>').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='''
|
||||
##<div class="panel panel-default">
|
||||
## <div class="panel-heading" style="text-align: center;"><h4>''' + l[1][0] + '''</h4></div>
|
||||
## <div class="panel-body">
|
||||
## ''' + l[1][5] + '''
|
||||
## <hr />
|
||||
## ''' + l[1][1] + ''', ''' + l[1][2] + '''
|
||||
## <hr />
|
||||
## ''' + l[1][3] + '''
|
||||
## <hr />
|
||||
## ''' + l[1][4] + '''
|
||||
## <hr />
|
||||
## ''' + l[1][6] + '''
|
||||
## </div>
|
||||
##</div>
|
||||
## ''', icon=folium.Icon(color="red", icon="record"), tooltip='<strong>' + l[1][0] + '</strong>').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='''
|
||||
##<div class="panel panel-default">
|
||||
## <div class="panel-heading" style="text-align: center;"><h4>''' + l[1][0] + '''</h4></div>
|
||||
## <div class="panel-body">
|
||||
## ''' + l[1][5] + '''
|
||||
## <hr />
|
||||
## ''' + l[1][1] + ''', ''' + l[1][2] + '''
|
||||
## <hr />
|
||||
## ''' + l[1][3] + '''
|
||||
## <hr />
|
||||
## ''' + l[1][4] + '''
|
||||
## <hr />
|
||||
## ''' + l[1][6] + '''
|
||||
## </div>
|
||||
##</div>
|
||||
## ''', icon=folium.Icon(color="red", icon="record"), tooltip='<strong>' + l[1][0] + '</strong>').add_to(f_map)
|
||||
|
||||
folium.Marker([float(l.lat), float(l.lon)], popup='''
|
||||
<table style="width: 100px; height: 100px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p><h4><a href="''' + url + '/map_info/' + str(l.dmr_id) + '''" target="_blank" rel="noopener"><strong>''' + l.callsign + '''</strong></a></h4></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>''' + l.loc + '''</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
folium.Marker([float(l.lat), float(l.lon)], popup='''
|
||||
<table style="width: 100px; height: 100px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p><h4><a href="''' + url + '/map_info/' + str(l.dmr_id) + '''" target="_blank" rel="noopener"><strong>''' + l.callsign + '''</strong></a></h4></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>''' + l.loc + '''</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
''', icon=folium.Icon(color="red", icon="record"), tooltip='<strong>' + l.callsign + '</strong>').add_to(f_map)
|
||||
''', icon=folium.Icon(color="red", icon="record"), tooltip='<strong>' + l.callsign + '</strong>').add_to(f_map)
|
||||
content = f_map._repr_html_()
|
||||
|
||||
return render_template('map.html', markup_content = Markup(content))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,10 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{url}}/"><i class="bi bi-house-fill"></i> Home </a>
|
||||
</li>
|
||||
{% if global_config['mode'] == 'FULL' %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{url}}/talkgroups"><i class="bi bi-card-list"></i> Talkgroups </a>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{url}}/map"><i class="bi bi-map"></i> Map </a>
|
||||
</li>
|
||||
|
|
@ -95,17 +97,22 @@
|
|||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="mmdvm_admin">
|
||||
<li><a class="dropdown-item" href="{{url}}/manage_servers">Manage Servers</a></li>
|
||||
{% if global_config['mode'] == 'FULL' %}
|
||||
<li><a class="dropdown-item" href="{{url}}/manage_peers">Manage Peers</a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/manage_masters">Manage Masters</a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/manage_rules">Manage Rules</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
{% endif %}
|
||||
|
||||
<li><a class="dropdown-item" href="{{url}}/add_user">Add User</a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/list_users">Manage Users</a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/approve_users">Waiting Approval</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/manage_news">Manage News</a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/misc_settings">Misc Options</a></li>
|
||||
{% if global_config['mode'] == 'FULL' %}
|
||||
<li><a class="dropdown-item" href="{{url}}/auth_log">Authorization Log</a></li>
|
||||
{% endif %}
|
||||
<a class="dropdown-item" href="{{url}}/all_mail/{{ current_user.username or current_user.email }}">Manage Mail</a>
|
||||
|
||||
|
||||
|
|
@ -125,8 +132,9 @@
|
|||
<ul class="dropdown-menu" aria-labelledby="features_menu">
|
||||
<li><a class="dropdown-item" href="{{url}}/mail/{{ current_user.username or current_user.email }}"><i class="bi bi-mailbox"></i> Mailbox </a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/discussion"><i class="bi bi-chat-right-quote"></i> Discussion </a></li>
|
||||
{% if global_config['mode'] == 'FULL' %}
|
||||
<li><a class="dropdown-item" href="{{url}}/generate_passphrase"><i class="bi bi-info-square"></i> Server(s) </a></li>
|
||||
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue