chore: apply ruff formatting and fix whitespace issues

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-13 09:12:11 +00:00
parent 43bc58770d
commit b03ebab747
96 changed files with 991 additions and 993 deletions
+6 -6
View File
@@ -6,8 +6,8 @@ Successfully implemented a complete, production-ready browser extension for Docu
## Implementation Date
Feature branch: `copilot/add-browser-plugin-for-docuelevate`
Commits: 7 commits implementing the complete feature
Feature branch: `copilot/add-browser-plugin-for-docuelevate`
Commits: 7 commits implementing the complete feature
Status: ✅ **COMPLETE AND PRODUCTION-READY**
## Requirements Met
@@ -16,7 +16,7 @@ All requirements from the original issue have been fully satisfied:
### ✅ Functional Requirements
- [x] Capture file URLs from user's browser
- [x] Send URLs to DocuElevate API endpoint
- [x] Send URLs to DocuElevate API endpoint
- [x] Support for Chrome, Firefox, Edge, and Chromium-based browsers
- [x] Simple user interaction (one-click + context menu)
- [x] Display status/feedback in plugin UI (success, error)
@@ -362,7 +362,7 @@ The browser extension implementation is **complete and production-ready**. All r
---
**Implementation Team**: GitHub Copilot
**Review Status**: All code review feedback addressed
**Documentation Status**: Complete
**Implementation Team**: GitHub Copilot
**Review Status**: All code review feedback addressed
**Documentation Status**: Complete
**Production Readiness**: ✅ READY
+7 -7
View File
@@ -12,13 +12,13 @@ For Chrome / Edge / Chromium-based browsers:
2. Navigate to extensions page:
• Chrome: chrome://extensions/
• Edge: edge://extensions/
3. Enable "Developer mode" (toggle in top right)
4. Click "Load unpacked"
5. Select the browser-extension folder
6. Extension is now installed! 🎉
For Firefox:
@@ -34,10 +34,10 @@ For Firefox:
1. Click the DocuElevate icon in toolbar
2. Enter your server URL:
https://your-docuelevate-server.com
3. (Optional) Add session cookie if auth enabled:
session=your_session_value
4. Click "Save Configuration"
5. Ready to use! 🚀
@@ -95,7 +95,7 @@ Complete guides available:
Problem: Extension not appearing
→ Check developer mode is enabled
→ Reload the extension
Problem: Can't connect to server
→ Verify server URL is correct
→ Check server is running
+1 -1
View File
@@ -127,7 +127,7 @@ The extension can send any URL, but DocuElevate will only process supported file
**Cause**: The URL doesn't point to a supported file type.
**Solution**:
**Solution**:
- Verify the URL ends with a supported file extension
- Check that the Content-Type header is set correctly by the server
+2 -2
View File
@@ -41,7 +41,7 @@ When you first install the extension, you'll see the configuration screen:
└─────────────────────────────────────────┘
```
**Dimensions**: 400px wide, ~300px height
**Dimensions**: 400px wide, ~300px height
**Colors**: Green buttons (#4CAF50), clean white background
### Send File View (Main Interface)
@@ -180,7 +180,7 @@ After sending a file via context menu, a system notification appears:
└─────────────────────────────────────────┘
```
**Notification Type**: Browser native notification
**Notification Type**: Browser native notification
**Duration**: Auto-dismiss after 5-10 seconds
## Chrome Extensions Page
+16 -16
View File
@@ -19,20 +19,20 @@ const showConfigBtn = document.getElementById('show-config');
document.addEventListener('DOMContentLoaded', async () => {
// Load saved configuration
const config = await loadConfig();
if (config.serverUrl) {
serverUrlInput.value = config.serverUrl;
}
if (config.sessionCookie) {
sessionCookieInput.value = config.sessionCookie;
}
// Get current tab URL
const tabs = await chrome.tabs.query({ active: true, currentWindow: true });
const currentUrl = tabs[0]?.url || '';
currentUrlDisplay.textContent = currentUrl;
// Show appropriate section
if (config.serverUrl) {
showSendSection();
@@ -44,12 +44,12 @@ document.addEventListener('DOMContentLoaded', async () => {
// Save configuration
saveConfigBtn.addEventListener('click', async () => {
const serverUrl = serverUrlInput.value.trim();
if (!serverUrl) {
showStatus('Please enter a server URL', 'error');
return;
}
// Validate URL format
try {
new URL(serverUrl);
@@ -57,15 +57,15 @@ saveConfigBtn.addEventListener('click', async () => {
showStatus('Invalid server URL format', 'error');
return;
}
const config = {
serverUrl: serverUrl,
sessionCookie: sessionCookieInput.value.trim()
};
await saveConfig(config);
showStatus('Configuration saved successfully!', 'success');
setTimeout(() => {
showSendSection();
}, 1000);
@@ -76,39 +76,39 @@ sendFileBtn.addEventListener('click', async () => {
const config = await loadConfig();
const tabs = await chrome.tabs.query({ active: true, currentWindow: true });
const currentUrl = tabs[0]?.url || '';
if (!currentUrl) {
showStatus('No URL found in current tab', 'error');
return;
}
// Disable button and show loading
sendFileBtn.disabled = true;
sendFileBtn.classList.add('loading');
showStatus('Sending file to DocuElevate...', 'info');
try {
const payload = {
url: currentUrl,
filename: filenameInput.value.trim() || null
};
const headers = {
'Content-Type': 'application/json'
};
// Add session cookie if provided
if (config.sessionCookie) {
headers['Cookie'] = config.sessionCookie;
}
const response = await fetch(`${config.serverUrl}/api/process-url`, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload),
credentials: 'include'
});
if (response.ok) {
const result = await response.json();
showStatus(
+12 -12
View File
@@ -9,7 +9,7 @@ chrome.runtime.onInstalled.addListener((details) => {
} else if (details.reason === 'update') {
console.log('DocuElevate extension updated');
}
// Create context menu item
chrome.contextMenus.create({
id: 'send-to-docuelevate',
@@ -31,36 +31,36 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
// Handle sending URL to DocuElevate
async function handleSendUrl(data) {
const { url, filename, serverUrl, sessionCookie } = data;
if (!url || !serverUrl) {
throw new Error('URL and server URL are required');
}
const headers = {
'Content-Type': 'application/json'
};
if (sessionCookie) {
headers['Cookie'] = sessionCookie;
}
const payload = {
url: url,
filename: filename || null
};
const response = await fetch(`${serverUrl}/api/process-url`, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload),
credentials: 'include'
});
if (!response.ok) {
const errorData = await response.json().catch(() => ({ detail: 'Unknown error' }));
throw new Error(errorData.detail || `HTTP ${response.status}`);
}
return await response.json();
}
@@ -69,18 +69,18 @@ chrome.contextMenus.onClicked.addListener(async (info, tab) => {
if (info.menuItemId === 'send-to-docuelevate') {
// Get the URL to send (link URL or page URL)
const targetUrl = info.linkUrl || info.pageUrl;
// Load configuration
const config = await new Promise((resolve) => {
chrome.storage.sync.get(['serverUrl', 'sessionCookie'], resolve);
});
if (!config.serverUrl) {
// Open popup to configure
chrome.action.openPopup();
return;
}
// Send the URL
try {
const result = await handleSendUrl({
@@ -88,7 +88,7 @@ chrome.contextMenus.onClicked.addListener(async (info, tab) => {
serverUrl: config.serverUrl,
sessionCookie: config.sessionCookie
});
// Show success notification
chrome.notifications.create({
type: 'basic',
+1 -1
View File
@@ -24,7 +24,7 @@ function isDirectFileUrl(url) {
'.txt', '.csv', '.rtf', '.jpg', '.jpeg', '.png', '.gif',
'.bmp', '.tiff', '.webp', '.svg'
];
const urlLower = url.toLowerCase();
return fileExtensions.some(ext => urlLower.endsWith(ext));
}
+11 -11
View File
@@ -52,7 +52,7 @@
</head>
<body>
<h1>🧪 DocuElevate Browser Extension Test Page</h1>
<div class="instructions">
<h2>How to Test</h2>
<ol>
@@ -66,18 +66,18 @@
<div class="test-section">
<h2>📄 Sample Document Links</h2>
<p>These links point to sample documents that can be processed by DocuElevate:</p>
<a href="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
<a href="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
class="test-link" target="_blank">
📕 Sample PDF Document (dummy.pdf)
</a>
<a href="https://file-examples.com/storage/fe783c0bd90d0e9c119e536/2017/10/file-sample_150kB.pdf"
<a href="https://file-examples.com/storage/fe783c0bd90d0e9c119e536/2017/10/file-sample_150kB.pdf"
class="test-link" target="_blank">
📗 Example PDF File (file-sample_150kB.pdf)
</a>
<a href="https://www.learningcontainer.com/wp-content/uploads/2019/09/sample-pdf-file.pdf"
<a href="https://www.learningcontainer.com/wp-content/uploads/2019/09/sample-pdf-file.pdf"
class="test-link" target="_blank">
📘 Learning Container Sample PDF
</a>
@@ -86,13 +86,13 @@
<div class="test-section">
<h2>🖼️ Sample Image Links</h2>
<p>These links point to sample images that can be processed:</p>
<a href="https://via.placeholder.com/800x600.png"
<a href="https://via.placeholder.com/800x600.png"
class="test-link" target="_blank">
🖼️ Placeholder Image (PNG, 800x600)
</a>
<a href="https://via.placeholder.com/1024x768.jpg"
<a href="https://via.placeholder.com/1024x768.jpg"
class="test-link" target="_blank">
📷 Placeholder Image (JPG, 1024x768)
</a>