Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/plugins/image_url/image_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ def generate_image(self, settings, device_config):
logger.info(f"Fetching image from URL: {url}")
logger.debug(f"Target dimensions: {dimensions[0]}x{dimensions[1]}")

# Get timeout from settings, convert seconds to milliseconds
timeout_seconds = settings.get('timeout', 40)
timeout_ms = int(timeout_seconds * 1000)
logger.debug(f"Timeout: {timeout_seconds} seconds ({timeout_ms} ms)")

# Use adaptive image loader for memory-efficient processing
image = self.image_loader.from_url(url, dimensions, timeout_ms=40000)
image = self.image_loader.from_url(url, dimensions, timeout_ms=timeout_ms)

if not image:
logger.error("Failed to load image from URL")
Expand Down
9 changes: 8 additions & 1 deletion src/plugins/image_url/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
<input type="text" id="url" name="url" placeholder="Type something..." required class="form-input">
</div>

<div class="form-group">
<label for="timeout" class="form-label">Timeout (seconds):</label>
<input type="number" id="timeout" name="timeout" placeholder="40" min="1" class="form-input">
<small class="form-hint">Maximum time to wait for image download (default: 40 seconds)</small>
</div>

<div class="form-group">
<span style="color: var(--text-primary);">Warning: Do not run with untrusted URLs, as it may pose a security risk. This may also fail if the image takes too long to load.</span>
</div>
Expand All @@ -12,6 +18,7 @@
document.addEventListener('DOMContentLoaded', () => {
if (loadPluginSettings) {
document.getElementById('url').value = pluginSettings.url;
document.getElementById('timeout').value = pluginSettings.timeout || '';
}
});
</script>
</script>