Aaron Elijah Mars 14be38dd16 safety mode
2025-07-15 17:43:08 +02:00

375 lines
9.0 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>OpenDia</title>
<style>
:root {
--primary-color: #2563eb;
--success-color: #22c55e;
--error-color: #ef4444;
--bg-color: #ffffff;
--text-color: #1f2937;
--border-color: #e5e7eb;
--hover-color: #1d4ed8;
}
body {
width: 380px;
padding: 20px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
color: var(--text-color);
background: linear-gradient(135deg, #0081F7 0%, #FF75CA 50%, #FFAE87 100%);
margin: 0;
min-height: 300px;
position: relative;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.92);
backdrop-filter: blur(20px);
z-index: 0;
}
body > * {
position: relative;
z-index: 1;
}
.header {
display: flex;
align-items: center;
margin-bottom: 20px;
}
.logo {
width: 32px;
height: 32px;
margin-right: 12px;
background: linear-gradient(135deg, #0081F7, #FF75CA);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: bold;
box-shadow: 0 2px 8px rgba(0, 129, 247, 0.3);
overflow: hidden;
position: relative;
}
.logo video {
width: 100%;
height: 100%;
object-fit: cover;
position: absolute;
top: 0;
left: 0;
border-radius: 50%;
}
.logo span {
position: relative;
z-index: 1;
}
h2 {
margin: 0;
font-size: 1.25rem;
font-weight: 600;
}
.status {
display: flex;
align-items: center;
margin-bottom: 20px;
padding: 12px;
background: rgba(255, 255, 255, 0.6);
border-radius: 10px;
border: 1px solid rgba(255, 255, 255, 0.8);
backdrop-filter: blur(20px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.status-indicator {
width: 10px;
height: 10px;
border-radius: 50%;
margin-right: 12px;
transition: background-color 0.3s ease;
}
.connected {
background-color: var(--success-color);
box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);
}
.disconnected {
background-color: var(--error-color);
box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}
.info {
background: rgba(255, 255, 255, 0.6);
padding: 16px;
border-radius: 10px;
margin-bottom: 16px;
border: 1px solid rgba(255, 255, 255, 0.8);
backdrop-filter: blur(20px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.info-row {
display: flex;
justify-content: space-between;
margin-bottom: 8px;
}
.info-row:last-child {
margin-bottom: 0;
}
.info-label {
color: #6b7280;
font-size: 0.875rem;
}
.info-value {
font-weight: 500;
}
.tooltip {
position: relative;
cursor: help;
text-decoration: underline;
text-decoration-style: dotted;
text-underline-offset: 2px;
text-decoration-color: #9ca3af;
}
.tooltip-content {
position: absolute;
bottom: 100%;
left: 0;
right: 0;
transform: translateY(-5px);
background: rgba(0, 0, 0, 0.9);
color: white;
padding: 8px 10px;
border-radius: 6px;
font-size: 0.65rem;
font-weight: normal;
white-space: pre-wrap;
width: 320px;
margin: 0 auto;
text-align: center;
line-height: 1.3;
opacity: 0;
visibility: hidden;
transition: opacity 0.2s, visibility 0.2s;
z-index: 1000;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
word-wrap: break-word;
}
.info-row .tooltip .tooltip-content {
left: -350px;
margin: 0;
}
.tooltip:hover .tooltip-content {
opacity: 1;
visibility: visible;
}
.button-group {
display: flex;
gap: 8px;
margin-bottom: 16px;
}
button {
background: rgba(255, 255, 255, 0.3);
color: #0081F7;
border: 1px solid rgba(0, 129, 247, 0.2);
padding: 10px 16px;
border-radius: 6px;
cursor: pointer;
font-weight: 600;
font-size: 0.875rem;
transition: all 0.3s ease;
flex: 1;
backdrop-filter: blur(10px);
position: relative;
overflow: hidden;
}
button::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 117, 202, 0.3), transparent);
transition: left 0.6s ease;
}
button:hover {
transform: translateY(-2px);
background: rgba(255, 255, 255, 0.5);
border-color: rgba(255, 117, 202, 0.4);
box-shadow: 0 6px 20px rgba(255, 117, 202, 0.2);
}
button:hover::before {
left: 100%;
}
button:active {
transform: translateY(0);
}
.safety-mode {
background: rgba(255, 255, 255, 0.6);
padding: 16px;
border-radius: 10px;
margin-bottom: 16px;
border: 1px solid rgba(255, 255, 255, 0.8);
backdrop-filter: blur(20px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.safety-row {
display: flex;
justify-content: space-between;
align-items: center;
}
.safety-label {
color: #374151;
font-weight: 600;
font-size: 0.875rem;
}
.safety-toggle {
position: relative;
display: inline-block;
width: 50px;
height: 24px;
}
.safety-toggle input {
opacity: 0;
width: 0;
height: 0;
}
.safety-slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #e5e7eb;
transition: 0.3s;
border-radius: 24px;
border: 1px solid rgba(0, 129, 247, 0.2);
}
.safety-slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 2px;
bottom: 2px;
background-color: white;
transition: 0.3s;
border-radius: 50%;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
input:checked + .safety-slider {
background: linear-gradient(135deg, #0081F7, #1d4ed8);
border-color: rgba(0, 129, 247, 0.4);
}
input:checked + .safety-slider:before {
transform: translateX(26px);
}
.safety-slider:hover {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
</style>
</head>
<body>
<div class="header">
<div class="logo">
<video autoplay loop muted playsinline>
<source src="logo.webm" type="video/webm">
<source src="logo.mp4" type="video/mp4">
<span>OD</span>
</video>
</div>
<h2>OpenDia</h2>
</div>
<div class="status">
<div class="status-indicator" id="statusIndicator"></div>
<span id="statusText" class="tooltip">
Checking connection...
<span class="tooltip-content">
Start server with: npx opendia
Auto-discovery will find the correct ports.
Existing processes are automatically terminated on startup
</span>
</span>
</div>
<div class="info">
<div class="info-row">
<span class="info-label">Server</span>
<span class="info-value" id="serverUrl">Auto-Discovery</span>
</div>
<div class="info-row">
<span class="info-label">Available Tools</span>
<span class="info-value" id="toolCount">Loading...</span>
</div>
<div class="info-row">
<span class="info-label">Current Page</span>
<span class="info-value" id="currentPage">Loading...</span>
</div>
</div>
<div class="safety-mode">
<div class="safety-row">
<span class="safety-label tooltip">
Safety Mode
<span class="tooltip-content">
When enabled, blocks write/edit tools: element_click, element_fill
</span>
</span>
<label class="safety-toggle">
<input type="checkbox" id="safetyMode">
<span class="safety-slider"></span>
</label>
</div>
</div>
<div class="button-group">
<button id="reconnectBtn">Reconnect</button>
</div>
<script src="popup.js"></script>
</body>
</html>