From 27b339c18568838cd356461717a1e157147332c8 Mon Sep 17 00:00:00 2001 From: Gamosoft Date: Sun, 18 Jan 2026 19:08:56 +0100 Subject: [PATCH] minor refactor, doc fixing --- backend/export.py | 19 ++----------------- documentation/API.md | 4 ++-- documentation/FEATURES.md | 5 +++-- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/backend/export.py b/backend/export.py index d924658..1ef7095 100644 --- a/backend/export.py +++ b/backend/export.py @@ -13,23 +13,8 @@ from pathlib import Path from typing import Optional, Tuple import mimetypes - -# Media type detection -MEDIA_EXTENSIONS = { - 'image': {'.jpg', '.jpeg', '.png', '.gif', '.webp'}, - 'audio': {'.mp3', '.wav', '.ogg', '.m4a'}, - 'video': {'.mp4', '.webm'}, - 'document': {'.pdf'} -} - - -def get_media_type(filename: str) -> Optional[str]: - """Determine media type based on file extension.""" - ext = Path(filename).suffix.lower() - for media_type, extensions in MEDIA_EXTENSIONS.items(): - if ext in extensions: - return media_type - return None +# Import shared media type definitions from utils to avoid duplication +from backend.utils import MEDIA_EXTENSIONS, get_media_type def get_media_as_base64(media_path: Path) -> Optional[Tuple[str, str]]: diff --git a/documentation/API.md b/documentation/API.md index 2c08106..a324c66 100644 --- a/documentation/API.md +++ b/documentation/API.md @@ -114,8 +114,8 @@ Upload a media file to the `_attachments` directory. Files are automatically org | Type | Formats | Max Size | |------|---------|----------| | Images | JPG, PNG, GIF, WebP | 10 MB | -| Audio | MP3, WAV, OGG | 50 MB | -| Video | MP4, WebM | 100 MB | +| Audio | MP3, WAV, OGG, M4A | 50 MB | +| Video | MP4, WebM, MOV, AVI | 100 MB | | Documents | PDF | 20 MB | **Response:** diff --git a/documentation/FEATURES.md b/documentation/FEATURES.md index 074fa1b..1209d35 100644 --- a/documentation/FEATURES.md +++ b/documentation/FEATURES.md @@ -19,10 +19,11 @@ - **Drag & drop upload** - Drop files from your file system directly into the editor - **Clipboard paste** - Paste images from clipboard with Ctrl+V - **Images** - JPG, PNG, GIF, WebP (max 10MB) -- **Audio** - MP3, WAV, OGG (max 50MB) -- **Video** - MP4, WebM (max 100MB) +- **Audio** - MP3, WAV, OGG, M4A (max 50MB) +- **Video** - MP4, WebM, MOV, AVI (max 100MB) - **Documents** - PDF (max 20MB) - **In-app viewing** - View all media types directly in the sidebar +- **Inline preview** - Audio/video players and PDF viewer embedded in notes ### Organization - **Folder hierarchy** - Organize notes in nested folders