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.
This commit is contained in:
claudi 2026-02-17 15:56:53 +01:00
parent c9704efc8d
commit 88dc358894
21 changed files with 1870 additions and 432 deletions

95
test_download.html Normal file
View file

@ -0,0 +1,95 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Download Test</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 40px;
background: #f5f5f5;
}
.test-section {
background: white;
padding: 30px;
margin: 20px 0;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
h2 {
color: #333;
margin-top: 0;
}
a {
display: inline-block;
padding: 10px 20px;
background: #007bff;
color: white;
text-decoration: none;
border-radius: 4px;
margin: 10px 10px 10px 0;
}
a:hover {
background: #0056b3;
}
button {
padding: 10px 20px;
background: #28a745;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
margin: 10px 10px 10px 0;
}
button:hover {
background: #218838;
}
</style>
</head>
<body>
<h1>🧪 Download Test Seite</h1>
<div class="test-section">
<h2>Test 1: Direct Download Link</h2>
<p>Download einer Text-Datei via direktem Link:</p>
<a href="data:text/plain;charset=utf-8,Das ist eine Test-Datei%0AMit mehreren Zeilen%0AZum Testen" download="test.txt">📥 Download test.txt</a>
</div>
<div class="test-section">
<h2>Test 2: JavaScript Download (Blob)</h2>
<p>Download via JavaScript Blob:</p>
<button onclick="downloadBlob()">📥 Download blob.txt</button>
</div>
<div class="test-section">
<h2>Test 3: Base64 Image Download</h2>
<p>Download eines kleinen Bildes:</p>
<a href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FABJADveWkH6oAAAAAElFTkSuQmCC" download="test.png">📥 Download test.png</a>
</div>
<div class="test-section">
<h2>Test 4: External Link (should open in browser)</h2>
<p>PDF von externem Server:</p>
<a href="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" target="_blank">📥 Download external PDF</a>
</div>
<script>
function downloadBlob() {
const content = 'Das ist eine Test-Datei\nErstellt via JavaScript Blob\n' + new Date().toISOString();
const blob = new Blob([content], { type: 'text/plain' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'blob_test.txt';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
console.log('Download via Blob initiated');
}
</script>
</body>
</html>