retold-remote 0.0.1 → 0.0.2

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 (33) hide show
  1. package/html/index.html +2 -0
  2. package/package.json +20 -14
  3. package/source/Pict-Application-RetoldRemote.js +46 -5
  4. package/source/cli/RetoldRemote-CLI-Run.js +0 -0
  5. package/source/cli/RetoldRemote-Server-Setup.js +790 -8
  6. package/source/cli/commands/RetoldRemote-Command-Serve.js +34 -1
  7. package/source/providers/Pict-Provider-GalleryFilterSort.js +61 -9
  8. package/source/providers/Pict-Provider-GalleryNavigation.js +517 -18
  9. package/source/providers/Pict-Provider-RetoldRemote.js +11 -2
  10. package/source/providers/Pict-Provider-RetoldRemoteIcons.js +1 -0
  11. package/source/server/RetoldRemote-ArchiveService.js +830 -0
  12. package/source/server/RetoldRemote-AudioWaveformService.js +673 -0
  13. package/source/server/RetoldRemote-EbookService.js +242 -0
  14. package/source/server/RetoldRemote-MediaService.js +1 -1
  15. package/source/server/RetoldRemote-ToolDetector.js +31 -1
  16. package/source/server/RetoldRemote-VideoFrameService.js +486 -0
  17. package/source/views/PictView-Remote-AudioExplorer.js +1213 -0
  18. package/source/views/PictView-Remote-Gallery.js +141 -2
  19. package/source/views/PictView-Remote-Layout.js +18 -27
  20. package/source/views/PictView-Remote-MediaViewer.js +638 -39
  21. package/source/views/PictView-Remote-SettingsPanel.js +23 -0
  22. package/source/views/PictView-Remote-TopBar.js +121 -0
  23. package/source/views/PictView-Remote-VideoExplorer.js +1229 -0
  24. package/web-application/index.html +2 -0
  25. package/web-application/js/epub.min.js +1 -0
  26. package/web-application/retold-remote.js +7030 -1244
  27. package/web-application/retold-remote.js.map +1 -1
  28. package/web-application/retold-remote.min.js +13 -44
  29. package/web-application/retold-remote.min.js.map +1 -1
  30. package/web-application/retold-remote.compatible.js +0 -5764
  31. package/web-application/retold-remote.compatible.js.map +0 -1
  32. package/web-application/retold-remote.compatible.min.js +0 -120
  33. package/web-application/retold-remote.compatible.min.js.map +0 -1
@@ -21,6 +21,17 @@ class RetoldRemoteCommandServe extends libCommandLineCommand
21
21
  this.options.CommandOptions.push(
22
22
  { Name: '-H, --hashed-filenames', Description: 'Enable hashed filenames mode (short hashes instead of full paths in URLs).', Default: false });
23
23
 
24
+ this.options.CommandOptions.push(
25
+ { Name: '-c, --cache-path [path]', Description: 'Root cache directory (defaults to ./dist/retold-cache/).', Default: '' });
26
+ this.options.CommandOptions.push(
27
+ { Name: '--cache-thumbnails [path]', Description: 'Override thumbnails cache directory.', Default: '' });
28
+ this.options.CommandOptions.push(
29
+ { Name: '--cache-archives [path]', Description: 'Override archives cache directory.', Default: '' });
30
+ this.options.CommandOptions.push(
31
+ { Name: '--cache-video-frames [path]', Description: 'Override video-frames cache directory.', Default: '' });
32
+ this.options.CommandOptions.push(
33
+ { Name: '--cache-audio-waveforms [path]', Description: 'Override audio-waveforms cache directory.', Default: '' });
34
+
24
35
  this.addCommand();
25
36
  }
26
37
 
@@ -51,12 +62,34 @@ class RetoldRemoteCommandServe extends libCommandLineCommand
51
62
 
52
63
  let tmpHashedFilenames = !!(this.CommandOptions.hashedFilenames);
53
64
 
65
+ // Resolve cache paths: individual overrides > root override > default
66
+ let tmpCacheRoot = this.CommandOptions.cachePath
67
+ ? libPath.resolve(this.CommandOptions.cachePath)
68
+ : null;
69
+ let tmpCacheThumbnails = this.CommandOptions.cacheThumbnails
70
+ ? libPath.resolve(this.CommandOptions.cacheThumbnails)
71
+ : null;
72
+ let tmpCacheArchives = this.CommandOptions.cacheArchives
73
+ ? libPath.resolve(this.CommandOptions.cacheArchives)
74
+ : null;
75
+ let tmpCacheVideoFrames = this.CommandOptions.cacheVideoFrames
76
+ ? libPath.resolve(this.CommandOptions.cacheVideoFrames)
77
+ : null;
78
+ let tmpCacheAudioWaveforms = this.CommandOptions.cacheAudioWaveforms
79
+ ? libPath.resolve(this.CommandOptions.cacheAudioWaveforms)
80
+ : null;
81
+
54
82
  tmpSetupServer(
55
83
  {
56
84
  ContentPath: tmpContentPath,
57
85
  DistPath: tmpDistPath,
58
86
  Port: tmpPort,
59
- HashedFilenames: tmpHashedFilenames
87
+ HashedFilenames: tmpHashedFilenames,
88
+ CacheRoot: tmpCacheRoot,
89
+ CacheThumbnails: tmpCacheThumbnails,
90
+ CacheArchives: tmpCacheArchives,
91
+ CacheVideoFrames: tmpCacheVideoFrames,
92
+ CacheAudioWaveforms: tmpCacheAudioWaveforms
60
93
  },
61
94
  function (pError, pServerInfo)
62
95
  {
@@ -84,6 +84,44 @@ class GalleryFilterSortProvider extends libPictProvider
84
84
  return pItems;
85
85
  }
86
86
 
87
+ let tmpRemote = this.pict.AppData.RetoldRemote;
88
+ let tmpCaseSensitive = tmpRemote.SearchCaseSensitive || false;
89
+ let tmpRegex = tmpRemote.SearchRegex || false;
90
+
91
+ if (tmpRegex)
92
+ {
93
+ // Regex mode
94
+ let tmpRegexObj;
95
+ try
96
+ {
97
+ tmpRegexObj = new RegExp(pQuery, tmpCaseSensitive ? '' : 'i');
98
+ }
99
+ catch (pError)
100
+ {
101
+ // Invalid regex — store error for UI feedback and return all items
102
+ tmpRemote._searchRegexError = pError.message;
103
+ return pItems;
104
+ }
105
+
106
+ tmpRemote._searchRegexError = null;
107
+ return pItems.filter((pItem) =>
108
+ {
109
+ return tmpRegexObj.test(pItem.Name);
110
+ });
111
+ }
112
+
113
+ // Plain text mode
114
+ tmpRemote._searchRegexError = null;
115
+
116
+ if (tmpCaseSensitive)
117
+ {
118
+ return pItems.filter((pItem) =>
119
+ {
120
+ return pItem.Name.includes(pQuery);
121
+ });
122
+ }
123
+
124
+ // Default: case-insensitive substring match
87
125
  let tmpQuery = pQuery.toLowerCase();
88
126
  return pItems.filter((pItem) =>
89
127
  {
@@ -103,7 +141,7 @@ class GalleryFilterSortProvider extends libPictProvider
103
141
 
104
142
  return pItems.filter((pItem) =>
105
143
  {
106
- if (pItem.Type === 'folder')
144
+ if (pItem.Type === 'folder' || pItem.Type === 'archive')
107
145
  {
108
146
  return true;
109
147
  }
@@ -138,7 +176,7 @@ class GalleryFilterSortProvider extends libPictProvider
138
176
 
139
177
  return pItems.filter((pItem) =>
140
178
  {
141
- if (pItem.Type === 'folder')
179
+ if (pItem.Type === 'folder' || pItem.Type === 'archive')
142
180
  {
143
181
  return true;
144
182
  }
@@ -159,7 +197,7 @@ class GalleryFilterSortProvider extends libPictProvider
159
197
 
160
198
  return pItems.filter((pItem) =>
161
199
  {
162
- if (pItem.Type === 'folder')
200
+ if (pItem.Type === 'folder' || pItem.Type === 'archive')
163
201
  {
164
202
  return true;
165
203
  }
@@ -193,7 +231,7 @@ class GalleryFilterSortProvider extends libPictProvider
193
231
 
194
232
  return pItems.filter((pItem) =>
195
233
  {
196
- if (pItem.Type === 'folder')
234
+ if (pItem.Type === 'folder' || pItem.Type === 'archive')
197
235
  {
198
236
  return true;
199
237
  }
@@ -229,11 +267,13 @@ class GalleryFilterSortProvider extends libPictProvider
229
267
 
230
268
  return pItems.slice().sort((pA, pB) =>
231
269
  {
232
- // 'folder-first' mode: folders always sort before files
270
+ // 'folder-first' mode: containers (folders + archives) always sort before files
233
271
  if (pSortField === 'folder-first')
234
272
  {
235
- if (pA.Type === 'folder' && pB.Type !== 'folder') return -1;
236
- if (pA.Type !== 'folder' && pB.Type === 'folder') return 1;
273
+ let tmpAIsContainer = (pA.Type === 'folder' || pA.Type === 'archive');
274
+ let tmpBIsContainer = (pB.Type === 'folder' || pB.Type === 'archive');
275
+ if (tmpAIsContainer && !tmpBIsContainer) return -1;
276
+ if (!tmpAIsContainer && tmpBIsContainer) return 1;
237
277
  // Both same type: sort by name ascending
238
278
  let tmpNameA = (pA.Name || '').toLowerCase();
239
279
  let tmpNameB = (pB.Name || '').toLowerCase();
@@ -316,7 +356,7 @@ class GalleryFilterSortProvider extends libPictProvider
316
356
  for (let i = 0; i < tmpRaw.length; i++)
317
357
  {
318
358
  let tmpItem = tmpRaw[i];
319
- if (tmpItem.Type === 'folder')
359
+ if (tmpItem.Type === 'folder' || tmpItem.Type === 'archive')
320
360
  {
321
361
  continue;
322
362
  }
@@ -417,7 +457,15 @@ class GalleryFilterSortProvider extends libPictProvider
417
457
  // Search query
418
458
  if (tmpRemote.SearchQuery)
419
459
  {
420
- tmpChips.push({ key: 'search', label: 'Search: "' + tmpRemote.SearchQuery + '"' });
460
+ let tmpSearchLabel = 'Search: "' + tmpRemote.SearchQuery + '"';
461
+ let tmpSearchFlags = [];
462
+ if (tmpRemote.SearchCaseSensitive) tmpSearchFlags.push('Aa');
463
+ if (tmpRemote.SearchRegex) tmpSearchFlags.push('.*');
464
+ if (tmpSearchFlags.length > 0)
465
+ {
466
+ tmpSearchLabel += ' [' + tmpSearchFlags.join(', ') + ']';
467
+ }
468
+ tmpChips.push({ key: 'search', label: tmpSearchLabel });
421
469
  }
422
470
 
423
471
  return tmpChips;
@@ -487,6 +535,7 @@ class GalleryFilterSortProvider extends libPictProvider
487
535
  else if (pKey === 'search')
488
536
  {
489
537
  tmpRemote.SearchQuery = '';
538
+ tmpRemote._searchRegexError = null;
490
539
  }
491
540
  }
492
541
 
@@ -502,6 +551,9 @@ class GalleryFilterSortProvider extends libPictProvider
502
551
  }
503
552
 
504
553
  tmpRemote.SearchQuery = '';
554
+ tmpRemote.SearchCaseSensitive = false;
555
+ tmpRemote.SearchRegex = false;
556
+ tmpRemote._searchRegexError = null;
505
557
  tmpRemote.GalleryFilter = 'all';
506
558
  tmpRemote.FilterState =
507
559
  {