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.
- package/docs/README.md +181 -0
- package/docs/_cover.md +14 -0
- package/docs/_sidebar.md +10 -0
- package/docs/_topbar.md +3 -0
- package/docs/audio-viewer.md +133 -0
- package/docs/ebook-reader.md +90 -0
- package/docs/image-viewer.md +90 -0
- package/docs/server-setup.md +262 -0
- package/docs/video-viewer.md +134 -0
- package/html/docs.html +59 -0
- package/package.json +21 -7
- package/source/Pict-Application-RetoldRemote.js +143 -2
- package/source/RetoldRemote-ExtensionMaps.js +33 -0
- package/source/cli/RetoldRemote-Server-Setup.js +82 -67
- package/source/cli/commands/RetoldRemote-Command-Serve.js +5 -26
- package/source/providers/Pict-Provider-CollectionManager.js +934 -0
- package/source/providers/Pict-Provider-FormattingUtilities.js +109 -0
- package/source/providers/Pict-Provider-GalleryFilterSort.js +2 -11
- package/source/providers/Pict-Provider-GalleryNavigation.js +270 -353
- package/source/providers/Pict-Provider-RetoldRemoteIcons.js +52 -0
- package/source/providers/Pict-Provider-ToastNotification.js +96 -0
- package/source/providers/keyboard-handlers/KeyHandler-AudioExplorer.js +88 -0
- package/source/providers/keyboard-handlers/KeyHandler-Gallery.js +190 -0
- package/source/providers/keyboard-handlers/KeyHandler-Sidebar.js +65 -0
- package/source/providers/keyboard-handlers/KeyHandler-VideoExplorer.js +57 -0
- package/source/providers/keyboard-handlers/KeyHandler-Viewer.js +197 -0
- package/source/server/RetoldRemote-ArchiveService.js +2 -12
- package/source/server/RetoldRemote-AudioWaveformService.js +7 -16
- package/source/server/RetoldRemote-CollectionService.js +684 -0
- package/source/server/RetoldRemote-EbookService.js +7 -16
- package/source/server/RetoldRemote-MediaService.js +3 -14
- package/source/server/RetoldRemote-ParimeCache.js +349 -0
- package/source/server/RetoldRemote-ThumbnailCache.js +52 -20
- package/source/server/RetoldRemote-VideoFrameService.js +7 -15
- package/source/views/PictView-Remote-AudioExplorer.js +10 -43
- package/source/views/PictView-Remote-CollectionsPanel.js +1087 -0
- package/source/views/PictView-Remote-Gallery.js +237 -44
- package/source/views/PictView-Remote-ImageViewer.js +1 -34
- package/source/views/PictView-Remote-Layout.js +410 -20
- package/source/views/PictView-Remote-MediaViewer.js +338 -51
- package/source/views/PictView-Remote-SettingsPanel.js +155 -138
- package/source/views/PictView-Remote-TopBar.js +615 -14
- package/source/views/PictView-Remote-VLCSetup.js +766 -0
- package/source/views/PictView-Remote-VideoExplorer.js +20 -54
- package/web-application/css/docuserve.css +73 -0
- package/web-application/docs/README.md +181 -0
- package/web-application/docs/_cover.md +14 -0
- package/web-application/docs/_sidebar.md +10 -0
- package/web-application/docs/_topbar.md +3 -0
- package/web-application/docs/audio-viewer.md +133 -0
- package/web-application/docs/ebook-reader.md +90 -0
- package/web-application/docs/image-viewer.md +90 -0
- package/web-application/docs/server-setup.md +262 -0
- package/web-application/docs/video-viewer.md +134 -0
- package/web-application/docs.html +59 -0
- package/web-application/js/pict-docuserve.min.js +58 -0
- package/web-application/js/pict.min.js +2 -2
- package/web-application/js/pict.min.js.map +1 -1
- package/web-application/retold-remote.js +2558 -439
- package/web-application/retold-remote.js.map +1 -1
- package/web-application/retold-remote.min.js +41 -11
- package/web-application/retold-remote.min.js.map +1 -1
- package/server.js +0 -43
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const libPictProvider = require('pict-provider');
|
|
2
|
+
|
|
3
|
+
const _DefaultProviderConfiguration =
|
|
4
|
+
{
|
|
5
|
+
ProviderIdentifier: 'RetoldRemote-FormattingUtilities',
|
|
6
|
+
AutoInitialize: true,
|
|
7
|
+
AutoSolveWithApp: false
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
class FormattingUtilitiesProvider extends libPictProvider
|
|
11
|
+
{
|
|
12
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
13
|
+
{
|
|
14
|
+
super(pFable, pOptions, pServiceHash);
|
|
15
|
+
this.serviceType = 'RetoldRemoteProvider';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Escape HTML special characters for safe insertion into markup.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} pText - Raw text to escape
|
|
22
|
+
* @returns {string} Escaped text safe for innerHTML
|
|
23
|
+
*/
|
|
24
|
+
escapeHTML(pText)
|
|
25
|
+
{
|
|
26
|
+
if (!pText) return '';
|
|
27
|
+
return pText.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Format a byte count into a human-readable size string.
|
|
32
|
+
*
|
|
33
|
+
* @param {number} pBytes - Size in bytes
|
|
34
|
+
* @returns {string} Formatted string like "1.5 MB"
|
|
35
|
+
*/
|
|
36
|
+
formatFileSize(pBytes)
|
|
37
|
+
{
|
|
38
|
+
if (!pBytes || pBytes === 0) return '0 B';
|
|
39
|
+
let tmpUnits = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
40
|
+
let tmpIndex = Math.floor(Math.log(pBytes) / Math.log(1024));
|
|
41
|
+
if (tmpIndex >= tmpUnits.length) tmpIndex = tmpUnits.length - 1;
|
|
42
|
+
let tmpSize = pBytes / Math.pow(1024, tmpIndex);
|
|
43
|
+
return tmpSize.toFixed(tmpIndex === 0 ? 0 : 1) + ' ' + tmpUnits[tmpIndex];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Format a date string compactly for display.
|
|
48
|
+
* Shows "M/D/YY" to keep columns narrow.
|
|
49
|
+
*
|
|
50
|
+
* @param {string} pDateString - ISO date string or parseable date
|
|
51
|
+
* @returns {string} Formatted string like "3/4/26"
|
|
52
|
+
*/
|
|
53
|
+
formatShortDate(pDateString)
|
|
54
|
+
{
|
|
55
|
+
if (!pDateString)
|
|
56
|
+
{
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
let tmpDate = new Date(pDateString);
|
|
60
|
+
if (isNaN(tmpDate.getTime()))
|
|
61
|
+
{
|
|
62
|
+
return '';
|
|
63
|
+
}
|
|
64
|
+
let tmpMonth = tmpDate.getMonth() + 1;
|
|
65
|
+
let tmpDay = tmpDate.getDate();
|
|
66
|
+
let tmpYear = String(tmpDate.getFullYear()).slice(-2);
|
|
67
|
+
return tmpMonth + '/' + tmpDay + '/' + tmpYear;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Format a duration in seconds to a timestamp string.
|
|
72
|
+
*
|
|
73
|
+
* @param {number} pSeconds - Duration in seconds
|
|
74
|
+
* @param {boolean} pIncludeMilliseconds - If true, append tenths of a second
|
|
75
|
+
* @returns {string} Formatted string like "1:23" or "1:02:34.5"
|
|
76
|
+
*/
|
|
77
|
+
formatTimestamp(pSeconds, pIncludeMilliseconds)
|
|
78
|
+
{
|
|
79
|
+
if (pSeconds === null || pSeconds === undefined || isNaN(pSeconds))
|
|
80
|
+
{
|
|
81
|
+
return '--';
|
|
82
|
+
}
|
|
83
|
+
let tmpHours = Math.floor(pSeconds / 3600);
|
|
84
|
+
let tmpMinutes = Math.floor((pSeconds % 3600) / 60);
|
|
85
|
+
let tmpSecs = Math.floor(pSeconds % 60);
|
|
86
|
+
|
|
87
|
+
let tmpResult;
|
|
88
|
+
if (tmpHours > 0)
|
|
89
|
+
{
|
|
90
|
+
tmpResult = tmpHours + ':' + String(tmpMinutes).padStart(2, '0') + ':' + String(tmpSecs).padStart(2, '0');
|
|
91
|
+
}
|
|
92
|
+
else
|
|
93
|
+
{
|
|
94
|
+
tmpResult = tmpMinutes + ':' + String(tmpSecs).padStart(2, '0');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (pIncludeMilliseconds)
|
|
98
|
+
{
|
|
99
|
+
let tmpMs = Math.floor((pSeconds % 1) * 10);
|
|
100
|
+
tmpResult += '.' + tmpMs;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return tmpResult;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
FormattingUtilitiesProvider.default_configuration = _DefaultProviderConfiguration;
|
|
108
|
+
|
|
109
|
+
module.exports = FormattingUtilitiesProvider;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
const libPictProvider = require('pict-provider');
|
|
2
|
-
|
|
3
|
-
const _ImageExtensions = { 'png': true, 'jpg': true, 'jpeg': true, 'gif': true, 'webp': true, 'svg': true, 'bmp': true, 'ico': true, 'avif': true, 'tiff': true, 'tif': true };
|
|
4
|
-
const _VideoExtensions = { 'mp4': true, 'webm': true, 'mov': true, 'mkv': true, 'avi': true, 'wmv': true, 'flv': true, 'm4v': true };
|
|
5
|
-
const _AudioExtensions = { 'mp3': true, 'wav': true, 'ogg': true, 'flac': true, 'aac': true, 'm4a': true, 'wma': true };
|
|
6
|
-
const _DocumentExtensions = { 'pdf': true, 'epub': true, 'mobi': true };
|
|
2
|
+
const libExtensionMaps = require('../RetoldRemote-ExtensionMaps.js');
|
|
7
3
|
|
|
8
4
|
const _DefaultProviderConfiguration =
|
|
9
5
|
{
|
|
@@ -340,12 +336,7 @@ class GalleryFilterSortProvider extends libPictProvider
|
|
|
340
336
|
*/
|
|
341
337
|
getCategory(pExtension)
|
|
342
338
|
{
|
|
343
|
-
|
|
344
|
-
if (_ImageExtensions[tmpExt]) return 'image';
|
|
345
|
-
if (_VideoExtensions[tmpExt]) return 'video';
|
|
346
|
-
if (_AudioExtensions[tmpExt]) return 'audio';
|
|
347
|
-
if (_DocumentExtensions[tmpExt]) return 'document';
|
|
348
|
-
return 'other';
|
|
339
|
+
return libExtensionMaps.getCategory(pExtension);
|
|
349
340
|
}
|
|
350
341
|
|
|
351
342
|
// ──────────────────────────────────────────────
|