You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
6
6
7
7
FrameTrail is an open hypervideo environment for creating, annotating, and remixing interactive videos. It's a client-side JavaScript application with an optional PHP backend that uses **JSON files instead of a database** for all data storage. The entire system is portable — copy the `_data` directory between servers and everything works.
8
8
9
-
FrameTrail can run in three modes: with a PHP server (full multi-user), with the File System Access API for local editing (no server needed), or as a read-only viewer.
9
+
FrameTrail can run in three modes: with a PHP server (full multi-user), with the File System Access API for local editing in Chrome/Edge (no server needed), or in-memory using the Download adapter (view + edit + export, no persistence — works everywhere but requires data to be passed via init options).
10
10
11
11
## Repository Structure
12
12
@@ -136,7 +136,7 @@ Note: Some libraries have custom/patched versions (raphael-connections.js, rapha
136
136
-`'server'` — PHP backend available, data loaded/saved via AJAX to `src/_server/ajaxServer.php`
137
137
-`'local'` — File System Access API active, data read/written via `StorageAdapterLocal` to a user-selected folder
138
138
-`'needsFolder'` — File System Access API supported but no folder selected yet; launcher prompts user to pick a `_data` directory
139
-
-`'noStorage'` — No storage backend available (Firefox/Safari on `file://`); app cannot load or save data
139
+
-`'download'` — No persistent storage available (Firefox/Safari, or any browser without File System Access API and no PHP); `StorageAdapterDownload` is used, which stores data in memory and lets users export/download it. Viewing and editing work; saves persist only until page reload.
|`loggedIn`| Boolean | User authentication status |
264
264
|`username`| String | Current user's name |
265
265
|`fullscreen`| Boolean | Fullscreen state |
@@ -293,21 +293,24 @@ FrameTrail uses a strategy pattern for data persistence. The `StorageManager` mo
293
293
294
294
| Adapter | Class | When Used |
295
295
|---------|-------|-----------|
296
-
| Server |`StorageAdapterServer`|Running on Apache+PHP (`document.location.host` exists)|
297
-
| Local |`StorageAdapterLocal`| File System Access API available (Chrome/Edge, file://)|
298
-
| Download |`StorageAdapterDownload`|Fallback — enables Save As/export |
296
+
| Server |`StorageAdapterServer`|HTTP/HTTPS with PHP backend responding at `_server/ajaxServer.php`|
297
+
| Local |`StorageAdapterLocal`| File System Access API available (Chrome/Edge) and folder selected|
298
+
| Download |`StorageAdapterDownload`|Supplemental — provides Save As/export in either mode|
299
299
300
300
All adapters implement the same interface, so the rest of the application doesn't need to know which storage backend is active.
301
301
302
302
### Storage Mode Detection
303
303
304
-
The `PlayerLauncher` (or `ResourceManagerLauncher`) detects the environment:
304
+
`StorageManager.init()` determines the storage mode at startup:
305
305
306
-
1. If `document.location.host` is set → `'server'` mode (PHP backend available)
307
-
2. If File System Access API is supported → `'needsFolder'` (prompt user to select `_data` folder)
308
-
3. Otherwise → `'noStorage'` (read-only fallback)
306
+
1. If on HTTP/HTTPS **and** PHP backend responds at `_server/ajaxServer.php` → `'server'`
307
+
2. If on HTTP/HTTPS **but** PHP is unreachable, or on `file://` protocol:
308
+
- If File System Access API is supported (Chrome/Edge) → try to restore a previously saved folder handle
309
+
- Handle restored → `'local'`
310
+
- No handle saved → `'needsFolder'` (folder picker dialog is shown)
311
+
- File System Access API not supported (Firefox/Safari) → `'download'`
309
312
310
-
Once a folder is selected in `'needsFolder'` mode, the state transitions to `'local'`.
313
+
In `'download'` mode the `StorageAdapterDownload` is used: data is stored in memory, and users can export their work as JSON via the Save As dialog. Viewing and editing both work. Once a folder is selected in `'needsFolder'` mode, the state transitions to `'local'`.
Copy file name to clipboardExpand all lines: docs/DEPLOYMENT.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,21 +58,11 @@ The `StorageAdapterLocal` class uses the File System Access API (`showDirectoryP
58
58
- No PHP-based file processing (image optimization, video transcoding)
59
59
- Browser must support File System Access API (Chrome/Edge only)
60
60
61
-
### Option 3: Read-Only Viewing
61
+
### Save As / Export
62
62
63
-
View existing hypervideos without any editing capability.
63
+
The `StorageAdapterDownload` is used as the fallback storage backend when no PHP server and no local folder are available (`storageMode: 'download'`). It stores all data in memory and exposes a Save As dialog that downloads a JSON snapshot of the current state.
64
64
65
-
**Steps:**
66
-
67
-
1. Open `index.html` in any modern browser
68
-
2. If a `_data` folder with hypervideo data exists alongside the HTML files, FrameTrail loads it for viewing
69
-
3. No editing, no saving — purely a viewer
70
-
71
-
**Note:** Firefox supports loading local files via AJAX when opening `index.html` from the filesystem. Chrome blocks this by default.
72
-
73
-
### Option 4: Save As / Download Mode
74
-
75
-
When neither a server nor the File System Access API is available, FrameTrail falls back to the `StorageAdapterDownload`. Users can still create and edit hypervideos, then export the data as downloadable files via the browser's download mechanism. This is useful for one-off editing or as a fallback on unsupported browsers.
65
+
In server and local modes, Save As is also available as a supplemental export tool — useful for archiving or migrating content between instances.
When running in server mode, you can pass all hypervideo and resource data directly via init options, bypassing the `_data/` directory entirely. This is useful for embedding a specific hypervideo on a page without managing the data folder.
**Note:** When no PHP server and no local folder are available, FrameTrail falls back to `storageMode: 'download'` — the `StorageAdapterDownload` holds data in memory. Inline data init options work fully in this mode: viewing and editing are both functional, and changes can be exported via the Save As dialog. Nothing persists past a page reload unless exported.
131
+
132
132
See [docs/ARCHITECTURE.md](ARCHITECTURE.md) for the full initialization options reference.
0 commit comments