diff --git a/web/app.py b/web/app.py
index 07b16aa..d711f1c 100644
--- a/web/app.py
+++ b/web/app.py
@@ -689,7 +689,7 @@ def hbnet_web_service():
edit_user.last_name = str(radioid_data[2])
edit_user.city = str(radioid_data[3])
for i in radioid_data[0].items():
- aprs_dict[i[0]] = 'default'
+ aprs_dict[i[0]] = """[{'call': '""" + str(user.username).upper() + """'}, {'ssid': ''}, {'icon': ''}, {'comment': ''}, {'pin': ''}, {'APRS': False}]"""
edit_user.aprs = str(aprs_dict)
user_role = UserRoles(
user_id=edit_user.id,
@@ -2388,85 +2388,90 @@ TG #: ''' + str(tg_d.tg) + '''
response = Response(gen_csv, mimetype="text/csv")
return response
- @app.route('/aprs_settings')
+ @app.route('/aprs_settings', methods=['POST', 'GET'])
+ @login_required
def aprs_settings():
user_aprs = User.query.filter_by(username=current_user.username).first()
settings = ast.literal_eval(user_aprs.aprs)
- data_gateways = ServerList.query.filter(ServerList.other_options.ilike('%DATA_GATEWAY%')).all()
-
- content = '''
-
APRS Settings
+## data_gateways = ServerList.query.filter(ServerList.other_options.ilike('%DATA_GATEWAY%')).all()
+ if request.args.get('save_id'):
+
+ aprs_edit(user_aprs.username, request.args.get('save_id'), request.form.get('ssid'), request.form.get('icon'), request.form.get('comment'), request.form.get('pin'), request.form.get('aprs'))
+ content = '''Saved.
+ Redirecting in 1 seconds.
+ '''
+ else:
+ content = '''
+ APRS Settings
-'
return render_template('flask_user_layout.html', markup_content = Markup(content))
@@ -3082,10 +3087,10 @@ Name: ''' + p.name + ''' - Port: ''' + str(
usr_settings = ast.literal_eval(i.aprs)
for s in usr_settings.items():
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]
+## 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
@@ -3168,6 +3173,32 @@ Name: ''' + p.name + ''' - Port: ''' + str(
)
db.session.add(add_bb)
db.session.commit()
+
+ def aprs_edit(_user, _dmr_id, _ssid, _icon, _comment, _pin, _aprs_msg):
+ u = User.query.filter_by(username=_user).first()
+ settings = ast.literal_eval(u.aprs)
+ new_settings = {}
+ _dmr_id = int(_dmr_id)
+ for i in settings:
+ new_settings[i] = settings[i]
+
+ if _ssid != '':
+ new_settings[_dmr_id][1]['ssid'] = _ssid
+ if _icon != '':
+ new_settings[_dmr_id][2]['icon'] = _icon
+ if _comment != '':
+ new_settings[_dmr_id][3]['comment'] = _comment
+ if _pin != '':
+ new_settings[_dmr_id][4]['pin'] = int(_pin)
+ if _aprs_msg == 'True':
+ new_settings[_dmr_id][5]['APRS'] = True
+ if _aprs_msg == 'False':
+ new_settings[_dmr_id][5]['APRS'] = False
+
+ u.aprs = str(new_settings)
+ db.session.commit()
+
+
def del_ss(_dmr_id):
try:
@@ -6205,7 +6236,7 @@ Name: ''' + p.name + ''' - Port: ''' + str(
radioid_data = ast.literal_eval(get_ids(request.form.get('username')))
aprs_dict = {}
for i in radioid_data[0].items():
- aprs_dict[i[0]] = 'default'
+ aprs_dict[i[0]] = """[{'call': '""" + str(request.form.get('username')).upper() + """'}, {'ssid': ''}, {'icon': ''}, {'comment': ''}, {'pin': ''}, {'APRS': False}]"""
user = User(
username=request.form.get('username'),
email=request.form.get('email'),
@@ -6873,7 +6904,7 @@ Name: ''' + p.name + ''' - Port: ''' + str(
sms_que_add('', '', 0, hblink_req['rf_id'], 'motorola', 'unit', hblink_req['sms_cmd'], '', tp.content)
except:
sms_que_add('', '', 0, hblink_req['rf_id'], 'motorola', 'unit', hblink_req['sms_cmd'], '', 'Query not found or other error.')
- elif hblink_req['cmd'][:4] == '@RSS':
+ elif hblink_req['cmd'][:4] == '*RSS':
try:
try:
retr = int(split_cmd[1])
@@ -6888,7 +6919,7 @@ Name: ''' + p.name + ''' - Port: ''' + str(
except:
sms_que_add('', '', 0, hblink_req['rf_id'], 'motorola', 'unit', hblink_req['sms_cmd'], '', 'Not found or other error')
- elif hblink_req['cmd'][:4] == '@RBB':
+ elif hblink_req['cmd'][:4] == '*RBB':
try:
bbl = BulletinBoard.query.order_by(BulletinBoard.time.desc()).limit(3).all()
for i in bbl:
@@ -6896,7 +6927,7 @@ Name: ''' + p.name + ''' - Port: ''' + str(
except:
sms_que_add('', '', 0, hblink_req['rf_id'], 'motorola', 'unit', hblink_req['sms_cmd'], '', 'Not found or other error')
- elif hblink_req['cmd'][:4] == '@RMB':
+ elif hblink_req['cmd'][:4] == '*RMB':
if split_cmd[1]:
try:
mail_all = MailBox.query.filter_by(rcv_callsign=hblink_req['call'].upper()).order_by(MailBox.time.desc()).limit(3).all()