cleanup
This commit is contained in:
parent
a20f703554
commit
d799339d93
7 changed files with 29 additions and 29 deletions
|
|
@ -18,10 +18,10 @@ Create a `config.json` file with the following structure:
|
|||
```json
|
||||
{
|
||||
"app_name": "WebDrop Bridge",
|
||||
"webapp_url": "https://wps.agravity.io/",
|
||||
"webapp_url": "https://dev.agravity.io/",
|
||||
"url_mappings": [
|
||||
{
|
||||
"url_prefix": "https://wpsagravitystg.file.core.windows.net/wpsagravitysync/",
|
||||
"url_prefix": "https://devagravitystg.file.core.windows.net/devagravitysync/",
|
||||
"local_path": "Z:"
|
||||
}
|
||||
],
|
||||
|
|
@ -45,7 +45,7 @@ Create a `config.json` file with the following structure:
|
|||
### Core Settings
|
||||
|
||||
- **`webapp_url`** (string): URL of the web application to load
|
||||
- Example: `"https://wps.agravity.io/"`
|
||||
- Example: `"https://dev.agravity.io/"`
|
||||
- Supports `http://`, `https://`, or `file:///` URLs
|
||||
|
||||
- **`url_mappings`** (array): Azure Blob Storage URL to local path mappings
|
||||
|
|
@ -55,7 +55,7 @@ Create a `config.json` file with the following structure:
|
|||
- Example:
|
||||
```json
|
||||
{
|
||||
"url_prefix": "https://wpsagravitystg.file.core.windows.net/wpsagravitysync/",
|
||||
"url_prefix": "https://dev.file.core.windows.net/devagravitysync/",
|
||||
"local_path": "Z:"
|
||||
}
|
||||
```
|
||||
|
|
@ -68,7 +68,7 @@ Create a `config.json` file with the following structure:
|
|||
|
||||
When the web application provides a drag URL like:
|
||||
```
|
||||
https://wpsagravitystg.file.core.windows.net/wpsagravitysync/aN5PysnXIuRECzcRbvHkjL7g0/Hintergrund_Agravity.png
|
||||
https://devagravitystg.file.core.windows.net/devagravitysync/aN5PysnXIuRECzcRbvHkjL7g0/Hintergrund_Agravity.png
|
||||
```
|
||||
|
||||
It will be converted to:
|
||||
|
|
@ -84,7 +84,7 @@ Z:\aN5PysnXIuRECzcRbvHkjL7g0\Hintergrund_Agravity.png
|
|||
|
||||
- **`allowed_urls`** (array): Allowed URL patterns for web content
|
||||
- Empty array = no restriction
|
||||
- Example: `["wps.agravity.io", "*.example.com"]`
|
||||
- Example: `["dev.agravity.io", "*.example.com"]`
|
||||
|
||||
### Update Settings
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ If no JSON config exists, WebDrop Bridge will load from `.env`:
|
|||
|
||||
```env
|
||||
APP_NAME=WebDrop Bridge
|
||||
WEBAPP_URL=https://wps.agravity.io/
|
||||
WEBAPP_URL=https://dev.agravity.io/
|
||||
ALLOWED_ROOTS=Z:/
|
||||
LOG_LEVEL=INFO
|
||||
WINDOW_WIDTH=1024
|
||||
|
|
@ -175,14 +175,14 @@ WINDOW_HEIGHT=768
|
|||
|
||||
## Example Configurations
|
||||
|
||||
### Production (Agravity WPS)
|
||||
### Production (Agravity DEV)
|
||||
|
||||
```json
|
||||
{
|
||||
"webapp_url": "https://wps.agravity.io/",
|
||||
"webapp_url": "https://dev.agravity.io/",
|
||||
"url_mappings": [
|
||||
{
|
||||
"url_prefix": "https://wpsagravitystg.file.core.windows.net/wpsagravitysync/",
|
||||
"url_prefix": "https://devagravitystg.file.core.windows.net/devagravitysync/",
|
||||
"local_path": "Z:"
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"app_name": "WebDrop Bridge",
|
||||
"webapp_url": "https://wps.agravity.io/",
|
||||
"webapp_url": "https://dev.agravity.io/",
|
||||
"url_mappings": [
|
||||
{
|
||||
"url_prefix": "https://wpsagravitystg.file.core.windows.net/wpsagravitysync/",
|
||||
"url_prefix": "https://devagravitystg.file.core.windows.net/devagravitysync/",
|
||||
"local_path": "Z:"
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class Config:
|
|||
log_file: Optional log file path
|
||||
allowed_roots: List of whitelisted root directories for file access
|
||||
allowed_urls: List of whitelisted URL domains/patterns (empty = no restriction)
|
||||
webapp_url: URL to load in embedded web application (default: https://wps.agravity.io/)
|
||||
webapp_url: URL to load in embedded web application (default: https://dev.agravity.io/)
|
||||
url_mappings: List of Azure URL to local path mappings
|
||||
check_file_exists: Whether to validate that files exist before drag
|
||||
auto_check_updates: Whether to automatically check for updates
|
||||
|
|
@ -139,7 +139,7 @@ class Config:
|
|||
log_file=log_file,
|
||||
allowed_roots=allowed_roots,
|
||||
allowed_urls=data.get("allowed_urls", []),
|
||||
webapp_url=data.get("webapp_url", "https://wps.agravity.io/"),
|
||||
webapp_url=data.get("webapp_url", "https://dev.agravity.io/"),
|
||||
url_mappings=mappings,
|
||||
check_file_exists=data.get("check_file_exists", True),
|
||||
auto_check_updates=data.get("auto_check_updates", True),
|
||||
|
|
@ -181,7 +181,7 @@ class Config:
|
|||
log_file_str = os.getenv("LOG_FILE", "logs/webdrop_bridge.log")
|
||||
allowed_roots_str = os.getenv("ALLOWED_ROOTS", "Z:/,C:/Users/Public")
|
||||
allowed_urls_str = os.getenv("ALLOWED_URLS", "")
|
||||
webapp_url = os.getenv("WEBAPP_URL", "https://wps.agravity.io/")
|
||||
webapp_url = os.getenv("WEBAPP_URL", "https://dev.agravity.io/")
|
||||
window_width = int(os.getenv("WINDOW_WIDTH", "1024"))
|
||||
window_height = int(os.getenv("WINDOW_HEIGHT", "768"))
|
||||
# Window title defaults to app_name + version if not specified
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class URLConverter:
|
|||
|
||||
Example:
|
||||
>>> converter.convert_url_to_path(
|
||||
... "https://wpsagravitystg.file.core.windows.net/wpsagravitysync/aN5PysnXIuRECzcRbvHkjL7g0/file.png"
|
||||
... "https://devagravitystg.file.core.windows.net/devagravitysync/aN5PysnXIuRECzcRbvHkjL7g0/file.png"
|
||||
... )
|
||||
Path("Z:/aN5PysnXIuRECzcRbvHkjL7g0/file.png")
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ def test_config(tmp_path):
|
|||
log_file=None,
|
||||
allowed_roots=[tmp_path],
|
||||
allowed_urls=[],
|
||||
webapp_url="https://wps.agravity.io/",
|
||||
webapp_url="https://dev.agravity.io/",
|
||||
url_mappings=[],
|
||||
check_file_exists=True,
|
||||
)
|
||||
|
|
@ -135,7 +135,7 @@ class TestDragInterceptorAzureURL:
|
|||
webapp_url="https://test.com/",
|
||||
url_mappings=[
|
||||
URLMapping(
|
||||
url_prefix="https://wpsagravitystg.file.core.windows.net/wpsagravitysync/",
|
||||
url_prefix="https://devagravitystg.file.core.windows.net/devagravitysync/",
|
||||
local_path=str(tmp_path)
|
||||
)
|
||||
],
|
||||
|
|
@ -144,7 +144,7 @@ class TestDragInterceptorAzureURL:
|
|||
interceptor = DragInterceptor(config)
|
||||
|
||||
# Azure URL
|
||||
azure_url = "https://wpsagravitystg.file.core.windows.net/wpsagravitysync/test.png"
|
||||
azure_url = "https://devagravitystg.file.core.windows.net/devagravitysync/test.png"
|
||||
|
||||
# Mock the drag operation
|
||||
with patch("webdrop_bridge.core.drag_interceptor.QDrag") as mock_drag:
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ def test_config():
|
|||
log_file=None,
|
||||
allowed_roots=[],
|
||||
allowed_urls=[],
|
||||
webapp_url="https://wps.agravity.io/",
|
||||
webapp_url="https://dev.agravity.io/",
|
||||
url_mappings=[
|
||||
URLMapping(
|
||||
url_prefix="https://wpsagravitystg.file.core.windows.net/wpsagravitysync/",
|
||||
url_prefix="https://devagravitystg.file.core.windows.net/devagravitysync/",
|
||||
local_path="Z:"
|
||||
),
|
||||
URLMapping(
|
||||
|
|
@ -40,7 +40,7 @@ def converter(test_config):
|
|||
|
||||
def test_convert_simple_url(converter):
|
||||
"""Test converting a simple Azure URL to local path."""
|
||||
url = "https://wpsagravitystg.file.core.windows.net/wpsagravitysync/test/file.png"
|
||||
url = "https://devagravitystg.file.core.windows.net/devagravitysync/test/file.png"
|
||||
result = converter.convert_url_to_path(url)
|
||||
|
||||
assert result is not None
|
||||
|
|
@ -49,7 +49,7 @@ def test_convert_simple_url(converter):
|
|||
|
||||
def test_convert_url_with_special_characters(converter):
|
||||
"""Test URL with special characters (URL encoded)."""
|
||||
url = "https://wpsagravitystg.file.core.windows.net/wpsagravitysync/folder/file%20with%20spaces.png"
|
||||
url = "https://devagravitystg.file.core.windows.net/devagravitysync/folder/file%20with%20spaces.png"
|
||||
result = converter.convert_url_to_path(url)
|
||||
|
||||
assert result is not None
|
||||
|
|
@ -58,7 +58,7 @@ def test_convert_url_with_special_characters(converter):
|
|||
|
||||
def test_convert_url_with_subdirectories(converter):
|
||||
"""Test URL with deep directory structure."""
|
||||
url = "https://wpsagravitystg.file.core.windows.net/wpsagravitysync/aN5PysnXIuRECzcRbvHkjL7g0/subfolder/file.png"
|
||||
url = "https://devagravitystg.file.core.windows.net/devagravitysync/aN5PysnXIuRECzcRbvHkjL7g0/subfolder/file.png"
|
||||
result = converter.convert_url_to_path(url)
|
||||
|
||||
assert result is not None
|
||||
|
|
@ -88,7 +88,7 @@ def test_convert_none_url(converter):
|
|||
|
||||
def test_is_azure_url_positive(converter):
|
||||
"""Test recognizing valid Azure URLs."""
|
||||
url = "https://wpsagravitystg.file.core.windows.net/wpsagravitysync/file.png"
|
||||
url = "https://devagravitystg.file.core.windows.net/devagravitysync/file.png"
|
||||
assert converter.is_azure_url(url) is True
|
||||
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ def test_is_azure_url_negative(converter):
|
|||
|
||||
def test_multiple_mappings(converter):
|
||||
"""Test that correct mapping is used for URL."""
|
||||
url1 = "https://wpsagravitystg.file.core.windows.net/wpsagravitysync/file.png"
|
||||
url1 = "https://devagravitystg.file.core.windows.net/devagravitysync/file.png"
|
||||
url2 = "https://other.blob.core.windows.net/container/file.png"
|
||||
|
||||
result1 = converter.convert_url_to_path(url1)
|
||||
|
|
@ -133,7 +133,7 @@ def test_url_mapping_adds_trailing_slash():
|
|||
|
||||
def test_convert_url_example_from_docs(converter):
|
||||
"""Test the exact example from documentation."""
|
||||
url = "https://wpsagravitystg.file.core.windows.net/wpsagravitysync/aN5PysnXIuRECzcRbvHkjL7g0/Hintergrund_Agravity.png"
|
||||
url = "https://devagravitystg.file.core.windows.net/devagravitysync/aN5PysnXIuRECzcRbvHkjL7g0/Hintergrund_Agravity.png"
|
||||
result = converter.convert_url_to_path(url)
|
||||
|
||||
assert result is not None
|
||||
|
|
|
|||
|
|
@ -175,13 +175,13 @@
|
|||
<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>
|
||||
<p id="path3">https://devagravitystg.file.core.windows.net/devagravitysync/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>
|
||||
<p id="path4">https://devagravitystg.file.core.windows.net/devagravitysync/test/document.pdf</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue