webdrop-bridge/webapp/index.html
claudi 88dc358894 Refactor drag handling and update tests
- Renamed `initiate_drag` to `handle_drag` in MainWindow and updated related tests.
- Improved drag handling logic to utilize a bridge for starting file drags.
- Updated `_on_drag_started` and `_on_drag_failed` methods to match new signatures.
- Modified test cases to reflect changes in drag handling and assertions.

Enhance path validation and logging

- Updated `PathValidator` to log warnings for nonexistent roots instead of raising errors.
- Adjusted tests to verify the new behavior of skipping nonexistent roots.

Update web application UI and functionality

- Changed displayed text for drag items to reflect local paths and Azure Blob Storage URLs.
- Added debug logging for drag operations in the web application.
- Improved instructions for testing drag and drop functionality.

Add configuration documentation and example files

- Created `CONFIG_README.md` to provide detailed configuration instructions for WebDrop Bridge.
- Added `config.example.json` and `config_test.json` for reference and testing purposes.

Implement URL conversion logic

- Introduced `URLConverter` class to handle conversion of Azure Blob Storage URLs to local paths.
- Added unit tests for URL conversion to ensure correct functionality.

Develop download interceptor script

- Created `download_interceptor.js` to intercept download-related actions in the web application.
- Implemented logging for fetch calls, XMLHttpRequests, and Blob URL creations.

Add download test page and related tests

- Created `test_download.html` for testing various download scenarios.
- Implemented `test_download.py` to verify download path resolution and file construction.
- Added `test_url_mappings.py` to ensure URL mappings are loaded correctly.

Add unit tests for URL converter

- Created `test_url_converter.py` to validate URL conversion logic and mapping behavior.
2026-02-17 15:56:53 +01:00

247 lines
7.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WebDrop Bridge - Test Application</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20px;
}
.container {
background: white;
border-radius: 16px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
max-width: 500px;
width: 100%;
padding: 40px;
}
h1 {
color: #333;
margin-bottom: 10px;
font-size: 28px;
text-align: center;
}
.subtitle {
color: #666;
text-align: center;
margin-bottom: 40px;
font-size: 14px;
}
.drag-items {
display: flex;
flex-direction: column;
gap: 20px;
margin-bottom: 30px;
}
.drag-item {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
border-radius: 12px;
cursor: grab;
text-align: center;
transition: all 0.3s ease;
user-select: none;
-webkit-user-select: none;
}
.drag-item:hover {
transform: translateY(-4px);
box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}
.drag-item:active {
cursor: grabbing;
}
.drag-item h3 {
font-size: 18px;
margin-bottom: 8px;
}
.drag-item p {
font-size: 12px;
opacity: 0.9;
word-break: break-all;
font-family: "Courier New", monospace;
background: rgba(0, 0, 0, 0.2);
padding: 8px;
border-radius: 6px;
margin-top: 8px;
}
.status {
background: #f5f5f5;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 15px;
margin-bottom: 20px;
font-size: 13px;
}
.status h4 {
color: #333;
margin-bottom: 8px;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.status-message {
color: #666;
font-family: "Courier New", monospace;
font-size: 12px;
}
.status-message.success {
color: #4caf50;
}
.status-message.info {
color: #2196f3;
}
.instructions {
background: #e3f2fd;
border-left: 4px solid #2196f3;
padding: 15px;
border-radius: 4px;
font-size: 13px;
color: #1565c0;
line-height: 1.6;
}
.instructions li {
margin-left: 20px;
margin-bottom: 8px;
}
.footer {
text-align: center;
margin-top: 30px;
font-size: 12px;
color: #999;
}
.icon {
font-size: 32px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<div class="container">
<div class="icon">📦</div>
<h1>WebDrop Bridge</h1>
<p class="subtitle">Drag files from here to InDesign, Word, or other applications</p>
<div class="status">
<h4>Status</h4>
<div class="status-message info" id="statusMessage">Ready to test drag and drop</div>
</div>
<div class="drag-items">
<div class="drag-item" draggable="true" id="dragItem1">
<div class="icon">🖼️</div>
<h3>Local Z:\ Image</h3>
<p id="path1">Z:\data\test-image.jpg</p>
</div>
<div class="drag-item" draggable="true" id="dragItem2">
<div class="icon">📄</div>
<h3>Local Z:\ Document</h3>
<p id="path2">Z:\data\API_DOCUMENTATION.pdf</p>
</div>
<div class="drag-item" draggable="true" id="dragItem3">
<div class="icon">☁️</div>
<h3>Azure Blob Storage Image</h3>
<p id="path3">https://wpsagravitystg.file.core.windows.net/wpsagravitysync/aN5PysnXIuRECzcRbvHkjL7g0/Hintergrund_Agravity.png</p>
</div>
<div class="drag-item" draggable="true" id="dragItem4">
<div class="icon">☁️</div>
<h3>Azure Blob Storage Document</h3>
<p id="path4">https://wpsagravitystg.file.core.windows.net/wpsagravitysync/test/document.pdf</p>
</div>
</div>
<div class="instructions">
<h4>How to test:</h4>
<ol>
<li>Open InDesign, Word, or Notepad++</li>
<li>Drag one of the items above to the application</li>
<li>Local Z:\ paths and Azure URLs will be converted to file drags</li>
<li>Azure URLs will be mapped to Z:\ paths automatically</li>
<li>Check the browser console (F12) for debug info</li>
</ol>
<p><strong>Note:</strong> When dragging images from web apps like Agravity, the browser may not provide text/plain data. Press <kbd>ALT</kbd> while dragging to force text drag mode.</p>
</div>
<div class="footer">
<p>WebDrop Bridge v1.0.0 | Built with Qt and PySide6</p>
</div>
</div>
<script>
// Debug logging for drag operations
document.addEventListener('dragstart', function(e) {
var statusEl = document.getElementById('statusMessage');
// Log what's being dragged
var dt = e.dataTransfer;
var path = dt.getData('text/plain') || dt.getData('text/uri-list');
if (!path && e.target.tagName === 'IMG') {
path = e.target.src;
} else if (!path && e.target.tagName === 'A') {
path = e.target.href;
} else if (!path) {
var card = e.target.closest('.drag-item');
if (card) {
var pathEl = card.querySelector('p');
if (pathEl) path = pathEl.textContent.trim();
}
}
if (path) {
statusEl.className = 'status-message info';
statusEl.textContent = 'Dragging: ' + path;
console.log('[WebDrop] Drag started:', path);
}
}, false);
document.addEventListener('dragend', function(e) {
var statusEl = document.getElementById('statusMessage');
statusEl.className = 'status-message success';
statusEl.textContent = 'Drag completed!';
console.log('[WebDrop] Drag ended');
// Reset after 2 seconds
setTimeout(function() {
statusEl.className = 'status-message info';
statusEl.textContent = 'Ready to test drag and drop';
}, 2000);
}, false);
</script>
</body>
</html>