Skip to content

Commit 2a812ad

Browse files
committed
browser firewall messaging
1 parent 61b6070 commit 2a812ad

File tree

3 files changed

+126
-10
lines changed

3 files changed

+126
-10
lines changed

html/browser-message.html

Lines changed: 124 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,138 @@
11
<div class="container-fluid">
22
<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 */
434
.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;
742
border: none;
843
}
44+
45+
/* Border colors */
946
.dark .border-info {
1047
border-color: #17a2b8 !important;
1148
}
49+
.dark .border-secondary {
50+
border-color: #6c757d !important;
51+
}
52+
1253
.dark .link-primary {
1354
color: #5c9eff !important;
1455
}
56+
57+
/* Status display control */
58+
#checkingStatus {
59+
display: block;
60+
}
61+
#statusResult {
62+
display: none;
63+
}
1564
</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>
1989
</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>
22138
</div>

main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ define(function (require, exports, module) {
5959
}
6060
}
6161

62-
Dialogs.showModalDialog(DefaultDialogs.DIALOG_ID_INFO, "Phoenix AI Control Status", html);
62+
Dialogs.showModalDialog(DefaultDialogs.DIALOG_ID_INFO, "Phoenix Code AI Control Status", html);
6363
}
6464

6565
// Register command for AI Control Status check

node/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ async function getAIControlStatus() {
103103
exists: true,
104104
isConfigured: true,
105105
isEnabled: false,
106-
message: `AI is disabled by system configuration.`,
106+
message: `AI is disabled by your system administrator.`,
107107
managedBy: config.managedByEmail || 'Not specified',
108108
allowedUsers: config.allowedUsers || [],
109109
currentUser: currentUser,

0 commit comments

Comments
 (0)