Files
ShieldAI/packages/extension/public/options.html
Michael Freno 35e9f7e812 Fix 4 P1 and 2 P2 code review findings for FRE-4576
P1 fixes:
- Fix import paths in background/index.ts (./ -> ../lib/)
- Fix Promise-in-string bug in api-client.ts authenticate()
- Add missing background/service_worker key to manifest
- Copy HTML to public/ so Vite places them in dist

P2 fixes:
- Add notifications permission to manifest
- Make showWarningNotification async with proper await

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-10 11:53:25 -04:00

190 lines
5.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ShieldAI Options</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
font-size: 14px;
color: #1f2937;
background: #f9fafb;
padding: 32px;
max-width: 640px;
margin: 0 auto;
}
h1 { font-size: 24px; margin-bottom: 4px; }
.subtitle { color: #6b7280; margin-bottom: 32px; }
.section {
background: white;
border-radius: 12px;
padding: 24px;
margin-bottom: 24px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.section-title {
font-size: 16px;
font-weight: 600;
margin-bottom: 16px;
padding-bottom: 8px;
border-bottom: 1px solid #e5e7eb;
}
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
label {
display: block;
font-size: 13px;
font-weight: 500;
margin-bottom: 6px;
color: #374151;
}
input[type="text"], input[type="password"], input[type="url"] {
width: 100%;
padding: 10px 12px;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 14px;
outline: none;
transition: border-color 0.2s;
}
input:focus { border-color: #3b82f6; }
.checkbox-group {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 0;
}
.checkbox-group input[type="checkbox"] {
width: 18px;
height: 18px;
accent-color: #3b82f6;
}
.checkbox-group label { margin-bottom: 0; cursor: pointer; }
.btn {
padding: 10px 20px;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: opacity 0.2s;
}
.btn:hover { opacity: 0.9; }
.btn-primary { background: #3b82f6; color: white; }
.btn-secondary { background: #f3f4f6; color: #374151; }
.btn-danger { background: #ef4444; color: white; }
.btn-group { display: flex; gap: 8px; margin-top: 16px; }
.domain-list {
list-style: none;
padding: 0;
}
.domain-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
background: #f9fafb;
border-radius: 6px;
margin-bottom: 4px;
}
.domain-remove {
background: none;
border: none;
color: #ef4444;
cursor: pointer;
font-size: 16px;
padding: 0 4px;
}
.add-domain-row {
display: flex;
gap: 8px;
margin-top: 8px;
}
.add-domain-row input { flex: 1; }
.toast {
position: fixed;
bottom: 24px;
right: 24px;
background: #10b981;
color: white;
padding: 12px 20px;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
opacity: 0;
transition: opacity 0.3s;
}
.toast.show { opacity: 1; }
</style>
</head>
<body>
<h1>🛡️ ShieldAI Options</h1>
<p class="subtitle">Configure your phishing & spam protection</p>
<div class="section">
<div class="section-title">Connection</div>
<div class="form-group">
<label for="api-url">API Base URL</label>
<input type="url" id="api-url" value="https://api.shieldai.com" placeholder="https://api.shieldai.com">
</div>
<div class="form-group">
<label for="auth-token">Auth Token (optional)</label>
<input type="password" id="auth-token" placeholder="Bearer token for ShieldAI account">
</div>
</div>
<div class="section">
<div class="section-title">Protection Settings</div>
<div class="checkbox-group">
<input type="checkbox" id="enabled" checked>
<label for="enabled">Enable protection</label>
</div>
<div class="checkbox-group">
<input type="checkbox" id="active-blocking">
<label for="active-blocking">Active blocking (Plus tier)</label>
</div>
<div class="checkbox-group">
<input type="checkbox" id="darkwatch-enabled">
<label for="darkwatch-enabled">DarkWatch credential exposure checks (Plus tier)</label>
</div>
<div class="checkbox-group">
<input type="checkbox" id="spam-enabled" checked>
<label for="spam-enabled">Spam protection</label>
</div>
<div class="checkbox-group">
<input type="checkbox" id="notifications" checked>
<label for="notifications">Show notifications</label>
</div>
</div>
<div class="section">
<div class="section-title">Blocked Domains</div>
<ul class="domain-list" id="blocked-domains"></ul>
<div class="add-domain-row">
<input type="text" id="new-blocked-domain" placeholder="example.com">
<button class="btn btn-secondary" id="add-blocked">Add</button>
</div>
</div>
<div class="section">
<div class="section-title">Allowed Domains (Whitelist)</div>
<ul class="domain-list" id="allowed-domains"></ul>
<div class="add-domain-row">
<input type="text" id="new-allowed-domain" placeholder="example.com">
<button class="btn btn-secondary" id="add-allowed">Add</button>
</div>
</div>
<div class="btn-group">
<button class="btn btn-primary" id="save-btn">Save Settings</button>
<button class="btn btn-secondary" id="reset-btn">Reset to Defaults</button>
</div>
<div class="toast" id="toast">Settings saved!</div>
<script src="options.js"></script>
</body>
</html>