diff --git a/web/app.py b/web/app.py index 0c3f328..eaf8dac 100644 --- a/web/app.py +++ b/web/app.py @@ -292,6 +292,7 @@ def create_app(): report_clients =db.Column(db.String(100), nullable=False, server_default='127.0.0.1') unit_time = db.Column(db.Integer(), primary_key=False, server_default='10080') notes = db.Column(db.String(100), nullable=False, server_default='') + dash_url = db.Column(db.String(100), nullable=True, server_default='https://hbnet.xyz') class MasterList(db.Model): __tablename__ = 'master_list' @@ -375,7 +376,7 @@ def create_app(): off = db.Column(db.String(100), nullable=False, server_default='') reset = db.Column(db.String(100), nullable=False, server_default='') server = db.Column(db.String(100), nullable=False, server_default='') - public_list = db.Column(db.Boolean(), nullable=False, server_default='0') +## public_list = db.Column(db.Boolean(), nullable=False, server_default='0') proxy = db.Column(db.Boolean(), nullable=False, server_default='0') class BridgeList(db.Model): @@ -640,6 +641,27 @@ def create_app(): @login_required def gen(): #print(str(gen_passphrase(3153591))) #(int(i[0]))) + sl = ServerList.query.all() + svr_content = '' + for i in sl: + svr_content = svr_content + ''' +
+
+Server: ''' + i.name + '''+ |
+
Available Talkgroups | +
Dashboard | +
+''' + tg_d.bridge_name + '''+ |
+
TG #: ''' + str(tg_d.tg) + ''' | +
''' + tg_d.description + ''' | +
''' + return render_template('flask_user_layout.html', markup_content = Markup(content)) + + @app.route('/talkgroups') +## @login_required + def tg_list(): + cbl = BridgeList.query.filter_by(public_list=True).all() + print(cbl) + content = ''' +
+
Note: Talkgroups listed here may not be available on all servers. See Passphrases for complete list of talkgroup availability per server.
+Name | +TG | +Description | +
''' + i.bridge_name + ''' | +''' + str(i.tg) + ''' | +''' + i.description + ''' | +
+
Server: ''' + svr.name + ''' - IP/Host: ''' + str(svr.ip) + ''' |
+|||||||||||||||||||||||||||||||||||||||||
''' + b.bridge_name + ''' | +''' + str(b.tg) + ''' | +''' + bl.description + ''' | +|||||||||||||||||||||||||||||||||||||||
''' + '''
''' + b.bridge_name + ''' |
+ ''' + str(b.tg) + ''' |
+ ''' + bl.description + ''' |
+''' + ''' |
''' + + return render_template('flask_user_layout.html', markup_content = Markup(content)) @app.route('/test') @@ -2011,7 +2162,7 @@ def create_app(): timeout = int(s.timeout) if s.proxy == True: p = ProxyList.query.filter_by(server=_name).filter_by(name=s.system_name).first() - print(p.external_port) +## print(p.external_port) n_systems = p.internal_stop_port - p.internal_start_port n_count = 0 while n_count < n_systems: @@ -2162,7 +2313,7 @@ def create_app(): # print(master_config_list) return master_config_list - def add_system_rule(_bridge_name, _system_name, _ts, _tg, _active, _timeout, _to_type, _on, _off, _reset, _server, _public_list): + def add_system_rule(_bridge_name, _system_name, _ts, _tg, _active, _timeout, _to_type, _on, _off, _reset, _server): proxy = ProxyList.query.filter_by(server=_server).filter_by(name=_system_name).first() is_proxy = False try: @@ -2182,13 +2333,12 @@ def create_app(): off = _off, reset = _reset, server = _server, - public_list = _public_list, proxy = is_proxy ) db.session.add(add_system) db.session.commit() - def edit_system_rule(_bridge_name, _system_name, _ts, _tg, _active, _timeout, _to_type, _on, _off, _reset, _server, _public_list): + def edit_system_rule(_bridge_name, _system_name, _ts, _tg, _active, _timeout, _to_type, _on, _off, _reset, _server): proxy = ProxyList.query.filter_by(server=_server).filter_by(name=_system_name).first() is_proxy = False try: @@ -2197,10 +2347,10 @@ def create_app(): except: pass r = BridgeRules.query.filter_by(system_name=_system_name).filter_by(bridge_name=_bridge_name).first() - print('---') - print(_system_name) - print(_bridge_name) - print(r) +## print('---') +## print(_system_name) +## print(_bridge_name) +## print(r) ## for i in r: ## print(i.name) ## add_system = BridgeRules( @@ -2215,7 +2365,7 @@ def create_app(): r.off = _off r.reset = _reset r.server = _server - r.public_list = _public_list + #r.public_list = _public_list r.proxy = is_proxy ## db.session.add(add_system) db.session.commit() @@ -2232,7 +2382,7 @@ def create_app(): db.session.commit() - def server_edit(_name, _secret, _ip, _port, _global_path, _global_ping_time, _global_max_missed, _global_use_acl, _global_reg_acl, _global_sub_acl, _global_tg1_acl, _global_tg2_acl, _ai_subscriber_file, _ai_try_download, _ai_path, _ai_peer_file, _ai_tgid_file, _ai_peer_url, _ai_subs_url, _ai_stale, _um_shorten_passphrase, _um_burn_file, _report_enable, _report_interval, _report_port, _report_clients, _unit_time, _notes): + def server_edit(_name, _secret, _ip, _port, _global_path, _global_ping_time, _global_max_missed, _global_use_acl, _global_reg_acl, _global_sub_acl, _global_tg1_acl, _global_tg2_acl, _ai_subscriber_file, _ai_try_download, _ai_path, _ai_peer_file, _ai_tgid_file, _ai_peer_url, _ai_subs_url, _ai_stale, _um_shorten_passphrase, _um_burn_file, _report_enable, _report_interval, _report_port, _report_clients, _unit_time, _notes, _dash_url): s = ServerList.query.filter_by(name=_name).first() # print(_name) if _secret == '': @@ -2269,6 +2419,7 @@ def create_app(): s.report_clients = _report_clients s.unit_time = int(_unit_time) s.notes = _notes + s.dash_url = _dash_url db.session.commit() def master_delete(_mode, _server, _name): @@ -2452,7 +2603,7 @@ def create_app(): db.session.commit() - def server_add(_name, _secret, _ip, _port, _global_path, _global_ping_time, _global_max_missed, _global_use_acl, _global_reg_acl, _global_sub_acl, _global_tg1_acl, _global_tg2_acl, _ai_subscriber_file, _ai_try_download, _ai_path, _ai_peer_file, _ai_tgid_file, _ai_peer_url, _ai_subs_url, _ai_stale, _um_shorten_passphrase, _um_burn_file, _report_enable, _report_interval, _report_port, _report_clients, _unit_time, _notes): + def server_add(_name, _secret, _ip, _port, _global_path, _global_ping_time, _global_max_missed, _global_use_acl, _global_reg_acl, _global_sub_acl, _global_tg1_acl, _global_tg2_acl, _ai_subscriber_file, _ai_try_download, _ai_path, _ai_peer_file, _ai_tgid_file, _ai_peer_url, _ai_subs_url, _ai_stale, _um_shorten_passphrase, _um_burn_file, _report_enable, _report_interval, _report_port, _report_clients, _unit_time, _notes, _dash_url): add_server = ServerList( name = _name, secret = hashlib.sha256(_secret.encode()).hexdigest(), @@ -2486,7 +2637,8 @@ def create_app(): report_port = _report_port, report_clients = _report_clients, unit_time = int(_unit_time), - notes = _notes + notes = _notes, + dash_url = _dash_url ) db.session.add(add_server) db.session.commit() @@ -2679,13 +2831,13 @@ def create_app(): Redirecting in 3 seconds. ''' else: - server_add(request.form.get('server_name'), request.form.get('server_secret'), request.form.get('server_ip'), _port, request.form.get('global_path'), _global_ping_time, _global_max_missed, _global_use_acl, request.form.get('reg_acl'), request.form.get('sub_acl'), request.form.get('global_ts1_acl'), request.form.get('global_ts2_acl'), request.form.get('sub_file'), _ai_try_download, request.form.get('aliases_path'), request.form.get('peer_file'), request.form.get('tgid_file'), request.form.get('peer_url'), request.form.get('sub_url'), _ai_stale, _um_shorten_passphrase, request.form.get('um_burn_file'), _report_enabled, _report_interval, _report_port, request.form.get('report_clients'), request.form.get('unit_time'), request.form.get('notes')) + server_add(request.form.get('server_name'), request.form.get('server_secret'), request.form.get('server_ip'), _port, request.form.get('global_path'), _global_ping_time, _global_max_missed, _global_use_acl, request.form.get('reg_acl'), request.form.get('sub_acl'), request.form.get('global_ts1_acl'), request.form.get('global_ts2_acl'), request.form.get('sub_file'), _ai_try_download, request.form.get('aliases_path'), request.form.get('peer_file'), request.form.get('tgid_file'), request.form.get('peer_url'), request.form.get('sub_url'), _ai_stale, _um_shorten_passphrase, request.form.get('um_burn_file'), _report_enabled, _report_interval, _report_port, request.form.get('report_clients'), request.form.get('unit_time'), request.form.get('notes'), request.form.get('dash_url')) content = '''Server saved.Redirecting in 3 seconds. ''' if request.args.get('save_mode') == 'edit': ## print(request.args.get('server')) - server_edit(request.args.get('server'), request.form.get('server_secret'), request.form.get('server_ip'), _port, request.form.get('global_path'), _global_ping_time, _global_max_missed, _global_use_acl, request.form.get('reg_acl'), request.form.get('sub_acl'), request.form.get('global_ts1_acl'), request.form.get('global_ts2_acl'), request.form.get('sub_file'), _ai_try_download, request.form.get('aliases_path'), request.form.get('peer_file'), request.form.get('tgid_file'), request.form.get('peer_url'), request.form.get('sub_url'), _ai_stale, _um_shorten_passphrase, request.form.get('um_burn_file'), _report_enabled, _report_interval, _report_port, request.form.get('report_clients'), request.form.get('unit_time'), request.form.get('notes')) + server_edit(request.args.get('server'), request.form.get('server_secret'), request.form.get('server_ip'), _port, request.form.get('global_path'), _global_ping_time, _global_max_missed, _global_use_acl, request.form.get('reg_acl'), request.form.get('sub_acl'), request.form.get('global_ts1_acl'), request.form.get('global_ts2_acl'), request.form.get('sub_file'), _ai_try_download, request.form.get('aliases_path'), request.form.get('peer_file'), request.form.get('tgid_file'), request.form.get('peer_url'), request.form.get('sub_url'), _ai_stale, _um_shorten_passphrase, request.form.get('um_burn_file'), _report_enabled, _report_interval, _report_port, request.form.get('report_clients'), request.form.get('unit_time'), request.form.get('notes'), request.form.get('dash_url')) content = '''Server changed.Redirecting in 3 seconds. ''' @@ -2716,6 +2868,10 @@ def create_app(): |
Dashboard URL: |
+ |
+ Host (IP/DNS, for listing on passphrase page): |
|
|
Dashboard URL: |
+ |
+ Host (IP/DNS): |
|
Bridge (talkgroup) rule saved.Redirecting in 3 seconds. ''' @@ -4736,11 +4896,11 @@ def create_app(): content = br_view elif request.args.get('edit_rule') == 'save' and request.args.get('bridge_edit'): - public_list = False +## public_list = False active = False if request.form.get('active_dropdown') == 'True': active = True - edit_system_rule(request.args.get('bridge_edit'), request.args.get('system'), request.form.get('ts_dropdown'), request.form.get('tgid'), active, request.form.get('timer_time'), request.form.get('type_dropdown'), request.form.get('on'), request.form.get('off'), request.form.get('reset'), request.args.get('server'), public_list) + edit_system_rule(request.args.get('bridge_edit'), request.args.get('system'), request.form.get('ts_dropdown'), request.form.get('tgid'), active, request.form.get('timer_time'), request.form.get('type_dropdown'), request.form.get('on'), request.form.get('off'), request.form.get('reset'), request.args.get('server')) content = '''System rule changed.Redirecting in 3 seconds. ''' diff --git a/web/templates/flask_user_layout.html b/web/templates/flask_user_layout.html index 21893ba..92b1598 100644 --- a/web/templates/flask_user_layout.html +++ b/web/templates/flask_user_layout.html @@ -34,11 +34,12 @@{{title}}-
|