Skip to content

Commit

Permalink
make maps height configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
furlongm committed Sep 2, 2020
1 parent e34c11b commit 272ef33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions openvpn-monitor.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ site=Example
#latitude=40.72
#longitude=-74
maps=True
maps_height=500
geoip_data=/var/lib/GeoIP/GeoLite2-City.mmdb
datetime_format=%d/%m/%Y %H:%M:%S

Expand Down
6 changes: 5 additions & 1 deletion openvpn-monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,10 @@ def init_vars(self, settings, monitor):
self.maps = False
if 'maps' in settings and settings['maps'] == 'True':
self.maps = True
if 'maps_height' in settings:
self.maps_height = settings['maps_height']
else:
self.maps_height = 500

self.latitude = 40.72
self.longitude = -74
Expand Down Expand Up @@ -800,7 +804,7 @@ def print_session_table(self, vpn_id, vpn_mode, sessions, show_disconnect):
def print_maps_html(self):
output('<div class="panel panel-info"><div class="panel-heading">')
output('<h3 class="panel-title">Map View</h3></div><div class="panel-body">')
output('<div id="map_canvas" style="height:800px"></div>')
output('<div id="map_canvas" style="height:{0!s}px"></div>'.format(self.maps_height))
output('<script type="text/javascript">')
output('var map = L.map("map_canvas", { fullscreenControl: true, '
'fullscreenControlOptions: { position: "topleft" } });')
Expand Down

0 comments on commit 272ef33

Please sign in to comment.