|
1 | 1 | <div class="container-fluid"> |
2 | 2 | <style> |
3 | | - /* Dark mode styling for browser message */ |
| 3 | + /* Status styles */ |
| 4 | + .alert.alert-success { |
| 5 | + text-shadow: none; |
| 6 | + background-color: #dff0d8; |
| 7 | + border: none; |
| 8 | + } |
| 9 | + .dark .alert.alert-success { |
| 10 | + text-shadow: none; |
| 11 | + background-color: #1e3a1e; /* Darker background for better contrast */ |
| 12 | + border: none; |
| 13 | + color: #ccc; /* Lighter text for better contrast */ |
| 14 | + } |
| 15 | + .dark .text-success { |
| 16 | + color: #4caf50 !important; /* Brighter green in dark mode */ |
| 17 | + } |
| 18 | + .dark .border-success { |
| 19 | + border-color: #4caf50 !important; /* Match the text color */ |
| 20 | + } |
| 21 | + |
| 22 | + .alert.alert-info { |
| 23 | + text-shadow: none; |
| 24 | + background-color: #d1ecf1; |
| 25 | + border: none; |
| 26 | + } |
| 27 | + .alert.alert-secondary { |
| 28 | + text-shadow: none; |
| 29 | + background-color: #e2e3e5; |
| 30 | + border: none; |
| 31 | + } |
| 32 | + |
| 33 | + /* Dark mode styling */ |
4 | 34 | .dark .alert.alert-info { |
5 | | - background-color: #1e3a3a; /* Darker teal background */ |
6 | | - color: #e2e2e2; /* Lighter text */ |
| 35 | + background-color: #1e3a3a; |
| 36 | + color: #ccc; |
| 37 | + border: none; |
| 38 | + } |
| 39 | + .dark .alert.alert-secondary { |
| 40 | + background-color: #2d3035; |
| 41 | + color: #ccc; |
7 | 42 | border: none; |
8 | 43 | } |
| 44 | + |
| 45 | + /* Border colors */ |
9 | 46 | .dark .border-info { |
10 | 47 | border-color: #17a2b8 !important; |
11 | 48 | } |
| 49 | + .dark .border-secondary { |
| 50 | + border-color: #6c757d !important; |
| 51 | + } |
| 52 | + |
12 | 53 | .dark .link-primary { |
13 | 54 | color: #5c9eff !important; |
14 | 55 | } |
| 56 | + |
| 57 | + /* Status display control */ |
| 58 | + #checkingStatus { |
| 59 | + display: block; |
| 60 | + } |
| 61 | + #statusResult { |
| 62 | + display: none; |
| 63 | + } |
15 | 64 | </style> |
16 | | - <div class="alert alert-info border-start border-info border-4 mb-4"> |
17 | | - <p class="fw-bold">Browser Version</p> |
18 | | - <p>Managed AI control is not yet supported in the browser version of Phoenix Code.</p> |
| 65 | + |
| 66 | + <div id="checkingStatus" class="alert alert-secondary border-start border-secondary border-4 mb-4"> |
| 67 | + <p class="fs-5 mb-2"><strong>AI Status:</strong> Checking if AI is disabled...</p> |
| 68 | + </div> |
| 69 | + |
| 70 | + <div id="statusResult"> |
| 71 | + <div id="aiStatusAlert" class="alert alert-info border-start border-info border-4 mb-4"> |
| 72 | + <p class="fs-5 mb-2"><strong>AI Status:</strong> <span id="statusMessage">Unknown</span></p> |
| 73 | + <p class="mb-0">To disable Phoenix Code AI in your campus, firewall <code>ai.phcode.dev</code>.</p> |
| 74 | + </div> |
| 75 | + |
| 76 | + </div> |
| 77 | + |
| 78 | + <div class="mt-4"> |
| 79 | + <h4 class="mb-3">Need to Restrict Phoenix Code AI at School or Work?</h4> |
| 80 | + <p> |
| 81 | + Visit |
| 82 | + <a href="https://docs.phcode.dev/docs/control-ai" target="_blank" class="link-primary">https://docs.phcode.dev/docs/control-ai</a> |
| 83 | + for documentation on how to: |
| 84 | + </p> |
| 85 | + <ul class="list-group list-group-flush mb-3"> |
| 86 | + <li class="list-group-item">Disable or manage Phoenix Code AI campus-wide with your IT management tools.</li> |
| 87 | + <li class="list-group-item">Allow specific users to access AI.</li> |
| 88 | + </ul> |
19 | 89 | </div> |
20 | | - <p>For more information on controlling AI in educational institutions, visit: |
21 | | - <a href="https://docs.phcode.dev/docs/control-ai" target="_blank" class="link-primary">https://docs.phcode.dev/docs/control-ai</a></p> |
| 90 | + |
| 91 | + <script> |
| 92 | + // Check if AI is reachable |
| 93 | + fetch('https://ai.phcode.dev/hello', { |
| 94 | + method: 'GET', |
| 95 | + cache: 'no-cache', |
| 96 | + mode: 'no-cors', |
| 97 | + timeout: 5000 |
| 98 | + }) |
| 99 | + .then(response => { |
| 100 | + document.getElementById('checkingStatus').style.display = 'none'; |
| 101 | + document.getElementById('statusResult').style.display = 'block'; |
| 102 | + |
| 103 | + // Show AI is available |
| 104 | + const statusAlert = document.getElementById('aiStatusAlert'); |
| 105 | + const statusMessage = document.getElementById('statusMessage'); |
| 106 | + |
| 107 | + statusAlert.classList.remove('alert-info'); |
| 108 | + statusAlert.classList.add('alert-success'); |
| 109 | + statusAlert.classList.remove('border-info'); |
| 110 | + statusAlert.classList.add('border-success'); |
| 111 | + |
| 112 | + statusMessage.classList.add('text-success'); |
| 113 | + statusMessage.innerHTML = '✓ Available'; |
| 114 | + |
| 115 | + // Keep original firewall instructions |
| 116 | + statusAlert.querySelector('p.mb-0').innerHTML = 'To disable Phoenix Code AI in your campus, firewall <code>ai.phcode.dev</code>.'; |
| 117 | + }) |
| 118 | + .catch(error => { |
| 119 | + document.getElementById('checkingStatus').style.display = 'none'; |
| 120 | + document.getElementById('statusResult').style.display = 'block'; |
| 121 | + |
| 122 | + // Show AI is blocked |
| 123 | + const statusAlert = document.getElementById('aiStatusAlert'); |
| 124 | + const statusMessage = document.getElementById('statusMessage'); |
| 125 | + |
| 126 | + statusAlert.classList.remove('alert-info'); |
| 127 | + statusAlert.classList.add('alert-danger'); |
| 128 | + statusAlert.classList.remove('border-info'); |
| 129 | + statusAlert.classList.add('border-danger'); |
| 130 | + |
| 131 | + statusMessage.classList.add('text-danger'); |
| 132 | + statusMessage.innerHTML = '✗ Blocked'; |
| 133 | + |
| 134 | + // Show blocked message |
| 135 | + statusAlert.querySelector('p.mb-0').innerHTML = 'The domain <code>ai.phcode.dev</code> is unreachable and appears to be blocked by firewall.'; |
| 136 | + }); |
| 137 | + </script> |
22 | 138 | </div> |
0 commit comments