diff --git a/config.py b/config.py index 958294b..41ce8db 100755 --- a/config.py +++ b/config.py @@ -174,6 +174,8 @@ def build_config(_config_file): 'AUTHORIZED_TOKENS_FILE': config.get(section, 'AUTHORIZED_TOKENS_FILE'), 'AUTHORIZED_USERS_FILE': config.get(section, 'AUTHORIZED_USERS_FILE'), 'ACCESS_SYSTEMS_FILE': config.get(section, 'ACCESS_SYSTEMS_FILE'), + 'USE_PUBLIC_APPS': config.getboolean(section, 'USE_PUBLIC_APPS'), + 'PUBLIC_APPS_LIST': config.get(section, 'PUBLIC_APPS_LIST'), 'MY_API_NAME': config.get(section, 'MY_API_NAME'), 'DASHBOARD_URL': config.get(section, 'DASHBOARD_URL'), 'SERVER_NAME': config.get(section, 'SERVER_NAME'), diff --git a/full_bridge-SAMPLE.cfg b/full_bridge-SAMPLE.cfg index 86cda00..4b8bac5 100644 --- a/full_bridge-SAMPLE.cfg +++ b/full_bridge-SAMPLE.cfg @@ -182,6 +182,8 @@ AUTHORIZED_USERS_FILE: /path/to/authorized_users.txt ACCESS_SYSTEMS_FILE: /path/to/access_systems.txt MY_API_NAME: ABC SERVER_NAME: Test HBLink Network +USE_PUBLIC_APPS: True +PUBLIC_APPS_LIST: https://raw.githubusercontent.com/kf7eel/hblink_sms_external_apps/main/public_systems.txt # The following options are used for the dashboard. The dashboard is optional. diff --git a/full_bridge.py b/full_bridge.py index 53876f6..319d137 100644 --- a/full_bridge.py +++ b/full_bridge.py @@ -308,6 +308,19 @@ def send_email(to_email, email_subject, email_message): smtp_server.sendmail(sender_address, to_email, message) smtp_server.close() +def generate_apps(): + global combined + local_acess_systems = ast.literal_eval(os.popen('cat ' + access_systems_file).read()) + public_systems_file = requests.get(CONFIG['GPS_DATA']['PUBLIC_APPS_LIST']) + public_apps = ast.literal_eval(public_systems_file.text) + combined = public_apps.items() + local_acess_systems.items() + print(type(public_apps)) + print(type(local_acess_systems)) + print() + print(combined) + #print(local_acess_systems.update(public_apps)) + return combined + # Thanks for this forum post for this - https://stackoverflow.com/questions/2579535/convert-dd-decimal-degrees-to-dms-degrees-minutes-seconds-in-python def decdeg2dms(dd): @@ -2397,4 +2410,5 @@ if __name__ == '__main__': #logger.info(UNIT_MAP) #global authorized_users, other_systems #from .scripts.dashboard.authorized_apps import authorized_users, other_systems + logger.info(generate_apps()) reactor.run()