()
| 7071 | window.setInterval(function(){ refreshJobs().catch(function(){}); }, 2500); |
| 7072 | window.setInterval(function(){ renderBatteryStatus(); }, 15000); |
| 7073 | } |
| 7074 | |
| 7075 | window.addEventListener('pageshow', function(){ setTimeout(hideLoading, 120); }); |
| 7076 | document.addEventListener('readystatechange', function(){ if (document.readyState === 'complete') setTimeout(hideLoading, 120); }); |
| 7077 | window.setTimeout(hideLoading, 10000); |
| 7078 | init(); |
| 7079 | </script> |
| 7080 | </body> |
| 7081 | </html> |
| 7082 | """ |
| 7083 | |
| 7084 | |
| 7085 | class Handler(BaseHTTPRequestHandler): |
| 7086 | server_version = 'DedSecOS/1.0' |
| 7087 | |
| 7088 | def log_message(self, format_string, *args): |
| 7089 | return |
| 7090 | |
| 7091 | def do_GET(self): |
| 7092 | try: |
| 7093 | parsed = urllib.parse.urlparse(self.path) |
| 7094 | route = parsed.path |
| 7095 | params = urllib.parse.parse_qs(parsed.query) |
| 7096 | if route == '/api/auth/status': |
| 7097 | cfg = load_global_config() |
| 7098 | send_json(self, 200, {'ok': True, 'enabled': is_auth_enabled(), 'authenticated': is_request_authenticated(self), 'totp_enabled': bool(cfg.get('totp_enabled')), 'security_questions': public_config(cfg).get('security_questions', []), 'profiles': cfg.get('user_profiles', []), 'config': public_config(cfg)}) |
| 7099 | return |
| 7100 | REQUEST_CONTEXT.username = current_request_username(self) |
| 7101 | if route != '/' and is_auth_enabled() and not is_request_authenticated(self): |
| 7102 | send_json(self, 401, {'ok': False, 'error': 'Authentication required.'}) |
| 7103 | return |
no test coverage detected