Render the about box.
()
| 57 | @blueprint.route("/", endpoint='index') |
| 58 | @pga_login_required |
| 59 | def index(): |
| 60 | """Render the about box.""" |
| 61 | info = {} |
| 62 | # Get OS , NW.js, Browser details |
| 63 | browser, os_details, electron_version = detect_browser(request) |
| 64 | admin = is_admin(current_user.email) |
| 65 | |
| 66 | if electron_version: |
| 67 | info['electron'] = electron_version |
| 68 | |
| 69 | if config.SERVER_MODE: |
| 70 | info['app_mode'] = gettext('Server') |
| 71 | else: |
| 72 | info['app_mode'] = gettext('Desktop') |
| 73 | |
| 74 | info['commit_hash'] = getattr(config, 'COMMIT_HASH', None) |
| 75 | info['browser_details'] = browser |
| 76 | info['version'] = config.APP_VERSION |
| 77 | info['admin'] = admin |
| 78 | info['current_user'] = current_user.email |
| 79 | info['python_version'] = sys.version.split(" ", maxsplit=1)[0] |
| 80 | |
| 81 | if admin: |
| 82 | settings = "" |
| 83 | info['os_details'] = os_details |
| 84 | info['log_file'] = config.LOG_FILE |
| 85 | |
| 86 | # If external datbase is used do not display SQLITE_PATH |
| 87 | if not config.CONFIG_DATABASE_URI: |
| 88 | info['config_db'] = config.SQLITE_PATH |
| 89 | |
| 90 | for setting in dir(config): |
| 91 | if not setting.startswith('_') and setting.isupper() and \ |
| 92 | setting not in ['CSRF_SESSION_KEY', |
| 93 | 'SECRET_KEY', |
| 94 | 'SECURITY_PASSWORD_SALT', |
| 95 | 'SECURITY_PASSWORD_HASH', |
| 96 | 'ALLOWED_HOSTS', |
| 97 | 'MAIL_PASSWORD', |
| 98 | 'LDAP_BIND_PASSWORD', |
| 99 | 'SECURITY_PASSWORD_HASH']: |
| 100 | if isinstance(getattr(config, setting), str): |
| 101 | settings = \ |
| 102 | settings + '{} = "{}"\n'.format( |
| 103 | setting, getattr(config, setting)) |
| 104 | else: |
| 105 | settings = \ |
| 106 | settings + '{} = {}\n'.format( |
| 107 | setting, getattr(config, setting)) |
| 108 | |
| 109 | info['settings'] = settings |
| 110 | |
| 111 | return make_json_response( |
| 112 | data=info, |
| 113 | status=200 |
| 114 | ) |
| 115 | |
| 116 |
nothing calls this directly
no test coverage detected