first commit

This commit is contained in:
Chris Punches
2025-12-30 18:01:34 -05:00
commit 7065a2db2e
16 changed files with 2167 additions and 0 deletions

85
options/options.html Normal file
View File

@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CrowdProof Observe Settings</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
padding: 20px;
max-width: 500px;
margin: 0 auto;
}
h1 {
font-size: 1.5em;
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: 500;
}
input[type="url"] {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 14px;
box-sizing: border-box;
}
input[type="url"]:focus {
outline: none;
border-color: #0066cc;
}
.help-text {
font-size: 12px;
color: #666;
margin-top: 5px;
}
button {
margin-top: 15px;
padding: 10px 20px;
background: #0066cc;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
}
button:hover {
background: #0055aa;
}
.status {
margin-top: 10px;
padding: 10px;
border-radius: 4px;
display: none;
}
.status.success {
display: block;
background: #d4edda;
color: #155724;
}
.status.error {
display: block;
background: #f8d7da;
color: #721c24;
}
</style>
</head>
<body>
<h1>CrowdProof Observe Settings</h1>
<div>
<label for="serverUrl">Server URL</label>
<input type="url" id="serverUrl" placeholder="https://your-crowdproof-server.com">
<p class="help-text">Enter the full URL of your CrowdProof server (e.g., https://crowdproof.example.com)</p>
</div>
<button id="save">Save Settings</button>
<div id="status" class="status"></div>
<script src="options.js"></script>
</body>
</html>

42
options/options.js Normal file
View File

@@ -0,0 +1,42 @@
// Load saved settings on page load
document.addEventListener('DOMContentLoaded', async () => {
const result = await chrome.storage.local.get('serverUrl');
if (result.serverUrl) {
document.getElementById('serverUrl').value = result.serverUrl;
}
});
// Save settings
document.getElementById('save').addEventListener('click', async () => {
const serverUrl = document.getElementById('serverUrl').value.trim();
const statusEl = document.getElementById('status');
// Validate URL
if (!serverUrl) {
statusEl.textContent = 'Please enter a server URL';
statusEl.className = 'status error';
return;
}
try {
new URL(serverUrl);
} catch {
statusEl.textContent = 'Please enter a valid URL';
statusEl.className = 'status error';
return;
}
// Remove trailing slash for consistency
const normalizedUrl = serverUrl.replace(/\/+$/, '');
// Save to storage
await chrome.storage.local.set({ serverUrl: normalizedUrl });
statusEl.textContent = 'Settings saved!';
statusEl.className = 'status success';
// Hide status after 2 seconds
setTimeout(() => {
statusEl.className = 'status';
}, 2000);
});