feat: smart video size warnings + Jinja2 template autocomplete
Video size warnings:
- Add file_size field to ImmichAssetInfo from exifInfo.fileSizeInByte
- Expose per-target max_video_size (50 MB for Telegram, none for others)
- Compute has_oversized_videos and per-asset oversized flag in template context
- Default templates show warning only when videos actually exceed the limit
- Templates no longer hardcode Telegram-specific logic
Template autocomplete:
- New jinja-autocomplete.ts engine with contextual completions
- Top-level variables ({{ }}), asset/album fields (dot access in loops),
Jinja2 filters (|), block tags ({% %}), and loop.* special vars
- JinjaEditor accepts optional variables prop via CodeMirror Compartment
- Wired into template-configs and command-template-configs pages
Also: fix template emoji (📷 → 📎) and sync sample_context with new vars.
This commit is contained in:
@@ -150,6 +150,9 @@ async def get_template_variables():
|
||||
"target_type": "Target type: 'telegram' or 'webhook'",
|
||||
"has_videos": "Whether added assets contain videos (boolean)",
|
||||
"has_photos": "Whether added assets contain photos (boolean)",
|
||||
"has_oversized_videos": "Whether any video exceeds the target's size limit (boolean)",
|
||||
"max_video_size": "Target video size limit in bytes (null if no limit)",
|
||||
"max_video_size_mb": "Target video size limit in MB (null if no limit)",
|
||||
# Immich aliases
|
||||
"album_name": "Alias for collection_name",
|
||||
"album_id": "Alias for collection_id",
|
||||
@@ -178,6 +181,8 @@ async def get_template_variables():
|
||||
"city": "City name",
|
||||
"state": "State/region name",
|
||||
"country": "Country name",
|
||||
"file_size": "File size in bytes (null if unknown)",
|
||||
"oversized": "Whether video exceeds the target's size limit (boolean, videos only)",
|
||||
"public_url": "Per-asset public share URL (empty if no album link)",
|
||||
"url": "Public viewer URL (if shared)",
|
||||
"download_url": "Direct download URL (if shared)",
|
||||
|
||||
Reference in New Issue
Block a user