mirror of https://github.com/kf7eel/hbnet.git
docker config update, initial commit of self care, add mode to svr endpoint
This commit is contained in:
parent
daabaed9e5
commit
38eae2e6ab
71
bridge.py
71
bridge.py
|
|
@ -118,15 +118,14 @@ __email__ = 'kf7eel@qsl.net'
|
||||||
#### return config.build_config(cli_file)
|
#### return config.build_config(cli_file)
|
||||||
|
|
||||||
|
|
||||||
def send_unit_table(CONFIG, _data, _bridge_data):
|
def send_unit_table(CONFIG, _data):
|
||||||
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
sms_data = {
|
sms_data = {
|
||||||
'unit_table': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode':'unit_table',
|
||||||
'secret':shared_secret,
|
'secret':shared_secret,
|
||||||
'data': str(_data),
|
'data': str(_data),
|
||||||
'bridge_data': str(_bridge_data),
|
|
||||||
|
|
||||||
}
|
}
|
||||||
json_object = json.dumps(sms_data, indent = 4)
|
json_object = json.dumps(sms_data, indent = 4)
|
||||||
|
|
||||||
|
|
@ -138,13 +137,15 @@ def send_unit_table(CONFIG, _data, _bridge_data):
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
logger.error('Config server unreachable')
|
logger.error('Config server unreachable')
|
||||||
|
|
||||||
def ping(CONFIG):
|
def ping(CONFIG, _bridge_data):
|
||||||
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
ping_data = {
|
ping_data = {
|
||||||
'ping': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
'secret':shared_secret
|
'mode': 'ping',
|
||||||
|
'secret':shared_secret,
|
||||||
|
'bridge_data': str(_bridge_data),
|
||||||
|
'user_systems': str(user_systems())
|
||||||
}
|
}
|
||||||
## print(rules_check)
|
## print(rules_check)
|
||||||
json_object = json.dumps(ping_data, indent = 4)
|
json_object = json.dumps(ping_data, indent = 4)
|
||||||
|
|
@ -158,6 +159,33 @@ def ping(CONFIG):
|
||||||
print('restart')
|
print('restart')
|
||||||
print(sys.argv)
|
print(sys.argv)
|
||||||
os.execv(__file__, sys.argv)
|
os.execv(__file__, sys.argv)
|
||||||
|
elif 'on:' in c or 'off:' in c:
|
||||||
|
|
||||||
|
parse = re.sub('on:|off:','', c)
|
||||||
|
data_list = parse.split(',')
|
||||||
|
iBRIDGES = copy.deepcopy(BRIDGES)
|
||||||
|
## print(parse)
|
||||||
|
## print(BRIDGES[data_list[0]])
|
||||||
|
## print(BRIDGES[data_list[0]])
|
||||||
|
## print(type(BRIDGES[data_list[0]]))
|
||||||
|
## print(BRIDGES[data_list[0]][1])
|
||||||
|
n = 0
|
||||||
|
for r in iBRIDGES[data_list[0]]:
|
||||||
|
## print(r['SYSTEM'])
|
||||||
|
if r['SYSTEM'] == data_list[1]:
|
||||||
|
## print(n)
|
||||||
|
## print(r['SYSTEM'])
|
||||||
|
## print(BRIDGES[data_list[0]][n]['SYSTEM'])
|
||||||
|
## print(BRIDGES[data_list[0]][n]['ACTIVE'])
|
||||||
|
if 'on:' in c:
|
||||||
|
BRIDGES[data_list[0]][n]['ACTIVE'] = True
|
||||||
|
BRIDGES[data_list[0]][n]['TIMER'] = time() + iBRIDGES[data_list[0]][n]['TIMEOUT']
|
||||||
|
if 'off:' in c:
|
||||||
|
BRIDGES[data_list[0]][n]['ACTIVE'] = False
|
||||||
|
print(BRIDGES[data_list[0]][n]['ACTIVE'])
|
||||||
|
n = n + 1
|
||||||
|
else:
|
||||||
|
print(c)
|
||||||
|
|
||||||
## return resp['rules']
|
## return resp['rules']
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
|
|
@ -170,7 +198,8 @@ def download_rules(L_CONFIG_FILE, cli_file):
|
||||||
user_man_url = L_CONFIG_FILE['WEB_SERVICE']['URL']
|
user_man_url = L_CONFIG_FILE['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(L_CONFIG_FILE['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(L_CONFIG_FILE['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
rules_check = {
|
rules_check = {
|
||||||
'get_rules':L_CONFIG_FILE['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': L_CONFIG_FILE['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'get_rules',
|
||||||
'secret':shared_secret
|
'secret':shared_secret
|
||||||
}
|
}
|
||||||
## print(rules_check)
|
## print(rules_check)
|
||||||
|
|
@ -191,7 +220,8 @@ def download_config(L_CONFIG_FILE, cli_file):
|
||||||
user_man_url = L_CONFIG_FILE['WEB_SERVICE']['URL']
|
user_man_url = L_CONFIG_FILE['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(L_CONFIG_FILE['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(L_CONFIG_FILE['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
config_check = {
|
config_check = {
|
||||||
'get_config':L_CONFIG_FILE['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': L_CONFIG_FILE['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'get_config',
|
||||||
'secret':shared_secret
|
'secret':shared_secret
|
||||||
}
|
}
|
||||||
json_object = json.dumps(config_check, indent = 4)
|
json_object = json.dumps(config_check, indent = 4)
|
||||||
|
|
@ -540,6 +570,23 @@ def ten_loop_func():
|
||||||
with open(CONFIG['WEB_SERVICE']['BURN_FILE'], 'w') as f:
|
with open(CONFIG['WEB_SERVICE']['BURN_FILE'], 'w') as f:
|
||||||
f.write(str(download_burnlist(CONFIG)))
|
f.write(str(download_burnlist(CONFIG)))
|
||||||
|
|
||||||
|
def user_systems():
|
||||||
|
peer_files = os.listdir('/tmp/' + CONFIG['LOGGER']['LOG_NAME'] + '_PEERS/')
|
||||||
|
whos_where = {}
|
||||||
|
for i in peer_files:
|
||||||
|
if '.' not in i:
|
||||||
|
print(i)
|
||||||
|
data = ast.literal_eval(os.popen('cat /tmp/' + (CONFIG['LOGGER']['LOG_NAME'] + '_PEERS/' + i)).read())
|
||||||
|
## where_list = {}
|
||||||
|
whos_where[i] = []
|
||||||
|
for d in data.items():
|
||||||
|
print(d[1]['call'])
|
||||||
|
whos_where[i].append(d[1]['call'])
|
||||||
|
## whos_where.append({i:d[1]['call']})
|
||||||
|
## print(whos_where)
|
||||||
|
return whos_where
|
||||||
|
## ast.literal_eval(os.popen('cat /tmp/' + (CONFIG['LOGGER']['LOG_NAME'] + '_PEERS/' + system)).read())
|
||||||
|
|
||||||
|
|
||||||
# Run this every minute for rule timer updates
|
# Run this every minute for rule timer updates
|
||||||
def rule_timer_loop(unit_flood_time):
|
def rule_timer_loop(unit_flood_time):
|
||||||
|
|
@ -593,7 +640,7 @@ def rule_timer_loop(unit_flood_time):
|
||||||
|
|
||||||
for unit in remove_list:
|
for unit in remove_list:
|
||||||
del UNIT_MAP[unit]
|
del UNIT_MAP[unit]
|
||||||
send_unit_table(CONFIG, UNIT_MAP, BRIDGES)
|
send_unit_table(CONFIG, UNIT_MAP)
|
||||||
|
|
||||||
logger.debug('Removed unit(s) %s from UNIT_MAP', remove_list)
|
logger.debug('Removed unit(s) %s from UNIT_MAP', remove_list)
|
||||||
|
|
||||||
|
|
@ -615,7 +662,7 @@ def rule_timer_loop(unit_flood_time):
|
||||||
|
|
||||||
# run this every 10 seconds to trim orphaned stream ids
|
# run this every 10 seconds to trim orphaned stream ids
|
||||||
def stream_trimmer_loop():
|
def stream_trimmer_loop():
|
||||||
ping(CONFIG)
|
ping(CONFIG, BRIDGES)
|
||||||
logger.debug('(ROUTER) Trimming inactive stream IDs from system lists')
|
logger.debug('(ROUTER) Trimming inactive stream IDs from system lists')
|
||||||
_now = time()
|
_now = time()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -319,6 +319,8 @@ def download_aprs_settings(_CONFIG):
|
||||||
user_man_url = _CONFIG['WEB_SERVICE']['URL']
|
user_man_url = _CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(_CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(_CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
aprs_check = {
|
aprs_check = {
|
||||||
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'aprs_settings',
|
||||||
'aprs_settings':True,
|
'aprs_settings':True,
|
||||||
'secret':shared_secret
|
'secret':shared_secret
|
||||||
}
|
}
|
||||||
|
|
@ -339,6 +341,8 @@ def ping(CONFIG):
|
||||||
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
ping_data = {
|
ping_data = {
|
||||||
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'ping',
|
||||||
'ping': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'ping': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
'secret':shared_secret
|
'secret':shared_secret
|
||||||
}
|
}
|
||||||
|
|
@ -364,7 +368,8 @@ def send_dash_loc(CONFIG, call, lat, lon, time, comment, dmr_id):
|
||||||
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
loc_data = {
|
loc_data = {
|
||||||
'dashboard': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'dashboard',
|
||||||
'secret':shared_secret,
|
'secret':shared_secret,
|
||||||
'call': call,
|
'call': call,
|
||||||
'lat' : lat,
|
'lat' : lat,
|
||||||
|
|
@ -387,7 +392,8 @@ def send_sms_log(CONFIG, snd_call, rcv_call, msg, rcv_id, snd_id, system_name):
|
||||||
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
sms_data = {
|
sms_data = {
|
||||||
'log_sms': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'log_sms',
|
||||||
'secret':shared_secret,
|
'secret':shared_secret,
|
||||||
'snd_call': snd_call,
|
'snd_call': snd_call,
|
||||||
'rcv_call': rcv_call,
|
'rcv_call': rcv_call,
|
||||||
|
|
@ -409,7 +415,8 @@ def send_bb(CONFIG, callsign, dmr_id, bulletin, system_name):
|
||||||
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
sms_data = {
|
sms_data = {
|
||||||
'bb_send': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'bb_send',
|
||||||
'secret':shared_secret,
|
'secret':shared_secret,
|
||||||
'callsign': callsign,
|
'callsign': callsign,
|
||||||
'dmr_id': dmr_id,
|
'dmr_id': dmr_id,
|
||||||
|
|
@ -432,7 +439,8 @@ def send_mb(CONFIG, _dst_callsign, _src_callsign, message, _dst_dmr_id, _src_dmr
|
||||||
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
mb_data = {
|
mb_data = {
|
||||||
'mb_add': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'mb_add',
|
||||||
'secret':shared_secret,
|
'secret':shared_secret,
|
||||||
'dst_callsign': _dst_callsign,
|
'dst_callsign': _dst_callsign,
|
||||||
'src_callsign': _src_callsign,
|
'src_callsign': _src_callsign,
|
||||||
|
|
@ -480,7 +488,8 @@ def send_unit_table(CONFIG, _data):
|
||||||
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
sms_data = {
|
sms_data = {
|
||||||
'unit_table': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'unit_table',
|
||||||
'secret':shared_secret,
|
'secret':shared_secret,
|
||||||
'data': str(_data),
|
'data': str(_data),
|
||||||
|
|
||||||
|
|
@ -500,7 +509,8 @@ def send_known_services(CONFIG, _data):
|
||||||
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
sms_data = {
|
sms_data = {
|
||||||
'known_services': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'known_services',
|
||||||
'secret':shared_secret,
|
'secret':shared_secret,
|
||||||
'data': str(_data),
|
'data': str(_data),
|
||||||
|
|
||||||
|
|
@ -520,7 +530,8 @@ def send_sms_que_req(CONFIG):
|
||||||
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
sms_req_data = {
|
sms_req_data = {
|
||||||
'get_sms_que': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'get_sms_que',
|
||||||
'secret':shared_secret,
|
'secret':shared_secret,
|
||||||
}
|
}
|
||||||
json_object = json.dumps(sms_req_data, indent = 4)
|
json_object = json.dumps(sms_req_data, indent = 4)
|
||||||
|
|
@ -538,7 +549,8 @@ def send_sms_cmd(CONFIG, _rf_id, _cmd):
|
||||||
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
user_man_url = CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
sms_cmd_data = {
|
sms_cmd_data = {
|
||||||
'sms_cmd': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'sms_cmd',
|
||||||
'secret':shared_secret,
|
'secret':shared_secret,
|
||||||
'rf_id': _rf_id,
|
'rf_id': _rf_id,
|
||||||
'cmd': _cmd,
|
'cmd': _cmd,
|
||||||
|
|
@ -563,7 +575,8 @@ def download_config(CONFIG_FILE, cli_file):
|
||||||
user_man_url = CONFIG_FILE['WEB_SERVICE']['URL']
|
user_man_url = CONFIG_FILE['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(CONFIG_FILE['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(CONFIG_FILE['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
config_check = {
|
config_check = {
|
||||||
'get_config':CONFIG_FILE['WEB_SERVICE']['THIS_SERVER_NAME'],
|
'server': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'get_config',
|
||||||
'secret':shared_secret
|
'secret':shared_secret
|
||||||
}
|
}
|
||||||
json_object = json.dumps(config_check, indent = 4)
|
json_object = json.dumps(config_check, indent = 4)
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ MQTT_PASSWORD2:
|
||||||
# Otherwise ACLs work as described in the global stanza
|
# Otherwise ACLs work as described in the global stanza
|
||||||
[HBNET]
|
[HBNET]
|
||||||
MODE: OPENBRIDGE
|
MODE: OPENBRIDGE
|
||||||
ENABLED: True
|
ENABLED: False
|
||||||
IP:
|
IP:
|
||||||
PORT: 53002
|
PORT: 53002
|
||||||
NETWORK_ID: 99
|
NETWORK_ID: 99
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ OTHER_OPTIONS:
|
||||||
|
|
||||||
[DATA_GATEWAY]
|
[DATA_GATEWAY]
|
||||||
MODE: OPENBRIDGE
|
MODE: OPENBRIDGE
|
||||||
ENABLED: True
|
ENABLED: False
|
||||||
IP:
|
IP:
|
||||||
PORT: 53001
|
PORT: 53001
|
||||||
NETWORK_ID: 99
|
NETWORK_ID: 99
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,8 @@ def download_burnlist(_CONFIG):
|
||||||
user_man_url = _CONFIG['WEB_SERVICE']['URL']
|
user_man_url = _CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(_CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(_CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
burn_check = {
|
burn_check = {
|
||||||
|
'server': _CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'burn_list',
|
||||||
'burn_list':True,
|
'burn_list':True,
|
||||||
'secret':shared_secret
|
'secret':shared_secret
|
||||||
}
|
}
|
||||||
|
|
@ -332,6 +334,8 @@ class HBSYSTEM(DatagramProtocol):
|
||||||
shared_secret = str(sha256(self._CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(self._CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
## print(int(str(int_id(_id))[:7]))
|
## print(int(str(int_id(_id))[:7]))
|
||||||
auth_check = {
|
auth_check = {
|
||||||
|
'server': self._CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'auth_check',
|
||||||
'secret':shared_secret,
|
'secret':shared_secret,
|
||||||
'login_id':int(str(int_id(_id))[:7]),
|
'login_id':int(str(int_id(_id))[:7]),
|
||||||
'login_ip': peer_ip,
|
'login_ip': peer_ip,
|
||||||
|
|
@ -354,6 +358,8 @@ class HBSYSTEM(DatagramProtocol):
|
||||||
shared_secret = str(sha256(self._CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(self._CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
#print(int(str(int_id(_id))[:7]))
|
#print(int(str(int_id(_id))[:7]))
|
||||||
auth_conf = {
|
auth_conf = {
|
||||||
|
'server': self._CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'login_conf',
|
||||||
'secret':shared_secret,
|
'secret':shared_secret,
|
||||||
'login_id':int(str(int_id(_id))[:7]),
|
'login_id':int(str(int_id(_id))[:7]),
|
||||||
'login_ip': peer_ip,
|
'login_ip': peer_ip,
|
||||||
|
|
@ -375,6 +381,8 @@ class HBSYSTEM(DatagramProtocol):
|
||||||
user_man_url = self._CONFIG['WEB_SERVICE']['URL']
|
user_man_url = self._CONFIG['WEB_SERVICE']['URL']
|
||||||
shared_secret = str(sha256(self._CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
shared_secret = str(sha256(self._CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||||
peer_loc_conf = {
|
peer_loc_conf = {
|
||||||
|
'server': self._CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
|
||||||
|
'mode': 'peer_loc',
|
||||||
'secret':shared_secret,
|
'secret':shared_secret,
|
||||||
'loc_callsign':re.sub("b'|'|\s\s+", '', str(call)),
|
'loc_callsign':re.sub("b'|'|\s\s+", '', str(call)),
|
||||||
'dmr_id' : int(str(int_id(_id))),
|
'dmr_id' : int(str(int_id(_id))),
|
||||||
|
|
|
||||||
275
web/app.py
275
web/app.py
|
|
@ -1158,36 +1158,85 @@ By using this service, you agree not to do anything malicious. You agree to use
|
||||||
def gateway_wiz_page(add_server):
|
def gateway_wiz_page(add_server):
|
||||||
return render_template('data_gateway_wizard.html', server = add_server)
|
return render_template('data_gateway_wizard.html', server = add_server)
|
||||||
|
|
||||||
@app.route('/bridge_status/<server>/<system>')
|
@app.route('/bridge_status/<server>/<system>', methods=['GET', 'POST'])
|
||||||
def bridge_tg_status(server, system):
|
def bridge_tg_status(server, system):
|
||||||
server_bridges = Misc.query.filter_by(field_1='bridge_table_' + server).first()
|
if request.args.get('change'):
|
||||||
BRIDGES = ast.literal_eval(server_bridges.field_2)
|
## connected = Misc.query.filter_by(field_1='user_system_table_' + server).first()
|
||||||
table_data = ''
|
## connected_list = ast.literal_eval(connected.field_2)
|
||||||
for _bridge in BRIDGES:
|
#### print(connected_list[system])
|
||||||
for e in BRIDGES[_bridge]:
|
## for i in connected_list[system]:
|
||||||
if system == e['SYSTEM']:
|
## print(i)
|
||||||
## print(e)
|
## if str(current_user.username).upper() == i.upper():
|
||||||
print(type(e['TIMER']))
|
## print('yay')
|
||||||
print(datetime.datetime.fromtimestamp(e['TIMER']))
|
#### if current_user.username
|
||||||
print()
|
try:
|
||||||
if time.time() <= e['TIMER']:
|
## if current_user.has_roles('Admin'):
|
||||||
exp = '''
|
cl = Misc.query.filter_by(field_1=request.args.get('server') + '_command_list').first()
|
||||||
<div class="alert alert-Success">
|
cmd_lst = ast.literal_eval(cl.field_2)
|
||||||
<strong>On</strong> <br /> ''' + str(datetime.datetime.fromtimestamp(e['TIMER'])).strftime(time_format) + '''
|
## print('--')
|
||||||
</div>
|
print(cmd_lst)
|
||||||
'''
|
except:
|
||||||
elif time.time() > e['TIMER']:
|
cmd_lst = []
|
||||||
exp = '''
|
misc_add(request.args.get('server') + '_command_list', str(cmd_lst), '', '', 0, 0, 0, 0, False, False)
|
||||||
<div class="alert alert-danger">
|
|
||||||
<strong>Off</strong>
|
## if request.args.get('server_command') == 'restart':
|
||||||
</div>
|
## cmd_lst.append('restart')
|
||||||
'''
|
## elif request.args.get('server_command') == '2':
|
||||||
table_data = table_data + '<tr><td>' + _bridge + '</td><td>' + str(int_id(e['TGID'])) + '</td><td>' + exp + '</td></tr>'
|
## cmd_lst.append('2')
|
||||||
|
cmd_lst.append(request.args.get('change'))
|
||||||
## print(str((timedelta(seconds=e['TIMER']) + datetime.datetime.fromtimestamp(e['TIMER'])).strftime(time_format)))
|
## print(cmd_lst)
|
||||||
|
content = '''<h3 style="text-align: center;">Changes qued.</h3>
|
||||||
|
<p style="text-align: center;">Redirecting in 3 seconds.</p>
|
||||||
return render_template('bridge_status.html', table_data = Markup(table_data), server = server, system = system)
|
<meta http-equiv="refresh" content="3; URL=/bridge_status/''' + server + '''/''' + system + '''" />'''
|
||||||
|
misc_edit_field_1(request.args.get('server') + '_command_list', str(cmd_lst), '', '', 0, 0, 0, 0, False, False)
|
||||||
|
## misc_add(request.args.get('server') + '_command_list', str(cmd_lst), '', '', 0, 0, 0, 0, False, False)
|
||||||
|
return render_template('flask_user_layout.html', markup_content = Markup(content))
|
||||||
|
else:
|
||||||
|
connected = Misc.query.filter_by(field_1='user_system_table_' + server).first()
|
||||||
|
connected_list = ast.literal_eval(connected.field_2)
|
||||||
|
## print(connected_list[system])
|
||||||
|
for i in connected_list[system]:
|
||||||
|
print(i)
|
||||||
|
if str(current_user.username).upper() == i.upper() or current_user.has_roles('Admin'):
|
||||||
|
server_bridges = Misc.query.filter_by(field_1='bridge_table_' + server).first()
|
||||||
|
BRIDGES = ast.literal_eval(server_bridges.field_2)
|
||||||
|
table_data = ''
|
||||||
|
for _bridge in BRIDGES:
|
||||||
|
for e in BRIDGES[_bridge]:
|
||||||
|
if system == e['SYSTEM']:
|
||||||
|
## print(e)
|
||||||
|
## print(type(e['TIMER']))
|
||||||
|
## print(datetime.datetime.fromtimestamp(e['TIMER']))
|
||||||
|
## print()
|
||||||
|
## if time.time() <= e['TIMER']:
|
||||||
|
## print(e)
|
||||||
|
if e['ACTIVE']:
|
||||||
|
change_button = '<a href="/bridge_status/' + server + '/' + system + '?server=' + server + '&change=off:' + _bridge + ',' + system + '"><button type="button" class="btn btn-danger">Off</button></a>'
|
||||||
|
exp_time = 'Expires: ' + str(datetime.datetime.fromtimestamp(e['TIMER']).strftime(time_format))
|
||||||
|
if time.time() > e['TIMER']:
|
||||||
|
exp_time = ''
|
||||||
|
exp = '''
|
||||||
|
<div class="alert alert-success">
|
||||||
|
<strong>On</strong> <br /> ''' + exp_time + '''
|
||||||
|
</div>
|
||||||
|
'''
|
||||||
|
## elif time.time() > e['TIMER']:
|
||||||
|
elif not e['ACTIVE']:
|
||||||
|
change_button = '<a href="/bridge_status/' + server + '/' + system + '?server=' + server + '&change=on:' + _bridge + ',' + system + '"><button type="button" class="btn btn-success">On</button></a>'
|
||||||
|
exp = '''
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<strong>Off</strong>
|
||||||
|
</div>
|
||||||
|
'''
|
||||||
|
table_data = table_data + '<tr><td>' + _bridge + '</td><td>' + str(int_id(e['TGID'])) + '</td><td>' + exp + '</td><td>' + change_button + '</td></tr>'
|
||||||
|
|
||||||
|
return render_template('bridge_status.html', table_data = Markup(table_data), server = server, system = system)
|
||||||
|
else:
|
||||||
|
content = '''<h3 style="text-align: center;">Not Authorized.</h3>
|
||||||
|
<p style="text-align: center;">Redirecting in 3 seconds.</p>
|
||||||
|
<meta http-equiv="refresh" content="3; URL=/generate_passphrase" />'''
|
||||||
|
## misc_add(request.args.get('server') + '_command_list', str(cmd_lst), '', '', 0, 0, 0, 0, False, False)
|
||||||
|
return render_template('flask_user_layout.html', markup_content = Markup(content))
|
||||||
|
|
||||||
@app.route('/generate_passphrase/pi-star', methods = ['GET'])
|
@app.route('/generate_passphrase/pi-star', methods = ['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
|
|
@ -1257,8 +1306,6 @@ By using this service, you agree not to do anything malicious. You agree to use
|
||||||
svr_status = '''<div class="alert alert-warning">
|
svr_status = '''<div class="alert alert-warning">
|
||||||
<strong>Unknown Condition</strong>
|
<strong>Unknown Condition</strong>
|
||||||
</div> '''
|
</div> '''
|
||||||
print(ping_list)
|
|
||||||
print(time.time())
|
|
||||||
except:
|
except:
|
||||||
svr_status = '''<div class="alert alert-warning">
|
svr_status = '''<div class="alert alert-warning">
|
||||||
<strong>Unknown</strong>
|
<strong>Unknown</strong>
|
||||||
|
|
@ -1266,6 +1313,25 @@ By using this service, you agree not to do anything malicious. You agree to use
|
||||||
if i.ip == '':
|
if i.ip == '':
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
connected = Misc.query.filter_by(field_1='user_system_table_' + i.name).first()
|
||||||
|
connected_list = ast.literal_eval(connected.field_2)
|
||||||
|
## print(connected_list)
|
||||||
|
clients = '<strong>Self-care: </strong>'
|
||||||
|
for s in connected_list.items():
|
||||||
|
for t in s[1]:
|
||||||
|
if str(current_user.username).upper() == t.upper():
|
||||||
|
clients = clients + '''<a href="/bridge_status/''' + i.name + '''/''' + s[0] + '''"><button type="button" class="btn btn-secondary">''' + s[0] + '''</button></a>\n'''
|
||||||
|
## client_menu = '''
|
||||||
|
##<div class="dropdown">
|
||||||
|
## <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown">
|
||||||
|
## Tools
|
||||||
|
## </button>
|
||||||
|
## <ul class="dropdown-menu">
|
||||||
|
## ''' + clients + '''
|
||||||
|
## </ul>
|
||||||
|
##</div>
|
||||||
|
##'''
|
||||||
|
|
||||||
tool_menu = '''
|
tool_menu = '''
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown">
|
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown">
|
||||||
|
|
@ -1285,6 +1351,8 @@ By using this service, you agree not to do anything malicious. You agree to use
|
||||||
''' + svr_status + '''
|
''' + svr_status + '''
|
||||||
<div style="max-width:200px; word-wrap:break-word; text-align: center;">''' + i.public_notes + '''</div>
|
<div style="max-width:200px; word-wrap:break-word; text-align: center;">''' + i.public_notes + '''</div>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
''' + clients + '''
|
||||||
|
<p> </p>
|
||||||
''' + tool_menu + '''
|
''' + tool_menu + '''
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -4820,10 +4888,11 @@ Name: <strong>''' + p.name + '''</strong> - Port: <strong>''' + str(
|
||||||
cmd_lst = []
|
cmd_lst = []
|
||||||
misc_add(request.args.get('server') + '_command_list', str(cmd_lst), '', '', 0, 0, 0, 0, False, False)
|
misc_add(request.args.get('server') + '_command_list', str(cmd_lst), '', '', 0, 0, 0, 0, False, False)
|
||||||
|
|
||||||
if request.args.get('server_command') == 'restart':
|
## if request.args.get('server_command') == 'restart':
|
||||||
cmd_lst.append('restart')
|
## cmd_lst.append('restart')
|
||||||
elif request.args.get('server_command') == '2':
|
## elif request.args.get('server_command') == '2':
|
||||||
cmd_lst.append('2')
|
## cmd_lst.append('2')
|
||||||
|
cmd_lst.append(request.args.get('server_command'))
|
||||||
print(cmd_lst)
|
print(cmd_lst)
|
||||||
content = '''<h3 style="text-align: center;">Command qued.</h3>
|
content = '''<h3 style="text-align: center;">Command qued.</h3>
|
||||||
<p style="text-align: center;">Redirecting in 3 seconds.</p>
|
<p style="text-align: center;">Redirecting in 3 seconds.</p>
|
||||||
|
|
@ -7550,28 +7619,46 @@ Name: <strong>''' + p.name + '''</strong> - Port: <strong>''' + str(
|
||||||
@app.route('/svr', methods=['POST'])
|
@app.route('/svr', methods=['POST'])
|
||||||
def svr_endpoint():
|
def svr_endpoint():
|
||||||
hblink_req = request.json
|
hblink_req = request.json
|
||||||
print((hblink_req))
|
## print((hblink_req))
|
||||||
# 'd3967357e0b5788a03a1a61acefa72af8d2dbfe282d8718809f90fcc6f4aca41' = DATA_GATEWAY
|
# 'd3967357e0b5788a03a1a61acefa72af8d2dbfe282d8718809f90fcc6f4aca41' = DATA_GATEWAY
|
||||||
if hblink_req['secret'] in shared_secrets() or hblink_req['secret'] == 'd3967357e0b5788a03a1a61acefa72af8d2dbfe282d8718809f90fcc6f4aca41' and mode == 'DASH_ONLY':
|
if hblink_req['secret'] in shared_secrets() or hblink_req['secret'] == 'd3967357e0b5788a03a1a61acefa72af8d2dbfe282d8718809f90fcc6f4aca41' and mode == 'DASH_ONLY':
|
||||||
try:
|
## try:
|
||||||
if hblink_req['ping']:
|
## print(hblink_req)
|
||||||
pl = Misc.query.filter_by(field_1='ping_list').first()
|
if hblink_req['mode'] == 'ping':
|
||||||
ping_list = ast.literal_eval(pl.field_2)
|
print(hblink_req['user_systems'])
|
||||||
ping_list[hblink_req['ping']] = time.time()
|
try:
|
||||||
misc_edit_field_1('ping_list', str(ping_list), '', '', 0, 0, 0, 0, True, True)
|
misc_edit_field_1('bridge_table_' + hblink_req['server'], str(hblink_req['bridge_data']), '', '', 0, 0, 0, 0, False, False)
|
||||||
try:
|
misc_edit_field_1('user_system_table_' + hblink_req['server'], str(hblink_req['user_systems']), '', '', 0, 0, 0, 0, False, False)
|
||||||
cl = Misc.query.filter_by(field_1=hblink_req['ping'] + '_command_list').first()
|
|
||||||
cmd_lst = ast.literal_eval(cl.field_2)
|
## delete_misc_field_1('bridge_table_' + hblink_req['ping'])
|
||||||
delete_misc_field_1(hblink_req['ping'] + '_command_list')
|
|
||||||
|
## delete_misc_field_1('user_system_table_' + hblink_req['ping'])
|
||||||
|
|
||||||
|
## misc_add('bridge_table_' + hblink_req['ping'], str(hblink_req['bridge_data']), '', '', 0, 0, 0, 0, False, False)
|
||||||
|
|
||||||
|
## misc_add('user_system_table_' + hblink_req['ping'], str(hblink_req['bridge_data']), '', '', 0, 0, 0, 0, False, False)
|
||||||
|
## print('responsa')
|
||||||
|
except:
|
||||||
|
misc_add('bridge_table_' + hblink_req['server'], str(hblink_req['bridge_data']), '', '', 0, 0, 0, 0, False, False)
|
||||||
|
misc_add('user_system_table_' + hblink_req['server'], str(hblink_req['user_systems']), '', '', 0, 0, 0, 0, False, False)
|
||||||
|
|
||||||
|
pl = Misc.query.filter_by(field_1='ping_list').first()
|
||||||
|
ping_list = ast.literal_eval(pl.field_2)
|
||||||
|
ping_list[hblink_req['server']] = time.time()
|
||||||
|
misc_edit_field_1('ping_list', str(ping_list), '', '', 0, 0, 0, 0, True, True)
|
||||||
|
try:
|
||||||
|
cl = Misc.query.filter_by(field_1=hblink_req['server'] + '_command_list').first()
|
||||||
|
cmd_lst = ast.literal_eval(cl.field_2)
|
||||||
|
delete_misc_field_1(hblink_req['server'] + '_command_list')
|
||||||
|
|
||||||
except:
|
except:
|
||||||
cmd_lst = []
|
cmd_lst = []
|
||||||
|
|
||||||
response = jsonify(
|
response = jsonify(
|
||||||
commands=cmd_lst
|
commands=cmd_lst
|
||||||
)
|
)
|
||||||
except:
|
## except:
|
||||||
pass
|
## pass
|
||||||
if 'login_id' in hblink_req and 'login_confirmed' not in hblink_req:
|
if 'login_id' in hblink_req and 'login_confirmed' not in hblink_req:
|
||||||
if type(hblink_req['login_id']) == int:
|
if type(hblink_req['login_id']) == int:
|
||||||
if authorized_peer(hblink_req['login_id'])[0]:
|
if authorized_peer(hblink_req['login_id'])[0]:
|
||||||
|
|
@ -7640,16 +7727,16 @@ Name: <strong>''' + p.name + '''</strong> - Port: <strong>''' + str(
|
||||||
response = jsonify(
|
response = jsonify(
|
||||||
logged=True
|
logged=True
|
||||||
)
|
)
|
||||||
elif 'burn_list' in hblink_req: # ['burn_list']: # == 'burn_list':
|
elif hblink_req['mode'] == 'burn_list': # ['burn_list']: # == 'burn_list':
|
||||||
response = jsonify(
|
response = jsonify(
|
||||||
burn_list=get_burnlist()
|
burn_list=get_burnlist()
|
||||||
)
|
)
|
||||||
elif 'aprs_settings' in hblink_req: # ['burn_list']: # == 'burn_list':
|
elif hblink_req['mode'] == 'aprs_settings': # ['burn_list']: # == 'burn_list':
|
||||||
## print(get_aprs_settings())
|
## print(get_aprs_settings())
|
||||||
response = jsonify(
|
response = jsonify(
|
||||||
aprs_settings=get_aprs_settings()
|
aprs_settings=get_aprs_settings()
|
||||||
)
|
)
|
||||||
elif 'loc_callsign' in hblink_req:
|
elif hblink_req['mode'] == 'loc_callsign':
|
||||||
if hblink_req['lat'] == '*' and hblink_req['lon'] == '*':
|
if hblink_req['lat'] == '*' and hblink_req['lon'] == '*':
|
||||||
## del peer_locations[hblink_req['dmr_id']]
|
## del peer_locations[hblink_req['dmr_id']]
|
||||||
del_peer_loc(hblink_req['dmr_id'])
|
del_peer_loc(hblink_req['dmr_id'])
|
||||||
|
|
@ -7660,21 +7747,21 @@ Name: <strong>''' + p.name + '''</strong> - Port: <strong>''' + str(
|
||||||
peer_loc_add(hblink_req['loc_callsign'], hblink_req['lat'], hblink_req['lon'], hblink_req['description'], hblink_req['dmr_id'], '', '', hblink_req['url'], hblink_req['software'], hblink_req['loc'])
|
peer_loc_add(hblink_req['loc_callsign'], hblink_req['lat'], hblink_req['lon'], hblink_req['description'], hblink_req['dmr_id'], '', '', hblink_req['url'], hblink_req['software'], hblink_req['loc'])
|
||||||
print(PeerLoc.query.all())
|
print(PeerLoc.query.all())
|
||||||
response = ''
|
response = ''
|
||||||
elif 'dashboard' in hblink_req:
|
elif hblink_req['mode'] == 'dashboard':
|
||||||
if 'lat' in hblink_req:
|
if 'lat' in hblink_req:
|
||||||
# Assuming this is a GPS loc
|
# Assuming this is a GPS loc
|
||||||
dash_loc_add(hblink_req['call'], hblink_req['lat'], hblink_req['lon'], hblink_req['comment'], hblink_req['dmr_id'], hblink_req['dashboard'])
|
dash_loc_add(hblink_req['call'], hblink_req['lat'], hblink_req['lon'], hblink_req['comment'], hblink_req['dmr_id'], hblink_req['dashboard'])
|
||||||
trim_dash_loc()
|
trim_dash_loc()
|
||||||
response = 'yes'
|
response = 'yes'
|
||||||
elif 'log_sms' in hblink_req:
|
elif hblink_req['mode'] == 'log_sms':
|
||||||
sms_log_add(hblink_req['snd_call'], hblink_req['rcv_call'], hblink_req['message'], hblink_req['snd_id'], hblink_req['rcv_id'], hblink_req['log_sms'], hblink_req['system_name'])
|
sms_log_add(hblink_req['snd_call'], hblink_req['rcv_call'], hblink_req['message'], hblink_req['snd_id'], hblink_req['rcv_id'], hblink_req['log_sms'], hblink_req['system_name'])
|
||||||
trim_sms_log()
|
trim_sms_log()
|
||||||
response = 'rcvd'
|
response = 'rcvd'
|
||||||
elif 'bb_send' in hblink_req:
|
elif hblink_req['mode'] == 'bb_send':
|
||||||
bb_add(hblink_req['callsign'], hblink_req['bulletin'], hblink_req['dmr_id'], hblink_req['bb_send'], hblink_req['system_name'])
|
bb_add(hblink_req['callsign'], hblink_req['bulletin'], hblink_req['dmr_id'], hblink_req['bb_send'], hblink_req['system_name'])
|
||||||
trim_bb()
|
trim_bb()
|
||||||
response = 'rcvd'
|
response = 'rcvd'
|
||||||
elif 'mb_add' in hblink_req:
|
elif hblink_req['mode'] == 'mb_add':
|
||||||
if hblink_req['dst_callsign'] == 'admins':
|
if hblink_req['dst_callsign'] == 'admins':
|
||||||
admins = UserRoles.query.filter_by(role_id=2).all()
|
admins = UserRoles.query.filter_by(role_id=2).all()
|
||||||
print(admins)
|
print(admins)
|
||||||
|
|
@ -7692,20 +7779,21 @@ Name: <strong>''' + p.name + '''</strong> - Port: <strong>''' + str(
|
||||||
# del_ss(hblink_req['dmr_id'])
|
# del_ss(hblink_req['dmr_id'])
|
||||||
# ss_add(hblink_req['callsign'], str(hblink_req['message']), hblink_req['dmr_id'])
|
# ss_add(hblink_req['callsign'], str(hblink_req['message']), hblink_req['dmr_id'])
|
||||||
# response = 'rcvd'
|
# response = 'rcvd'
|
||||||
elif 'unit_table' in hblink_req:
|
elif hblink_req['mode'] == 'unit_table':
|
||||||
## del_unit_table(hblink_req['unit_table'])
|
## del_unit_table(hblink_req['unit_table'])
|
||||||
try:
|
try:
|
||||||
delete_misc_field_1('unit_table_' + hblink_req['unit_table'])
|
delete_misc_field_1('unit_table_' + hblink_req['server'])
|
||||||
misc_add('unit_table_' + hblink_req['unit_table'], str(hblink_req['data']), '', '', 0, 0, 0, 0, False, False)
|
misc_add('unit_table_' + hblink_req['unit_table'], str(hblink_req['data']), '', '', 0, 0, 0, 0, False, False)
|
||||||
delete_misc_field_1('bridge_table_' + hblink_req['unit_table'])
|
## delete_misc_field_1('bridge_table_' + hblink_req['unit_table'])
|
||||||
misc_add('bridge_table_' + hblink_req['unit_table'], str(hblink_req['bridge_data']), '', '', 0, 0, 0, 0, False, False)
|
## misc_add('bridge_table_' + hblink_req['unit_table'], str(hblink_req['bridge_data']), '', '', 0, 0, 0, 0, False, False)
|
||||||
|
## misc_edit_field_1('bridge_table_' + hblink_req['unit_table'], str(hblink_req['bridge_data']), '', '', 0, 0, 0, 0, False, False)
|
||||||
except:
|
except:
|
||||||
print('entry error')
|
print('entry error')
|
||||||
misc_add('unit_table_' + hblink_req['unit_table'], str(hblink_req['data']), '', '', 0, 0, 0, 0, False, False)
|
misc_add('unit_table_' + hblink_req['server'], str(hblink_req['data']), '', '', 0, 0, 0, 0, False, False)
|
||||||
misc_add('bridge_table_' + hblink_req['unit_table'], str(hblink_req['bridge_data']), '', '', 0, 0, 0, 0, False, False)
|
## misc_add('bridge_table_' + hblink_req['unit_table'], str(hblink_req['bridge_data']), '', '', 0, 0, 0, 0, False, False)
|
||||||
## unit_table_add(hblink_req['data'])
|
## unit_table_add(hblink_req['data'])
|
||||||
response = 'rcvd'
|
response = 'rcvd'
|
||||||
elif 'known_services' in hblink_req:
|
elif hblink_req['mode'] == 'known_services':
|
||||||
print(hblink_req)
|
print(hblink_req)
|
||||||
## del_unit_table(hblink_req['unit_table'])
|
## del_unit_table(hblink_req['unit_table'])
|
||||||
try:
|
try:
|
||||||
|
|
@ -7718,34 +7806,34 @@ Name: <strong>''' + p.name + '''</strong> - Port: <strong>''' + str(
|
||||||
response = 'rcvd'
|
response = 'rcvd'
|
||||||
|
|
||||||
|
|
||||||
elif 'get_config' in hblink_req:
|
elif hblink_req['mode'] == 'get_config':
|
||||||
if hblink_req['get_config']:
|
## if hblink_req['get_config']:
|
||||||
## active_tgs[hblink_req['get_config']] = {}
|
## active_tgs[hblink_req['get_config']] = {}
|
||||||
|
|
||||||
pl = Misc.query.filter_by(field_1='ping_list').first()
|
pl = Misc.query.filter_by(field_1='ping_list').first()
|
||||||
ping_list = ast.literal_eval(pl.field_2)
|
ping_list = ast.literal_eval(pl.field_2)
|
||||||
|
|
||||||
ping_list[hblink_req['get_config']] = time.time()
|
ping_list[hblink_req['server']] = time.time()
|
||||||
|
|
||||||
misc_edit_field_1('ping_list', str(ping_list), '', '', 0, 0, 0, 0, True, True)
|
misc_edit_field_1('ping_list', str(ping_list), '', '', 0, 0, 0, 0, True, True)
|
||||||
## print(active_tgs)
|
## print(active_tgs)
|
||||||
## try:
|
## try:
|
||||||
## print(get_peer_configs(hblink_req['get_config']))
|
## print(get_peer_configs(hblink_req['get_config']))
|
||||||
|
|
||||||
## print(masters_get(hblink_req['get_config']))
|
## print(masters_get(hblink_req['get_config']))
|
||||||
response = jsonify(
|
response = jsonify(
|
||||||
config=server_get(hblink_req['get_config']),
|
config=server_get(hblink_req['server']),
|
||||||
peers=get_peer_configs(hblink_req['get_config']),
|
peers=get_peer_configs(hblink_req['server']),
|
||||||
masters=masters_get(hblink_req['get_config']),
|
masters=masters_get(hblink_req['server']),
|
||||||
## OBP=get_OBP(hblink_req['get_config'])
|
## OBP=get_OBP(hblink_req['get_config'])
|
||||||
|
|
||||||
)
|
)
|
||||||
## except:
|
## except:
|
||||||
## message = jsonify(message='Config error')
|
## message = jsonify(message='Config error')
|
||||||
## response = make_response(message, 401)
|
## response = make_response(message, 401)
|
||||||
|
|
||||||
|
|
||||||
elif 'get_sms_que' in hblink_req:
|
elif hblink_req['mode'] == 'get_sms_que':
|
||||||
if hblink_req['get_sms_que']:
|
if hblink_req['get_sms_que']:
|
||||||
q = sms_que(hblink_req['get_sms_que'])
|
q = sms_que(hblink_req['get_sms_que'])
|
||||||
|
|
||||||
|
|
@ -7753,7 +7841,7 @@ Name: <strong>''' + p.name + '''</strong> - Port: <strong>''' + str(
|
||||||
que=q
|
que=q
|
||||||
)
|
)
|
||||||
sms_que_purge(hblink_req['get_sms_que'])
|
sms_que_purge(hblink_req['get_sms_que'])
|
||||||
elif 'sms_cmd' in hblink_req:
|
elif hblink_req['mode'] == 'sms_cmd':
|
||||||
## print(get_aprs_settings())
|
## print(get_aprs_settings())
|
||||||
if hblink_req['sms_cmd']:
|
if hblink_req['sms_cmd']:
|
||||||
split_cmd = str(hblink_req['cmd']).split(' ')
|
split_cmd = str(hblink_req['cmd']).split(' ')
|
||||||
|
|
@ -7829,13 +7917,14 @@ Name: <strong>''' + p.name + '''</strong> - Port: <strong>''' + str(
|
||||||
## OBP=get_OBP(hblink_req['get_config'])
|
## OBP=get_OBP(hblink_req['get_config'])
|
||||||
|
|
||||||
)
|
)
|
||||||
elif 'get_rules' in hblink_req:
|
elif hblink_req['mode'] == 'get_rules':
|
||||||
if hblink_req['get_rules']: # == 'burn_list':
|
## if hblink_req['get_rules']: # == 'burn_list':
|
||||||
|
|
||||||
## try:
|
## try:
|
||||||
response = jsonify(
|
response = jsonify(
|
||||||
rules=generate_rules(hblink_req['get_rules']),
|
rules=generate_rules(hblink_req['server']),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
message = jsonify(message='Authentication error')
|
message = jsonify(message='Authentication error')
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<h1 style="text-align: center;">{{server}}/{{system}}</h1>
|
<h1 style="text-align: center;">{{server}}/{{system}}</h1>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<h4 style="text-align: center;">Updated every minute.</h4>
|
<h4 style="text-align: center;">Updated every 10 seconds.</h4>
|
||||||
|
|
||||||
|
|
||||||
<table data-toggle="table" data-pagination="true" data-search="true" >
|
<table data-toggle="table" data-pagination="true" data-search="true" >
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>TG</th>
|
<th>TG</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
|
<th>Options</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue