continue work on APRS settings
This commit is contained in:
parent
917e5010f0
commit
08e53941ba
|
|
@ -184,11 +184,8 @@ def send_sms_log(CONFIG, snd_call, rcv_call, msg, rcv_id, snd_id, system_name):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
req = requests.post(user_man_url, data=json_object, headers={'Content-Type': 'application/json'})
|
req = requests.post(user_man_url, data=json_object, headers={'Content-Type': 'application/json'})
|
||||||
## resp = json.loads(req.text)
|
except Exception as e:
|
||||||
## print(resp)
|
logger.error(e)
|
||||||
## return resp['rules']
|
|
||||||
except requests.ConnectionError:
|
|
||||||
logger.error('Config server unreachable')
|
|
||||||
|
|
||||||
def send_bb(CONFIG, callsign, dmr_id, bulletin, system_name):
|
def send_bb(CONFIG, callsign, dmr_id, bulletin, system_name):
|
||||||
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
||||||
|
|
@ -266,8 +263,8 @@ def send_sms_que_req(CONFIG):
|
||||||
resp = json.loads(req.text)
|
resp = json.loads(req.text)
|
||||||
print(resp)
|
print(resp)
|
||||||
return resp['que']
|
return resp['que']
|
||||||
except requests.ConnectionError:
|
except Exception as e:
|
||||||
logger.error('Config server unreachable')
|
logger.error(e)
|
||||||
|
|
||||||
def send_sms_cmd(CONFIG, _rf_id, _cmd):
|
def send_sms_cmd(CONFIG, _rf_id, _cmd):
|
||||||
print('ssnd rmt cmd')
|
print('ssnd rmt cmd')
|
||||||
|
|
@ -1459,12 +1456,16 @@ def rule_timer_loop():
|
||||||
ping(CONFIG)
|
ping(CONFIG)
|
||||||
send_unit_table(CONFIG, UNIT_MAP)
|
send_unit_table(CONFIG, UNIT_MAP)
|
||||||
send_que = send_sms_que_req(CONFIG)
|
send_que = send_sms_que_req(CONFIG)
|
||||||
for i in send_que:
|
try:
|
||||||
try:
|
for i in send_que:
|
||||||
send_sms(False, i['rcv_id'], 0000, 0000, 'unit', i['msg'])
|
try:
|
||||||
except Exception as e:
|
send_sms(False, i['rcv_id'], 0000, 0000, 'unit', i['msg'])
|
||||||
logger.info('Error sending SMS in que to ' + str(i['rcv_id']) + ' - ' + i['msg'])
|
except Exception as e:
|
||||||
logger.info(e)
|
logger.info('Error sending SMS in que to ' + str(i['rcv_id']) + ' - ' + i['msg'])
|
||||||
|
logger.info(e)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error('Send que error')
|
||||||
|
logger.error(e)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
102
web/app.py
102
web/app.py
|
|
@ -169,6 +169,9 @@ def hbnet_web_service():
|
||||||
city = db.Column(db.String(100), nullable=False, server_default='')
|
city = db.Column(db.String(100), nullable=False, server_default='')
|
||||||
notes = db.Column(db.String(2000), nullable=False, server_default='')
|
notes = db.Column(db.String(2000), nullable=False, server_default='')
|
||||||
aprs = db.Column(db.String(2000), nullable=False, server_default='{}')
|
aprs = db.Column(db.String(2000), nullable=False, server_default='{}')
|
||||||
|
api_keys = db.Column(db.String(2000), nullable=False, server_default='[]')
|
||||||
|
other = db.Column(db.String(2000), nullable=False, server_default='{}')
|
||||||
|
|
||||||
#Used for initial approval
|
#Used for initial approval
|
||||||
initial_admin_approved = db.Column('initial_admin_approved', db.Boolean(), nullable=False, server_default='1')
|
initial_admin_approved = db.Column('initial_admin_approved', db.Boolean(), nullable=False, server_default='1')
|
||||||
# Define the relationship to Role via UserRoles
|
# Define the relationship to Role via UserRoles
|
||||||
|
|
@ -2393,12 +2396,6 @@ TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
|
||||||
|
|
||||||
content = '''
|
content = '''
|
||||||
<h1 style="text-align: center;">APRS Settings</h1>
|
<h1 style="text-align: center;">APRS Settings</h1>
|
||||||
'''
|
|
||||||
for g in data_gateways:
|
|
||||||
print(g.name)
|
|
||||||
|
|
||||||
content = content + '''
|
|
||||||
''' + g.name + '''
|
|
||||||
|
|
||||||
<table data-toggle="table" data-pagination="true" data-search="true" >
|
<table data-toggle="table" data-pagination="true" data-search="true" >
|
||||||
<thead>
|
<thead>
|
||||||
|
|
@ -2416,49 +2413,49 @@ TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
'''
|
'''
|
||||||
show_form = True
|
show_form = True
|
||||||
for i in settings.items():
|
for i in settings.items():
|
||||||
content = content + '''
|
content = content + '''
|
||||||
<tr>
|
<tr>
|
||||||
<form action="aprs_settings?save_id=''' + str(i[0]) + '''&save_server=''' + g.name + '''" method="post">
|
<form action="aprs_settings?save_id=''' + str(i[0]) + '''" method="post">
|
||||||
<td>''' + str(i[0]) + '''</td>
|
<td>''' + str(i[0]) + '''</td>
|
||||||
<td>''' + i[1][0]['call'] + '''</td>
|
<td>''' + i[1][0]['call'] + '''</td>
|
||||||
<td><select class="form-select" aria-label="SSID" id="ssid">
|
<td><select class="form-select" aria-label="SSID" id="ssid">
|
||||||
<option selected>Current - ''' + i[1][1]['ssid'] + '''</option>
|
<option selected>Current - ''' + i[1][1]['ssid'] + '''</option>
|
||||||
<option value="1">1</option>
|
<option value="1">1</option>
|
||||||
<option value="2">2</option>
|
<option value="2">2</option>
|
||||||
<option value="3">3</option>
|
<option value="3">3</option>
|
||||||
<option value="4">4</option>
|
<option value="4">4</option>
|
||||||
<option value="5">5</option>
|
<option value="5">5</option>
|
||||||
<option value="6">6</option>
|
<option value="6">6</option>
|
||||||
<option value="7">7</option>
|
<option value="7">7</option>
|
||||||
<option value="8">8</option>
|
<option value="8">8</option>
|
||||||
<option value="9">9</option>
|
<option value="9">9</option>
|
||||||
<option value="10">10</option>
|
<option value="10">10</option>
|
||||||
<option value="11">11</option>
|
<option value="11">11</option>
|
||||||
<option value="12">12</option>
|
<option value="12">12</option>
|
||||||
<option value="13">13</option>
|
<option value="13">13</option>
|
||||||
<option value="14">14</option>
|
<option value="14">14</option>
|
||||||
<option value="15">15</option>
|
<option value="15">15</option>
|
||||||
</select></td>
|
</select></td>
|
||||||
|
|
||||||
<td><div class="input-group mb-3">
|
<td><div class="input-group mb-3">
|
||||||
<span class="input-group-text" id="icon"></span>
|
<span class="input-group-text" id="icon"></span>
|
||||||
<input type="text" class="form-control" placeholder="''' + i[1][2]['icon'] + '''" aria-label="Username" aria-describedby="basic-addon1">
|
<input type="text" class="form-control" placeholder="''' + i[1][2]['icon'] + '''" aria-label="Username" aria-describedby="basic-addon1">
|
||||||
</div></td>
|
</div></td>
|
||||||
<td><div class="input-group mb-3">
|
<td><div class="input-group mb-3">
|
||||||
<span class="input-group-text" id="icon"></span>
|
<span class="input-group-text" id="icon"></span>
|
||||||
<input type="text" class="form-control" placeholder="''' + i[1][3]['comment'] + '''" aria-label="Username" aria-describedby="basic-addon1">
|
<input type="text" class="form-control" placeholder="''' + i[1][3]['comment'] + '''" aria-label="Username" aria-describedby="basic-addon1">
|
||||||
</div></td>
|
</div></td>
|
||||||
<td><div class="input-group mb-3">
|
<td><div class="input-group mb-3">
|
||||||
<span class="input-group-text" id="icon"></span>
|
<span class="input-group-text" id="icon"></span>
|
||||||
<input type="text" class="form-control" placeholder="''' + i[1][4]['pin'] + '''" aria-label="Username" aria-describedby="basic-addon1">
|
<input type="text" class="form-control" placeholder="''' + i[1][4]['pin'] + '''" aria-label="Username" aria-describedby="basic-addon1">
|
||||||
</div></td>
|
</div></td>
|
||||||
<td>''' + str(i[1][5]['APRS']) + '''</td>
|
<td>''' + str(i[1][5]['APRS']) + '''</td>
|
||||||
</form>
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
\n
|
\n
|
||||||
'''
|
'''
|
||||||
content = content + '</tbody></table>'
|
content = content + '</tbody></table>'
|
||||||
|
|
||||||
## for i in bbl:
|
## for i in bbl:
|
||||||
|
|
@ -3083,8 +3080,13 @@ Name: <strong>''' + p.name + '''</strong> - Port: <strong>''' + str(
|
||||||
aprs_dict = {}
|
aprs_dict = {}
|
||||||
for i in ul:
|
for i in ul:
|
||||||
usr_settings = ast.literal_eval(i.aprs)
|
usr_settings = ast.literal_eval(i.aprs)
|
||||||
for s in usr_settings.items():
|
for s in usr_settings.items():
|
||||||
aprs_dict[int(s[0])] = s[1]
|
print(s[1])
|
||||||
|
if s[1] == 'default':
|
||||||
|
aprs_dict[int(s[0])] = [{'call': str(i.username).upper()}, {'ssid': ''}, {'icon': ''}, {'comment': ''}, {'pin': ''}, {'APRS': False}]
|
||||||
|
else:
|
||||||
|
aprs_dict[int(s[0])] = s[1]
|
||||||
|
print(aprs_dict)
|
||||||
return aprs_dict
|
return aprs_dict
|
||||||
|
|
||||||
def add_burnlist(_dmr_id, _version):
|
def add_burnlist(_dmr_id, _version):
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@ secret_key = 'SUPER SECRET LONG KEY'
|
||||||
# Timezone to show time stamps in. Stored in DB as UTC. Offset in hours.
|
# Timezone to show time stamps in. Stored in DB as UTC. Offset in hours.
|
||||||
hbnet_tz = -1
|
hbnet_tz = -1
|
||||||
|
|
||||||
|
# Time format for display on some pages
|
||||||
|
time_format = '%H:%M:%S - %m/%d/%y'
|
||||||
|
|
||||||
# Default state for newly created user accounts. Setting to False will require
|
# Default state for newly created user accounts. Setting to False will require
|
||||||
# the approval of an admin user before the user can login.
|
# the approval of an admin user before the user can login.
|
||||||
default_account_state = True
|
default_account_state = True
|
||||||
|
|
@ -89,6 +92,3 @@ USER_AUTO_LOGIN_AFTER_CONFIRM = False
|
||||||
USER_SHOW_USERNAME_DOES_NOT_EXIST = True
|
USER_SHOW_USERNAME_DOES_NOT_EXIST = True
|
||||||
|
|
||||||
|
|
||||||
# Time format for display on some pages
|
|
||||||
time_format = '%H:%M:%S - %m/%d/%y'
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue