diff --git a/web/app.py b/web/app.py index 6ce499d..4d532de 100644 --- a/web/app.py +++ b/web/app.py @@ -47,58 +47,61 @@ from gen_script_template import gen_script import os, ast ##import hb_config +from hws.misc_functions import * +from hws.views import * + script_links = {} active_tgs = {} ping_list = {} peer_locations = {} -# Query radioid.net for list of IDs -def get_ids(callsign): - try: - url = "https://www.radioid.net" - response = requests.get(url+"/api/dmr/user/?callsign=" + callsign) - result = response.json() -## print(result) - # id_list = [] - id_list = {} - f_name = result['results'][0]['fname'] - l_name = result['results'][0]['surname'] - try: - city = str(result['results'][0]['city'] + ', ' + result['results'][0]['state'] + ', ' + result['results'][0]['country']) - except: - city = result['results'][0]['country'] - for i in result['results']: - id_list[i['id']] = 0 - return str([id_list, f_name, l_name, city]) - except: - return str([{}, '', '', '']) - - -# Return string in NATO phonetics -def convert_nato(string): - d_nato = { 'A': 'ALPHA', 'B': 'BRAVO', 'C': 'CHARLIE', 'D': 'DELTA', - 'E': 'ECHO', 'F': 'FOXTROT', 'G': 'GOLF', 'H': 'HOTEL', - 'I': 'INDIA', 'J': 'JULIETT','K': 'KILO', 'L': 'LIMA', - 'M': 'MIKE', 'N': 'NOVEMBER','O': 'OSCAR', 'P': 'PAPA', - 'Q': 'QUEBEC', 'R': 'ROMEO', 'S': 'SIERRA', 'T': 'TANGO', - 'U': 'UNIFORM', 'V': 'VICTOR', 'W': 'WHISKEY', 'X': 'X-RAY', - 'Y': 'YANKEE', 'Z': 'ZULU', '0': 'zero(0)', '1': 'one(1)', - '2': 'two(2)', '3': 'three(3)', '4': 'four(4)', '5': 'five(5)', - '6': 'six(6)', '7': 'seven(7)', '8': 'eight(8)', '9': 'nine(9)', - 'a': 'alpha', 'b': 'bravo', 'c': 'charlie', 'd': 'delta', - 'e': 'echo', 'f': 'foxtrot', 'g': 'golf', 'h': 'hotel', - 'i': 'india', 'j': 'juliett','k': 'kilo', 'l': 'lima', - 'm': 'mike', 'n': 'november','o': 'oscar', 'p': 'papa', - 'q': 'quebec', 'r': 'romeo', 's': 'sierra', 't': 'tango', - 'u': 'uniform', 'v': 'victor', 'w': 'whiskey', 'x': 'x-ray', - 'y': 'yankee', 'z': 'Zulu'} - ns = '' - for c in string: - try: - ns = ns + d_nato[c] + ' ' - except: - ns = ns + c + ' ' - return ns +### Query radioid.net for list of IDs +##def get_ids(callsign): +## try: +## url = "https://www.radioid.net" +## response = requests.get(url+"/api/dmr/user/?callsign=" + callsign) +## result = response.json() +#### print(result) +## # id_list = [] +## id_list = {} +## f_name = result['results'][0]['fname'] +## l_name = result['results'][0]['surname'] +## try: +## city = str(result['results'][0]['city'] + ', ' + result['results'][0]['state'] + ', ' + result['results'][0]['country']) +## except: +## city = result['results'][0]['country'] +## for i in result['results']: +## id_list[i['id']] = 0 +## return str([id_list, f_name, l_name, city]) +## except: +## return str([{}, '', '', '']) +## +## +### Return string in NATO phonetics +##def convert_nato(string): +## d_nato = { 'A': 'ALPHA', 'B': 'BRAVO', 'C': 'CHARLIE', 'D': 'DELTA', +## 'E': 'ECHO', 'F': 'FOXTROT', 'G': 'GOLF', 'H': 'HOTEL', +## 'I': 'INDIA', 'J': 'JULIETT','K': 'KILO', 'L': 'LIMA', +## 'M': 'MIKE', 'N': 'NOVEMBER','O': 'OSCAR', 'P': 'PAPA', +## 'Q': 'QUEBEC', 'R': 'ROMEO', 'S': 'SIERRA', 'T': 'TANGO', +## 'U': 'UNIFORM', 'V': 'VICTOR', 'W': 'WHISKEY', 'X': 'X-RAY', +## 'Y': 'YANKEE', 'Z': 'ZULU', '0': 'zero(0)', '1': 'one(1)', +## '2': 'two(2)', '3': 'three(3)', '4': 'four(4)', '5': 'five(5)', +## '6': 'six(6)', '7': 'seven(7)', '8': 'eight(8)', '9': 'nine(9)', +## 'a': 'alpha', 'b': 'bravo', 'c': 'charlie', 'd': 'delta', +## 'e': 'echo', 'f': 'foxtrot', 'g': 'golf', 'h': 'hotel', +## 'i': 'india', 'j': 'juliett','k': 'kilo', 'l': 'lima', +## 'm': 'mike', 'n': 'november','o': 'oscar', 'p': 'papa', +## 'q': 'quebec', 'r': 'romeo', 's': 'sierra', 't': 'tango', +## 'u': 'uniform', 'v': 'victor', 'w': 'whiskey', 'x': 'x-ray', +## 'y': 'yankee', 'z': 'Zulu'} +## ns = '' +## for c in string: +## try: +## ns = ns + d_nato[c] + ' ' +## except: +## ns = ns + c + ' ' +## return ns # Class-based application configuration class ConfigClass(object): @@ -662,108 +665,108 @@ def create_app(): db.session.commit() - # The Home page is accessible to anyone - @app.route('/') - def home_page(): - home_text = Misc.query.filter_by(field_1='home_page').first() - #content = Markup('Index') - try: - l_news = News.query.order_by(News.time.desc()).first() - content = ''' - -

''' + l_news.subject + '''

-
-

 

-''' + l_news.date + ''' - -

 

- -
-
-''' + l_news.text + ''' -
-
- - - ''' - except: - content = '' - return render_template('index.html', news = Markup(content), content_block = Markup(home_text.field_2)) - - @app.route('/tos') - def tos_page(): - tos_text = Misc.query.filter_by(field_1='terms_of_service').first() - content = tos_text.field_2 - - return render_template('flask_user_layout.html', markup_content = Markup(content)) - - @app.route('/map') - @login_required - def map_page(): - print(peer_locations) - f_map = folium.Map(location=center_map, zoom_start=map_zoom) - for l in peer_locations.items(): -## 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] + ''' -##
+## # The Home page is accessible to anyone +## @app.route('/') +## def home_page(): +## home_text = Misc.query.filter_by(field_1='home_page').first() +## #content = Markup('Index') +## try: +## l_news = News.query.order_by(News.time.desc()).first() +## content = ''' +## +##

''' + l_news.subject + '''

+##
+##

 

+##''' + l_news.date + ''' - +##

 

+## +##
+##
+##''' + l_news.text + ''' ##
+##
+## +##
+## ''' +## except: +## content = '' +## return render_template('index.html', news = Markup(content), content_block = Markup(home_text.field_2)) +## +## @app.route('/tos') +## def tos_page(): +## tos_text = Misc.query.filter_by(field_1='terms_of_service').first() +## content = tos_text.field_2 +## +## return render_template('flask_user_layout.html', markup_content = Markup(content)) +## +## @app.route('/map') +## @login_required +## def map_page(): +## print(peer_locations) +## f_map = folium.Map(location=center_map, zoom_start=map_zoom) +## for l in peer_locations.items(): +#### 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[1][1]), float(l[1][2])], popup=''' +## +## +## +## +## +## +##
 

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

 
+## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +## +##
DMR ID: ''' + str(l[0]) + ''' 
Location: ''' + l[1][5] + ''' 
Lat, Lon: ''' + l[1][1] + ''', ''' + l[1][2] + ''' 
Description: ''' + l[1][4] + ''' 

URL:

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

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

 
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
DMR ID: ''' + str(l[0]) + ''' 
Location: ''' + l[1][5] + ''' 
Lat, Lon: ''' + l[1][1] + ''', ''' + l[1][2] + ''' 
Description: ''' + l[1][4] + ''' 

URL:

-
 ''' + l[1][3] + ''' 
Device: ''' + l[1][6] + ''' 
- ''', icon=folium.Icon(color="red", icon="record"), tooltip='' + l[1][0] + '').add_to(f_map) - content = f_map._repr_html_() - - return render_template('map.html', markup_content = Markup(content)) - - @app.route('/help') - def help_page(): - return render_template('help.html') +## content = f_map._repr_html_() +## +## return render_template('map.html', markup_content = Markup(content)) +## +## @app.route('/help') +## def help_page(): +## return render_template('help.html') @app.route('/generate_passphrase/pi-star', methods = ['GET']) @login_required @@ -1150,6 +1153,8 @@ def create_app(): if request.form.get('callsign'): callsign = request.form.get('callsign') u = User.query.filter_by(username=callsign).first() + if u.notes = None: + user_notes = '' confirm_link = '' if u.email_confirmed_at == None: confirm_link = '''

Verify email - ''' + str(u.username) + '''

\n''' @@ -1281,7 +1286,7 @@ def create_app(): -


+


diff --git a/web/templates/tg_all.html b/web/templates/tg_all.html index eee0c8b..1ca6c10 100644 --- a/web/templates/tg_all.html +++ b/web/templates/tg_all.html @@ -28,28 +28,6 @@ - - - - - - - - - - - - - - - - - - -
Column 1Column 2
Row 1 Data 1Row 1 Data 2
Row 2 Data 1Row 2 Data 2
- - -