retold-remote 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/docs/README.md +181 -0
  2. package/docs/_cover.md +14 -0
  3. package/docs/_sidebar.md +10 -0
  4. package/docs/_topbar.md +3 -0
  5. package/docs/audio-viewer.md +133 -0
  6. package/docs/ebook-reader.md +90 -0
  7. package/docs/image-viewer.md +90 -0
  8. package/docs/server-setup.md +262 -0
  9. package/docs/video-viewer.md +134 -0
  10. package/html/docs.html +59 -0
  11. package/package.json +21 -7
  12. package/source/Pict-Application-RetoldRemote.js +143 -2
  13. package/source/RetoldRemote-ExtensionMaps.js +33 -0
  14. package/source/cli/RetoldRemote-Server-Setup.js +82 -67
  15. package/source/cli/commands/RetoldRemote-Command-Serve.js +5 -26
  16. package/source/providers/Pict-Provider-CollectionManager.js +934 -0
  17. package/source/providers/Pict-Provider-FormattingUtilities.js +109 -0
  18. package/source/providers/Pict-Provider-GalleryFilterSort.js +2 -11
  19. package/source/providers/Pict-Provider-GalleryNavigation.js +270 -353
  20. package/source/providers/Pict-Provider-RetoldRemoteIcons.js +52 -0
  21. package/source/providers/Pict-Provider-ToastNotification.js +96 -0
  22. package/source/providers/keyboard-handlers/KeyHandler-AudioExplorer.js +88 -0
  23. package/source/providers/keyboard-handlers/KeyHandler-Gallery.js +190 -0
  24. package/source/providers/keyboard-handlers/KeyHandler-Sidebar.js +65 -0
  25. package/source/providers/keyboard-handlers/KeyHandler-VideoExplorer.js +57 -0
  26. package/source/providers/keyboard-handlers/KeyHandler-Viewer.js +197 -0
  27. package/source/server/RetoldRemote-ArchiveService.js +2 -12
  28. package/source/server/RetoldRemote-AudioWaveformService.js +7 -16
  29. package/source/server/RetoldRemote-CollectionService.js +684 -0
  30. package/source/server/RetoldRemote-EbookService.js +7 -16
  31. package/source/server/RetoldRemote-MediaService.js +3 -14
  32. package/source/server/RetoldRemote-ParimeCache.js +349 -0
  33. package/source/server/RetoldRemote-ThumbnailCache.js +52 -20
  34. package/source/server/RetoldRemote-VideoFrameService.js +7 -15
  35. package/source/views/PictView-Remote-AudioExplorer.js +10 -43
  36. package/source/views/PictView-Remote-CollectionsPanel.js +1087 -0
  37. package/source/views/PictView-Remote-Gallery.js +237 -44
  38. package/source/views/PictView-Remote-ImageViewer.js +1 -34
  39. package/source/views/PictView-Remote-Layout.js +410 -20
  40. package/source/views/PictView-Remote-MediaViewer.js +338 -51
  41. package/source/views/PictView-Remote-SettingsPanel.js +155 -138
  42. package/source/views/PictView-Remote-TopBar.js +615 -14
  43. package/source/views/PictView-Remote-VLCSetup.js +766 -0
  44. package/source/views/PictView-Remote-VideoExplorer.js +20 -54
  45. package/web-application/css/docuserve.css +73 -0
  46. package/web-application/docs/README.md +181 -0
  47. package/web-application/docs/_cover.md +14 -0
  48. package/web-application/docs/_sidebar.md +10 -0
  49. package/web-application/docs/_topbar.md +3 -0
  50. package/web-application/docs/audio-viewer.md +133 -0
  51. package/web-application/docs/ebook-reader.md +90 -0
  52. package/web-application/docs/image-viewer.md +90 -0
  53. package/web-application/docs/server-setup.md +262 -0
  54. package/web-application/docs/video-viewer.md +134 -0
  55. package/web-application/docs.html +59 -0
  56. package/web-application/js/pict-docuserve.min.js +58 -0
  57. package/web-application/js/pict.min.js +2 -2
  58. package/web-application/js/pict.min.js.map +1 -1
  59. package/web-application/retold-remote.js +2558 -439
  60. package/web-application/retold-remote.js.map +1 -1
  61. package/web-application/retold-remote.min.js +41 -11
  62. package/web-application/retold-remote.min.js.map +1 -1
  63. package/server.js +0 -43
package/docs/README.md ADDED
@@ -0,0 +1,181 @@
1
+ # Retold Remote
2
+
3
+ A browser-based media server and NAS file explorer. Point it at a folder and browse images, videos, audio, ebooks, code, and documents through a keyboard-driven gallery interface with 15 built-in themes.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ npx retold-remote serve /path/to/media
9
+ ```
10
+
11
+ Or with Docker:
12
+
13
+ ```bash
14
+ docker build -t retold-remote .
15
+ docker run -p 8086:8086 -v /path/to/media:/media retold-remote
16
+ ```
17
+
18
+ Then open `http://localhost:8086` in a browser.
19
+
20
+ ## Features
21
+
22
+ - **Gallery browser** with grid and list views, thumbnail generation, and lazy loading
23
+ - **Image viewer** with three fit modes, 0.25x-8x zoom, and EXIF orientation support
24
+ - **Video viewer** with action menu, in-browser playback, VLC streaming, and frame explorer
25
+ - **Audio viewer** with waveform visualization, selection-based playback, and segment extraction
26
+ - **eBook reader** for EPUB and MOBI with table of contents and page navigation
27
+ - **Code/text viewer** with syntax highlighting for 30+ languages
28
+ - **PDF viewer** via native browser rendering
29
+ - **Archive browsing** into zip, 7z, rar, tar.gz, cbz, and cbr files as virtual folders
30
+ - **Filtering and sorting** by media type, extension, file size, date, and text search (with regex)
31
+ - **15 themes** from greyscale to retro and cyberpunk
32
+ - **Full keyboard navigation** across every mode
33
+ - **Media type override** to force any file open as image, video, audio, or text (keys 1-4)
34
+ - **Hashed filenames** mode to hide real paths from the browser
35
+ - **VLC protocol handler** setup for macOS, Windows, and Linux
36
+ - **Settings persistence** via localStorage
37
+
38
+ ## Documentation
39
+
40
+ | Document | Contents |
41
+ |----------|----------|
42
+ | [Server Setup and Docker](server-setup.md) | Installation, CLI options, environment variables, configuration, Docker |
43
+ | [Image Viewer](image-viewer.md) | Fit modes, zoom, keyboard shortcuts, mouse interactions |
44
+ | [Video Viewer](video-viewer.md) | Action menu, playback, frame explorer, timeline, VLC streaming |
45
+ | [Audio Viewer](audio-viewer.md) | Waveform visualization, selection, zoom, segment playback |
46
+ | [eBook Reader](ebook-reader.md) | EPUB/MOBI support, table of contents, page navigation |
47
+
48
+ ## Keyboard Shortcuts (All Modes)
49
+
50
+ ### Global
51
+
52
+ | Key | Action |
53
+ |-----|--------|
54
+ | `F1` | Help panel |
55
+ | `F9` | Focus sidebar file list |
56
+ | `/` | Search / filter bar |
57
+ | `Esc` | Close overlay / go back |
58
+
59
+ ### Gallery
60
+
61
+ | Key | Action |
62
+ |-----|--------|
63
+ | Arrow keys | Navigate items |
64
+ | `Enter` | Open selected item |
65
+ | `1` `2` `3` `4` | Open as image / video / audio / text |
66
+ | `Esc` | Go up one folder |
67
+ | `Home` / `End` | Jump to first / last item |
68
+ | `g` | Toggle grid / list view |
69
+ | `f` | Advanced filter panel |
70
+ | `s` | Focus sort dropdown |
71
+ | `x` | Clear all filters |
72
+ | `c` | Settings panel |
73
+ | `d` | Distraction-free mode |
74
+
75
+ ### Media Viewer
76
+
77
+ | Key | Action |
78
+ |-----|--------|
79
+ | `Esc` | Back to gallery |
80
+ | Right / `j` | Next file |
81
+ | Left / `k` | Previous file |
82
+ | `1` `2` `3` `4` | View as image / video / audio / text |
83
+ | `Space` | Play / pause |
84
+ | `f` | Fullscreen |
85
+ | `i` | File info overlay |
86
+ | `v` | Stream with VLC |
87
+ | `+` / `-` | Zoom in / out |
88
+ | `0` | Reset zoom |
89
+ | `z` | Cycle fit mode |
90
+ | `d` | Distraction-free mode |
91
+
92
+ ### Video Action Menu
93
+
94
+ | Key | Action |
95
+ |-----|--------|
96
+ | `Space` / `Enter` | Play in browser |
97
+ | `e` | Explore video frames |
98
+ | `t` | Extract thumbnail |
99
+ | `v` | Stream with VLC |
100
+
101
+ ### Video Explorer
102
+
103
+ | Key | Action |
104
+ |-----|--------|
105
+ | `Esc` | Back to video |
106
+
107
+ ### Audio Explorer
108
+
109
+ | Key | Action |
110
+ |-----|--------|
111
+ | `Space` | Play selection |
112
+ | `+` / `-` | Zoom in / out |
113
+ | `0` | Zoom to fit |
114
+ | `z` | Zoom to selection |
115
+ | `Esc` | Clear selection / back |
116
+
117
+ ## Supported File Formats
118
+
119
+ ### Images
120
+ png, jpg, jpeg, gif, webp, svg, bmp, ico, avif, tiff, tif, heic, heif
121
+
122
+ ### Video
123
+ mp4, webm, mov, mkv, avi, wmv, flv, m4v, ogv, mpg, mpeg, mpe, mpv, m2v, ts, mts, m2ts, vob, 3gp, 3g2, f4v, rm, rmvb, divx, asf, mxf, dv, nsv, nuv, y4m, wtv, swf, dat
124
+
125
+ ### Audio
126
+ mp3, wav, ogg, flac, aac, m4a, wma, oga
127
+
128
+ ### Documents
129
+ pdf, epub, mobi
130
+
131
+ ### Archives
132
+ zip, 7z, rar, tar, tar.gz, tar.bz2, tar.xz, tgz, cbz, cbr
133
+
134
+ ### Code/Text
135
+ js, mjs, cjs, ts, tsx, jsx, py, rb, java, c, cpp, h, hpp, cs, go, rs, php, sh, bash, zsh, pl, r, swift, kt, scala, lua, json, xml, yaml, yml, toml, ini, cfg, conf, env, properties, md, markdown, txt, csv, tsv, log, html, htm, css, scss, sass, less, sql, graphql, gql, makefile, dockerfile, gitignore, editorconfig, htaccess, npmrc, eslintrc, prettierrc
136
+
137
+ ## Themes
138
+
139
+ **Grey** (pure greyscale): Daylight, Afternoon, Evening, Twilight (default), Night
140
+
141
+ **Fun** (colorful): Neo-Tokyo, Cyberpunk, Hotdog, 1970s Console, 1980s Console, 1990s Web Site, Early 2000s Web, Synthwave, Solarized Dark, Forest
142
+
143
+ ## Optional Server Tools
144
+
145
+ These external tools enhance functionality when available on the server:
146
+
147
+ | Tool | Feature |
148
+ |------|---------|
149
+ | **sharp** (npm) | Fast image thumbnail generation |
150
+ | **ImageMagick** | Fallback image thumbnails |
151
+ | **ffmpeg** | Video thumbnails, frame extraction, audio waveforms |
152
+ | **ffprobe** | Media metadata (duration, resolution, codec) |
153
+ | **7-Zip** (7z) | Archive browsing for rar, 7z, tar.* formats |
154
+ | **VLC** | External video streaming |
155
+ | **ebook-convert** (Calibre) | MOBI to EPUB conversion |
156
+
157
+ Without these tools the application still works -- images serve directly, videos play in-browser, and zip/cbz archives use native extraction.
158
+
159
+ ## API Endpoints
160
+
161
+ | Method | Endpoint | Description |
162
+ |--------|----------|-------------|
163
+ | GET | `/api/remote/settings` | Server configuration and capabilities |
164
+ | GET | `/api/filebrowser/list?path=` | Directory listing |
165
+ | PUT | `/api/filebrowser/settings` | Update browser settings (hidden files) |
166
+ | GET | `/api/media/capabilities` | Detected tool availability |
167
+ | GET | `/api/media/thumbnail?path=&width=&height=` | Generate/serve cached thumbnail |
168
+ | GET | `/api/media/probe?path=` | File metadata via ffprobe |
169
+ | GET | `/api/media/folder-summary?path=` | Media type counts for a folder |
170
+ | GET | `/api/media/video-frames?path=&count=` | Extract frames from video |
171
+ | GET | `/api/media/video-frame/:cacheKey/:filename` | Serve extracted frame |
172
+ | GET | `/api/media/video-frame-at?path=&timestamp=` | Extract frame at timestamp |
173
+ | GET | `/api/media/audio-waveform?path=&peaks=` | Audio waveform peak data |
174
+ | GET | `/api/media/audio-segment?path=&start=&end=` | Extract audio segment |
175
+ | GET | `/api/media/ebook-convert?path=` | Convert MOBI to EPUB |
176
+ | GET | `/api/media/ebook/:cacheKey/:filename` | Serve converted ebook |
177
+ | POST | `/api/media/open` | Open file in external player (VLC) |
178
+
179
+ ## License
180
+
181
+ MIT
package/docs/_cover.md ADDED
@@ -0,0 +1,14 @@
1
+ # Retold Remote <small>Documentation</small>
2
+
3
+ > A browser-based media server and NAS file explorer
4
+
5
+ Browse images, videos, audio, ebooks, code, and documents through a keyboard-driven gallery interface with 15 built-in themes. Point it at a folder and start exploring.
6
+
7
+ - **Gallery Browser** — Grid and list views with thumbnails, filtering, sorting, and text search
8
+ - **Media Viewers** — Dedicated viewers for images, video, audio, ebooks, code, and PDFs
9
+ - **Video Explorer** — Extract and browse frames from any video with a visual timeline
10
+ - **Audio Explorer** — Waveform visualization with selection, zoom, and segment playback
11
+ - **Full Keyboard Navigation** — Every feature accessible from the keyboard
12
+
13
+ [Get Started](server-setup.md)
14
+ [View on GitHub](https://github.com/stevenvelozo/retold-remote)
@@ -0,0 +1,10 @@
1
+ - [Home](/)
2
+
3
+ - Getting Started
4
+ - [Server Setup & Docker](server-setup.md)
5
+
6
+ - Media Viewers
7
+ - [Image Viewer](image-viewer.md)
8
+ - [Video Viewer & Explorer](video-viewer.md)
9
+ - [Audio Viewer & Explorer](audio-viewer.md)
10
+ - [eBook Reader](ebook-reader.md)
@@ -0,0 +1,3 @@
1
+ # Retold Remote <small>docs</small>
2
+
3
+ - [Back to App](/)
@@ -0,0 +1,133 @@
1
+ # Audio Viewer and Explorer
2
+
3
+ The audio viewer provides HTML5 audio playback with an optional waveform explorer for visualizing, selecting, and extracting audio segments.
4
+
5
+ ## Opening an Audio File
6
+
7
+ - **From the gallery**: select an audio file and press `Enter`, or double-click it
8
+ - **Force any file as audio**: press `3` in the gallery or viewer to open it in the audio viewer regardless of extension
9
+
10
+ ## Audio Player
11
+
12
+ The viewer shows a centered audio player with the filename and native HTML5 audio controls (play/pause, seek bar, volume, playback speed).
13
+
14
+ Below the player, action buttons appear:
15
+
16
+ | Button | Requires | Description |
17
+ |--------|----------|-------------|
18
+ | **Explore Audio** | ffprobe or ffmpeg | Opens the waveform explorer |
19
+ | **Stream with VLC** | -- | Sends the file to VLC on the server |
20
+
21
+ ### Autoplay
22
+
23
+ Autoplay is off by default. Enable it in Settings > Gallery > Autoplay audio. When enabled, audio begins playing as soon as the player loads.
24
+
25
+ ## Audio Explorer
26
+
27
+ The audio explorer displays a canvas-based waveform visualization with selection, zoom, and segment extraction.
28
+
29
+ ### Opening the Explorer
30
+
31
+ - From the audio player, click "Explore Audio"
32
+ - The explorer fetches 2000 peak samples from the server via ffmpeg
33
+
34
+ ### Waveform Display
35
+
36
+ The main canvas shows the audio waveform as vertical bars. The height of each bar represents the amplitude at that point. A dashed center line marks the zero crossing.
37
+
38
+ - **Unselected regions** are drawn in the secondary text color
39
+ - **Selected regions** are drawn in the accent color with a semi-transparent highlight behind them
40
+ - A **cursor line** follows the mouse position, displayed in white
41
+
42
+ ### Overview Bar
43
+
44
+ Below the main waveform, a smaller overview canvas shows the entire audio file. A highlighted viewport indicator box shows which portion of the waveform is currently visible in the main canvas.
45
+
46
+ Click anywhere on the overview to pan the main view to that position.
47
+
48
+ ### Selection
49
+
50
+ **Click and drag** on the main waveform to select a time range. The selection is highlighted in the accent color with edge markers.
51
+
52
+ - If the selection is too small (less than 0.1% of the total duration), it is automatically cleared
53
+ - The selection is shown in both the main canvas and the overview
54
+
55
+ ### Time Display Bar
56
+
57
+ A bar above the waveform shows three pieces of information:
58
+
59
+ - **View**: the time range currently visible (e.g., "0:12.3 - 0:45.7")
60
+ - **Selection**: the selected time range and its duration (e.g., "0:20.0 - 0:30.5 (10.5s)"), or "None"
61
+ - **Cursor**: the time position under the mouse, or "--"
62
+
63
+ Timestamps are formatted as `M:SS.D` (minutes, seconds, tenths of a second) or `H:MM:SS.D` for long files.
64
+
65
+ ### Zoom Controls
66
+
67
+ | Key / Button | Action |
68
+ |--------------|--------|
69
+ | `+` or `=` | Zoom in (centered) |
70
+ | `-` | Zoom out (centered) |
71
+ | `0` | Zoom to fit (show entire file) |
72
+ | `z` | Zoom to selection (with 5% margin) |
73
+ | Mouse wheel | Zoom at cursor position |
74
+
75
+ Minimum zoom level is 0.5% of the total duration.
76
+
77
+ Zooming preserves the center point -- the portion of the waveform under the mouse (for wheel zoom) or the center (for keyboard zoom) stays in place while the view range narrows or widens.
78
+
79
+ ### Playing a Selection
80
+
81
+ With a selection active, press `Space` or click the Play Selection button to extract and play that audio segment.
82
+
83
+ The server extracts the segment via ffmpeg and returns it as an MP3 file. A playback bar appears with an HTML5 audio player for the extracted segment.
84
+
85
+ The extraction endpoint is `/api/media/audio-segment` with `start` and `end` parameters in seconds.
86
+
87
+ ### Info Bar
88
+
89
+ The explorer shows an info bar with metadata from ffprobe:
90
+
91
+ | Field | Example |
92
+ |-------|---------|
93
+ | Duration | 3:42 |
94
+ | Sample Rate | 44.1 kHz |
95
+ | Channels | 2 (stereo) |
96
+ | Codec | mp3 |
97
+ | Bitrate | 320 kbps |
98
+ | File Size | 8.7 MB |
99
+ | Peaks | 2000 (ffmpeg) |
100
+
101
+ ### Keyboard Shortcuts
102
+
103
+ | Key | Action |
104
+ |-----|--------|
105
+ | `Space` | Play selection |
106
+ | `+` / `=` | Zoom in |
107
+ | `-` | Zoom out |
108
+ | `0` | Zoom to fit |
109
+ | `z` | Zoom to selection |
110
+ | `Esc` | Clear selection (if any), or go back to audio player |
111
+
112
+ ### Mouse Interactions
113
+
114
+ | Action | Effect |
115
+ |--------|--------|
116
+ | Click and drag on main waveform | Create/adjust selection |
117
+ | Mouse move on main waveform | Show cursor position in time bar |
118
+ | Mouse wheel on main waveform | Zoom in/out at cursor position |
119
+ | Click on overview bar | Pan main view to that position |
120
+
121
+ ## File Info Overlay
122
+
123
+ Press `i` while viewing audio to see metadata:
124
+
125
+ - Size, Duration, Codec, Bitrate, Format, Modified date, Path
126
+
127
+ ## Supported Formats
128
+
129
+ mp3, wav, ogg, flac, aac, m4a, wma, oga
130
+
131
+ Browser playback support varies. Most browsers play mp3, wav, ogg, and flac natively. For other formats, use VLC streaming.
132
+
133
+ Force any file as audio by pressing `3` in the gallery or viewer.
@@ -0,0 +1,90 @@
1
+ # eBook Reader
2
+
3
+ The eBook reader displays EPUB files directly in the browser using epub.js, with support for MOBI files through server-side conversion.
4
+
5
+ ## Opening an eBook
6
+
7
+ - **From the gallery**: select an `.epub` or `.mobi` file and press `Enter`, or double-click it
8
+ - eBooks are detected by the document type system (pdf, epub, mobi are all in the document category)
9
+
10
+ ## EPUB Files
11
+
12
+ EPUB files are loaded and rendered directly in the browser using the epub.js library. No server-side processing is required.
13
+
14
+ ### Reading Interface
15
+
16
+ The reader takes up the full viewer area and displays one page at a time in a single-column layout (no spread/two-page mode). Text is styled to match the active theme:
17
+
18
+ - Body text uses the theme's primary text color
19
+ - Background matches the theme's primary background
20
+ - Links use the theme's accent color
21
+ - Font: Georgia, Times New Roman, serif
22
+ - Line height: 1.6
23
+ - Padding: 20px horizontal, 40px vertical
24
+
25
+ ### Table of Contents
26
+
27
+ A sidebar on the left shows the book's table of contents. Each chapter is a clickable button. Subchapters are indented up to two levels.
28
+
29
+ | Action | Effect |
30
+ |--------|--------|
31
+ | Click a chapter | Jump to that chapter |
32
+ | Click "TOC" button | Toggle the sidebar open/closed |
33
+
34
+ The TOC sidebar starts collapsed and can be toggled with the TOC button in the controls bar.
35
+
36
+ ### Page Navigation
37
+
38
+ Controls at the bottom of the reader:
39
+
40
+ | Button | Action |
41
+ |--------|--------|
42
+ | **TOC** | Toggle table of contents sidebar |
43
+ | **Prev** | Go to previous page |
44
+ | **Next** | Go to next page |
45
+
46
+ Page navigation moves through the reflowed content. Pages are determined by the viewport size, not by the original book pagination.
47
+
48
+ ## MOBI Files
49
+
50
+ MOBI files (and AZW format) require server-side conversion to EPUB before they can be displayed. This requires **ebook-convert** from Calibre to be installed on the server.
51
+
52
+ ### Conversion Flow
53
+
54
+ 1. The client requests conversion via `/api/media/ebook-convert?path=<file>`
55
+ 2. The server runs `ebook-convert` to produce an EPUB file
56
+ 3. The converted EPUB is cached on disk
57
+ 4. The client fetches the EPUB from `/api/media/ebook/<cacheKey>/<filename>`
58
+ 5. The EPUB is rendered using the same epub.js reader
59
+
60
+ If ebook-convert is not available, MOBI files show a message explaining that conversion is needed and linking to the Calibre download page.
61
+
62
+ ### Installing Calibre (for MOBI support)
63
+
64
+ **macOS:**
65
+ ```bash
66
+ brew install calibre
67
+ ```
68
+
69
+ **Ubuntu/Debian:**
70
+ ```bash
71
+ sudo apt-get install calibre
72
+ ```
73
+
74
+ **Docker:**
75
+ The provided Dockerfile includes Calibre. If using the minimal Dockerfile, add:
76
+ ```dockerfile
77
+ RUN apt-get update && apt-get install -y calibre && rm -rf /var/lib/apt/lists/*
78
+ ```
79
+
80
+ ## PDF Files
81
+
82
+ PDF files are rendered using the browser's native PDF viewer in an iframe. No additional tools or libraries are required. The browser provides its own controls for page navigation, zoom, and search.
83
+
84
+ ## Limitations
85
+
86
+ - MOBI conversion requires Calibre's `ebook-convert` on the server
87
+ - DRM-protected ebooks cannot be read
88
+ - Complex EPUB layouts (fixed-layout EPUBs, heavy CSS) may not render perfectly
89
+ - The reader uses single-page mode only (no two-page spreads)
90
+ - Page numbers shown in the UI correspond to the reflowed content, not the original book pagination
@@ -0,0 +1,90 @@
1
+ # Image Viewer
2
+
3
+ The image viewer displays image files with three fit modes, manual zoom, and EXIF orientation support.
4
+
5
+ ## Opening an Image
6
+
7
+ - **From the gallery**: select a file and press `Enter`, or double-click a tile
8
+ - **Force any file as image**: press `1` in the gallery or viewer to open it in the image viewer regardless of extension
9
+
10
+ ## Fit Modes
11
+
12
+ Cycle through fit modes by pressing `z`.
13
+
14
+ ### Fit to Window
15
+
16
+ Scales the image to fill the viewport while preserving aspect ratio (CSS `object-fit: contain` behavior). The image is never larger than the viewport.
17
+
18
+ ### Original if Smaller (default)
19
+
20
+ Displays the image at its native resolution if it fits within the viewport. If the image is larger than the viewport, it scales down using the same logic as Fit to Window. This avoids upscaling small images.
21
+
22
+ ### Original Size
23
+
24
+ Always displays at native resolution regardless of viewport size. Large images will overflow and can be scrolled.
25
+
26
+ When the fit mode changes, a brief overlay indicator appears for 1.2 seconds showing the active mode name.
27
+
28
+ ## Zoom
29
+
30
+ | Key | Action | Range |
31
+ |-----|--------|-------|
32
+ | `+` or `=` | Zoom in | Up to 8x |
33
+ | `-` | Zoom out | Down to 0.25x |
34
+ | `0` | Reset zoom to 1x | |
35
+ | Click on image | Toggle between 1x and 2x | |
36
+
37
+ Each zoom step multiplies or divides by 1.25. The zoom level applies on top of the current fit mode calculation.
38
+
39
+ When zoomed beyond the viewport, the cursor changes to a zoom-out icon and the image can be scrolled. When the image fits, the cursor shows zoom-in.
40
+
41
+ ## Mouse Interactions
42
+
43
+ - **Click** on the image toggles between 1x and 2x zoom
44
+ - **Scroll** when zoomed to pan the image
45
+
46
+ ## Keyboard Shortcuts
47
+
48
+ These work while viewing any image:
49
+
50
+ | Key | Action |
51
+ |-----|--------|
52
+ | `z` | Cycle fit mode (Fit to Window -> Original if Smaller -> Original Size) |
53
+ | `+` / `=` | Zoom in |
54
+ | `-` | Zoom out |
55
+ | `0` | Reset zoom |
56
+ | `f` | Toggle fullscreen |
57
+ | `i` | Toggle file info overlay |
58
+ | Right / `j` | Next file |
59
+ | Left / `k` | Previous file |
60
+ | `v` | Stream with VLC |
61
+ | `d` | Distraction-free mode |
62
+ | `Esc` | Back to gallery |
63
+
64
+ ## File Info Overlay
65
+
66
+ Press `i` to show metadata about the current image:
67
+
68
+ - **Size**: file size in KB/MB
69
+ - **Dimensions**: width x height in pixels
70
+ - **Format**: image format
71
+ - **Modified**: last modification date
72
+ - **Path**: file path on the server
73
+
74
+ The overlay appears in the top-right corner and can be toggled on and off.
75
+
76
+ ## Supported Formats
77
+
78
+ png, jpg, jpeg, gif, webp, svg, bmp, ico, avif, tiff, tif, heic, heif
79
+
80
+ Animated GIFs and WebP animations play in the browser natively. SVG files render as vector graphics. HEIC/HEIF support depends on the browser.
81
+
82
+ ## EXIF Orientation
83
+
84
+ Images are displayed with `image-orientation: from-image`, meaning EXIF rotation data is respected automatically. Portrait photos taken on phones display upright without manual rotation.
85
+
86
+ ## Thumbnails
87
+
88
+ In the gallery, image thumbnails are generated server-side using sharp (preferred) or ImageMagick (fallback) at 200x200 pixels in webp format. Thumbnails are cached on disk and invalidated when the source file changes.
89
+
90
+ If no image processing tool is available, the full image is loaded directly.