minor refactor, doc fixing

This commit is contained in:
Gamosoft 2026-01-18 19:08:56 +01:00
parent 37d7c0eba9
commit 27b339c185
3 changed files with 7 additions and 21 deletions

View File

@ -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]]:

View File

@ -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:**

View File

@ -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