feat: Enhance Enterprise App Protection extension with monitoring and UI improvements
- Introduce error reporting and performance monitoring in background.js to track API calls and processing times. - Implement health check system to ensure the extension's operational status and log issues. - Add caching and encryption utilities in content.js for improved link analysis and data validation. - Refactor link analysis to process in batches, enhancing performance and user experience. - Update UI in domains_management.html and options.html for better usability and aesthetics, including responsive design and improved layout. - Enhance popup.html to display suspicious links with better styling and functionality. - Modify manifest.json to include new permissions and host access for Safe Browsing API.
This commit is contained in:
@@ -5,197 +5,361 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Enterprise App Protection - Domain Management</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f8f9fa;
|
||||
:root {
|
||||
--primary-color: #2563eb;
|
||||
--success-color: #059669;
|
||||
--danger-color: #dc2626;
|
||||
--warning-color: #d97706;
|
||||
--background-color: #f8fafc;
|
||||
--surface-color: #ffffff;
|
||||
--text-primary: #1e293b;
|
||||
--text-secondary: #64748b;
|
||||
--border-color: #e2e8f0;
|
||||
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
||||
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
|
||||
--radius-sm: 0.375rem;
|
||||
--radius-md: 0.5rem;
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 600px;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 18px;
|
||||
color: #555;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
margin-top: 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
font-size: 14px;
|
||||
height: 120px;
|
||||
resize: vertical;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
pre {
|
||||
background: #f4f4f4;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
font-size: 14px;
|
||||
overflow-x: auto;
|
||||
body {
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
background-color: var(--background-color);
|
||||
color: var(--text-primary);
|
||||
line-height: 1.5;
|
||||
min-height: 100vh;
|
||||
padding: 2rem 1rem;
|
||||
}
|
||||
|
||||
.button-container {
|
||||
.container {
|
||||
max-width: 1000px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
background: var(--surface-color);
|
||||
padding: 2rem;
|
||||
border-radius: var(--radius-md);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.875rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.description {
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.875rem;
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.management-section {
|
||||
margin-bottom: 2rem;
|
||||
padding: 1.5rem;
|
||||
background-color: var(--background-color);
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.domain-list {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.domain-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0.75rem;
|
||||
background-color: var(--surface-color);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: var(--radius-sm);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.domain-item:hover {
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
.domain-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.domain-name {
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.domain-type {
|
||||
font-size: 0.75rem;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: var(--radius-sm);
|
||||
background-color: var(--background-color);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.domain-actions {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
padding: 0.5rem 1rem;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
font-size: 16px;
|
||||
border-radius: 5px;
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s;
|
||||
transition: all 0.2s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #0056b3;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
/* Styled Popup */
|
||||
.popup {
|
||||
button:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.add-btn {
|
||||
background-color: var(--primary-color);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.remove-btn {
|
||||
background-color: var(--danger-color);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
background-color: var(--warning-color);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
width: 300px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.popup-content {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
.modal.active {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.popup button {
|
||||
background-color: #007bff;
|
||||
.modal-content {
|
||||
background-color: var(--surface-color);
|
||||
padding: 2rem;
|
||||
border-radius: var(--radius-md);
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
input, select {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-primary);
|
||||
background-color: var(--surface-color);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
input:focus, select:focus {
|
||||
outline: none;
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
|
||||
}
|
||||
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 1rem;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
background-color: var(--surface-color);
|
||||
color: var(--text-secondary);
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
background-color: var(--success-color);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 8px 16px;
|
||||
font-size: 14px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.popup button:hover {
|
||||
background-color: #0056b3;
|
||||
.search-bar {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
.search-input {
|
||||
width: 100%;
|
||||
padding: 0.75rem 1rem;
|
||||
padding-left: 2.5rem;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 0.875rem;
|
||||
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%2364748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="M21 21l-4.35-4.35"/></svg>');
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0.75rem center;
|
||||
background-size: 1rem;
|
||||
}
|
||||
|
||||
.status-message {
|
||||
text-align: center;
|
||||
padding: 1rem;
|
||||
margin-top: 1rem;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 0.875rem;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.visible {
|
||||
display: block;
|
||||
.status-message.success {
|
||||
background-color: #ecfdf5;
|
||||
color: var(--success-color);
|
||||
border: 1px solid #a7f3d0;
|
||||
}
|
||||
|
||||
/* Style the placeholder text to make it look distinct from user input */
|
||||
input::placeholder,
|
||||
textarea::placeholder {
|
||||
color: #aaa;
|
||||
/* Lighter gray color */
|
||||
font-style: italic;
|
||||
/* Makes it look like a hint */
|
||||
opacity: 1;
|
||||
/* Ensures it's fully visible */
|
||||
}
|
||||
|
||||
/* Ensure actual input text is clear */
|
||||
input,
|
||||
textarea {
|
||||
color: #333;
|
||||
/* Dark text for actual input */
|
||||
}
|
||||
|
||||
pre {
|
||||
background: #f4f4f4;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
font-size: 14px;
|
||||
overflow-x: auto;
|
||||
font-style: italic;
|
||||
color: #333;
|
||||
/* Make text italic */
|
||||
.status-message.error {
|
||||
background-color: #fef2f2;
|
||||
color: var(--danger-color);
|
||||
border: 1px solid #fecaca;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Enterprise App Protection - Domain Management</h1>
|
||||
|
||||
<!-- Restored Instructions -->
|
||||
<h3>✅ How to Use</h3>
|
||||
<ul>
|
||||
<li>✅ Enter <strong>one domain per line</strong> (no commas or spaces).</li>
|
||||
<li>✅ <strong>Do not include</strong> <code>https://</code> or <code>www.</code> (only enter the domain
|
||||
name).</li>
|
||||
<li>✅ You can add subdomains if needed (e.g., <code>sub.example.com</code>).</li>
|
||||
<li>✅ <strong>Trusted Domains:</strong> These sites will <u>not</u> be flagged as unsafe.</li>
|
||||
<li>✅ <strong>Blocked Domains:</strong> These sites will <u>always</u> be flagged, even if Google Safe
|
||||
Browsing does not detect them.</li>
|
||||
<li>🚨 <strong>Example Entries:</strong></li>
|
||||
</ul>
|
||||
<pre><em>
|
||||
example.com
|
||||
secure-site.org
|
||||
sub.example.com
|
||||
malicious-site.net
|
||||
</em></pre>
|
||||
|
||||
<h3>✅ Trusted Domains (Safe List)</h3>
|
||||
<textarea id="trusted" placeholder="Enter trusted domains here..."></textarea>
|
||||
|
||||
<h3>❌ Blocked Domains (Unsafe List)</h3>
|
||||
<textarea id="blocked" placeholder="Enter blocked domains here..."></textarea>
|
||||
|
||||
<div class="button-container">
|
||||
<button id="save">💾 Save Domains</button>
|
||||
<div class="header">
|
||||
<h1>Domain Management</h1>
|
||||
<p class="description">Manage trusted and blocked domains for enterprise application protection</p>
|
||||
</div>
|
||||
|
||||
<div class="management-section">
|
||||
<div class="section-header">
|
||||
<h2>🔒 Trusted Domains</h2>
|
||||
<button class="add-btn" id="addTrustedDomain">
|
||||
<span>➕</span>
|
||||
<span>Add Domain</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="search-bar">
|
||||
<input type="text" class="search-input" id="trustedSearch" placeholder="Search trusted domains...">
|
||||
</div>
|
||||
<div class="domain-list" id="trustedDomainsList">
|
||||
<!-- Trusted domains will be populated here -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="management-section">
|
||||
<div class="section-header">
|
||||
<h2>🚫 Blocked Domains</h2>
|
||||
<button class="add-btn" id="addBlockedDomain">
|
||||
<span>➕</span>
|
||||
<span>Add Domain</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="search-bar">
|
||||
<input type="text" class="search-input" id="blockedSearch" placeholder="Search blocked domains...">
|
||||
</div>
|
||||
<div class="domain-list" id="blockedDomainsList">
|
||||
<!-- Blocked domains will be populated here -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="statusMessage" class="status-message"></div>
|
||||
</div>
|
||||
|
||||
<!-- Styled Popup -->
|
||||
<div id="popupMessage" class="popup hidden">
|
||||
<div class="popup-content">
|
||||
<p id="popupText">Changes saved successfully!</p>
|
||||
<button id="popupClose">OK</button>
|
||||
<!-- Add/Edit Domain Modal -->
|
||||
<div class="modal" id="domainModal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title" id="modalTitle">Add Domain</h3>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="domainName">Domain Name</label>
|
||||
<input type="text" id="domainName" placeholder="Enter domain name (e.g., example.com)">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="domainType">Domain Type</label>
|
||||
<select id="domainType">
|
||||
<option value="trusted">Trusted</option>
|
||||
<option value="blocked">Blocked</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-actions">
|
||||
<button class="cancel-btn" id="cancelDomain">Cancel</button>
|
||||
<button class="save-btn" id="saveDomain">Save Domain</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user