add SMS capture
This commit is contained in:
@@ -92,6 +92,52 @@ def get_loc_data():
|
||||
except:
|
||||
return str('<h1 style="text-align: center;">No data</h1>')
|
||||
|
||||
def get_sms_data():
|
||||
try:
|
||||
dash_sms = ast.literal_eval(os.popen('cat ' + sms_file).read())
|
||||
tmp_sms = ''
|
||||
|
||||
sms_hdr = '''
|
||||
|
||||
<tr>
|
||||
<td style="text-align: center;">
|
||||
<h2><strong> Source <br /></strong></h2>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h2> <strong>Destination</strong> </h2>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h2> <strong>SMS</strong> </h2>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h2> <strong>Local Time</strong> </h2>
|
||||
</td>
|
||||
</tr>
|
||||
'''
|
||||
|
||||
for e in dash_sms:
|
||||
if type(e['time']) == str:
|
||||
loc_time = str(e['time'])
|
||||
if type(e['time']) == int or type(e['time']) == float:
|
||||
loc_time = datetime.fromtimestamp(e['time']).strftime(time_format)
|
||||
tmp_sms = tmp_sms + '''
|
||||
<tr>
|
||||
<td style="text-align: center;">
|
||||
<p><strong> ''' + e['snd_call'] + ''' <br /></strong>''' + e['snd_dmr_id'] + '''<strong><br /></strong></p>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<p><strong>''' + e['rcv_call'] + '''</strong><br />''' + e['rcv_dmr_id'] + '''</p>
|
||||
</td>
|
||||
<td style="text-align: center;"><strong> ''' + e['sms'] + ''' </strong></td>
|
||||
<td style="text-align: center;"> ''' + loc_time + ''' </td>
|
||||
</tr>
|
||||
'''
|
||||
|
||||
return str('<h1 style="text-align: center;">SMS</h1>' + tbl_hdr + sms_hdr + tmp_sms + tbl_ftr)
|
||||
except:
|
||||
return str('<h1 style="text-align: center;">No data</h1>')
|
||||
|
||||
|
||||
|
||||
def get_bb_data():
|
||||
try:
|
||||
@@ -241,6 +287,12 @@ def dash_loc():
|
||||
def help():
|
||||
#return get_data()
|
||||
return render_template('help.html', title = dashboard_title, dashboard_url = dashboard_url, logo = logo, description = description, api = use_api, data_call_type = data_call_type, data_call_id = data_call_id, aprs_ssid = aprs_ssid)
|
||||
@app.route('/sms/')
|
||||
def dash_template_sms():
|
||||
#return get_data()
|
||||
#return render_template('sms.html', title = dashboard_title, logo = logo)
|
||||
return render_template('generic.html', title = dashboard_title, dashboard_url = dashboard_url, logo = logo, content = Markup(get_sms_data()))
|
||||
|
||||
@app.route('/about/')
|
||||
def about():
|
||||
#return get_data()
|
||||
@@ -1001,6 +1053,8 @@ if __name__ == '__main__':
|
||||
user_settings_file = parser.get('GPS_DATA', 'USER_SETTINGS_FILE')
|
||||
|
||||
auth_token_file = parser.get('GPS_DATA', 'AUTHORIZED_TOKENS_FILE')
|
||||
sms_file = parser.get('GPS_DATA', 'SMS_FILE')
|
||||
|
||||
use_api = parser.get('GPS_DATA', 'USE_API')
|
||||
#access_systems_file = parser.get('GPS_DATA', 'ACCESS_SYSTEMS_FILE')
|
||||
#authorized_users_file = parser.get('GPS_DATA', 'AUTHORIZED_USERS_FILE')
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<td style="text-align: center;"><button onclick="window.location.href='{{dashboard_url}}/';"> Dashboard Home </button></td>
|
||||
<td style="text-align: center;"><button onclick="window.location.href='{{dashboard_url}}/map';"> Station Map </button></td>
|
||||
<td style="text-align: center;"><button onclick="window.location.href='{{dashboard_url}}/mailbox';"> The Mailbox </button></td>
|
||||
<td style="text-align: center;"><button onclick="window.location.href='{{dashboard_url}}/sms';"> SMS Capture </button></td>
|
||||
<td style="text-align: center;"><button onclick="window.location.href='{{dashboard_url}}/user';"> User Settings </button></td>
|
||||
{% if api %}
|
||||
<td style="text-align: center;"><button onclick="window.location.href='{{dashboard_url}}/external_apps';"> External Applications </button></td>
|
||||
|
||||
Reference in New Issue
Block a user