@@ -23,28 +23,34 @@ teXt0wnz is a Progressive Web Application (PWA) for creating and editing text-mo
23232 . ** Collaborative mode** - Real-time multi-user editing via WebSocket server
2424
2525```
26- ┌─────────────────────────────────────────────────────────────┐
27- │ Browser Client │
28- │ ┌─────────────┐ ┌──────────────┐ ┌───────────────┐ │
29- │ │ UI Layer │ │ Canvas Layer │ │ Storage Layer │ │
30- │ │ (Controls) │ │ (Rendering) │ │ (IndexedDB) │ │
31- │ └─────────────┘ └──────────────┘ └───────────────┘ │
32- │ │ │ │ │
33- │ └────────────────┴───────────────────┘ │
34- │ │ │
35- │ State Management │
36- │ │ │
37- └──────────────────────────┼──────────────────────────────────┘
26+ ┌────────────────────────────────────────────────────────┐
27+ │ Browser Client │
28+ │ ┌─────────────┐ ┌──────────────┐ ┌───────────────┐ │
29+ │ │ UI Layer │ │ Canvas Layer │ │ Storage Layer │ │
30+ │ │ (Controls) │ │ (Rendering) │ │ (IndexedDB) │ │
31+ │ └─────────────┘ └──────────────┘ └───────────────┘ │
32+ │ │ │ │ │
33+ │ └────────────────┴───────────────────┘ │
34+ │ │ │
35+ │ State Management │
36+ │ │ │
37+ └──────────────────────────┼─────────────────────────────┘
38+ │
39+ ┌────────┼────────┐
40+ │ │ │
41+ Service Worker │ File System APIs
42+ (Offline/Share) │ (File Handlers)
43+ │
3844 │
3945 Optional WebSocket
4046 │
41- ┌──────────────────────────┼────────────────────────────────── ┐
42- │ Collaboration Server │
43- │ ┌─────────────┐ ┌──────────────┐ ┌──────────────┐ │
44- │ │ WebSocket │ │ Session Mgmt │ │ File Storage │ │
45- │ │ Handlers │ │ (Canvas) │ │ (Disk) │ │
46- │ └─────────────┘ └──────────────┘ └──────────────┘ │
47- └───────────────────────────────────────────────────────────── ┘
47+ ┌──────────────────────────┼────────────────────────────┐
48+ │ Collaboration Server │
49+ │ ┌─────────────┐ ┌──────────────┐ ┌──────────────┐ │
50+ │ │ WebSocket │ │ Session Mgmt │ │ File Storage │ │
51+ │ │ Handlers │ │ (Canvas) │ │ (Disk) │ │
52+ │ └─────────────┘ └──────────────┘ └──────────────┘ │
53+ └───────────────────────────────────────────────────────┘
4854```
4955
5056## Application Modes
@@ -106,10 +112,10 @@ User Action → State Update → Canvas Render → WebSocket Send → Server Bro
106112│ Rendering Engine, Font Management, Dirty Tracking │
107113└─────────────────┬────────────────────────────────────┘
108114 │
109- ┌─────────────────┴────────────────────────────────────┐
110- │ Data Layer │
111- │ Storage (IndexedDB), File I/O, Network (WebSocket) │
112- └──────────────────────────────────────────────────────┘
115+ ┌─────────────────┴──────────────────────────────────────────────────── ┐
116+ │ Data Layer │
117+ │ Storage (IndexedDB), File I/O, Network (WebSocket), PWA (Caching) │
118+ └────────────────────────────────────────────────────────────────────── ┘
113119```
114120
115121### Core Modules
@@ -170,10 +176,35 @@ User Action → State Update → Canvas Render → WebSocket Send → Server Bro
170176- ANSI format (.ans, .utf8.ans)
171177- Binary format (.bin)
172178- XBIN format (.xb)
173- - NFO format (.nfo)
179+ - Scene release formats (.nfo, .diz )
174180- Plain text (.txt)
181+ - Full SAUCE metadata support
175182- PNG export
176- - SAUCE metadata support
183+
184+ ** File Opening Methods:**
185+
186+ - Traditional file picker (all platforms)
187+ - Drag-and-drop (all platforms)
188+ - OS "Open with" (Desktop Chrome/Edge via File Handlers API)
189+ - Share sheet (Android via Share Target API)
190+ - iOS workaround (` accept="*/*" ` for broader file access)
191+
192+ ** Service Worker** (` service.js ` )
193+
194+ - Offline support and caching
195+ - Share Target API (Android file sharing)
196+ - Runtime caching strategies
197+ - Workbox-based precaching
198+ - Stale file cleanup
199+
200+ ** PWA Capabilities** (` site.webmanifest ` )
201+
202+ - File Handlers API (Desktop "Open with" support)
203+ - Share Target API (Mobile share sheet integration)
204+ - Multi-platform file opening:
205+ - Desktop: OS "Open with" → File Handlers API
206+ - Android: Share sheet → Share Target API
207+ - iOS: Manual file picker with ` accept="*/*" ` hack
177208
178209** Color Management** (` palette.js ` )
179210
@@ -490,24 +521,26 @@ When a drawing occurs:
490521### Client Modules
491522
492523```
493- src/js/client/
494- ├── main.js # Application entry point
495- ├── state.js # Global state management
496- ├── canvas.js # Canvas rendering engine
497- ├── ui.js # User interface components
498- ├── toolbar.js # Toolbar management
499- ├── palette.js # Color palette
500- ├── keyboard.js # Keyboard mode and shortcuts
501- ├── freehandTools.js # Drawing tools
502- ├── file.js # File I/O operations
503- ├── network.js # Network communication
504- ├── websocket.js # WebSocket worker
505- ├── font.js # Font loading and rendering
506- ├── lazyFont.js # Lazy font loading
507- ├── fontCache.js # Font caching
508- ├── storage.js # IndexedDB persistence
509- ├── compression.js # Data compression
510- └── magicNumbers.js # Constants and magic values
524+ src/
525+ ├── js/client/
526+ │ ├── main.js # Application entry point
527+ │ ├── state.js # Global state management
528+ │ ├── canvas.js # Canvas rendering engine
529+ │ ├── ui.js # User interface components
530+ │ ├── toolbar.js # Toolbar management
531+ │ ├── palette.js # Color palette
532+ │ ├── keyboard.js # Keyboard mode and shortcuts
533+ │ ├── freehandTools.js # Drawing tools
534+ │ ├── file.js # File I/O operations
535+ │ ├── network.js # Network communication
536+ │ ├── websocket.js # WebSocket worker
537+ │ ├── font.js # Font loading and rendering
538+ │ ├── lazyFont.js # Lazy font loading
539+ │ ├── fontCache.js # Font caching
540+ │ ├── storage.js # IndexedDB persistence
541+ │ ├── compression.js # Data compression
542+ │ └── magicNumbers.js # Constants and magic values
543+ └── service.js # PWA service worker
511544```
512545
513546### Server Modules
@@ -655,6 +688,35 @@ const saveToIndexedDB = debounce(() => {
655688}, 500 );
656689```
657690
691+ ### Service Worker Cache (Cache API)
692+
693+ ** Purpose:** Temporary storage for shared files and offline support
694+
695+ ** Cache: ` text0wnz-shared-files ` **
696+
697+ ** Usage:**
698+
699+ - Stores files shared via Share Target API (Android)
700+ - Temporary cache cleared after file is opened
701+ - Stale file cleanup on service worker activation
702+
703+ ** Cache Strategy:**
704+
705+ ``` javascript
706+ // Service worker handles POST to /open
707+ self .addEventListener (' fetch' , event => {
708+ if (url .pathname === ' /open' && event .request .method === ' POST' ) {
709+ // Cache shared file temporarily
710+ event .respondWith (handleShareTarget (event .request ));
711+ }
712+ });
713+ ```
714+
715+ ** Cache Cleanup:**
716+
717+ - Files deleted immediately after opening in main app
718+ - Stale files cleaned on service worker activation
719+
658720### Server Storage (File System)
659721
660722** Session Files:**
0 commit comments