diff --git a/.vscode/dashkiosk.http b/.vscode/dashkiosk.http
new file mode 100644
index 0000000..3192a49
--- /dev/null
+++ b/.vscode/dashkiosk.http
@@ -0,0 +1,24 @@
+@UniformResourceLocator = https://dashkiosk.phares.duckdns.org
+@Display = 5NRH58
+
+###
+
+GET {{UniformResourceLocator}}/api/display HTTP/1.1
+Accept: application/json
+
+###
+
+GET {{UniformResourceLocator}}/api/group HTTP/1.1
+Accept: application/json
+
+###
+
+PUT {{UniformResourceLocator}}/api/display/5NRH58/group/1 HTTP/1.1
+Accept: application/json
+
+###
+
+PUT {{UniformResourceLocator}}/api/display/5NRH58/group/2 HTTP/1.1
+Accept: application/json
+
+###
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 8aaeb39..51e1a46 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -1,11 +1,31 @@
{
- "version": "0.2.0",
- "configurations": [
- {
- "type": "node",
- "request": "launch",
- "name": "Launch Current Opened File",
- "program": "${file}"
- }
- ]
- }
\ No newline at end of file
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "node",
+ "request": "launch",
+ "name": "node Launch Current Opened File",
+ "program": "${file}"
+ },
+ {
+ "type": "bun",
+ "internalConsoleOptions": "neverOpen",
+ "request": "launch",
+ "name": "Debug File",
+ "program": "${file}",
+ "cwd": "${workspaceFolder}",
+ "stopOnEntry": false,
+ "watchMode": false
+ },
+ {
+ "type": "bun",
+ "internalConsoleOptions": "neverOpen",
+ "request": "launch",
+ "name": "Run File",
+ "program": "${file}",
+ "cwd": "${workspaceFolder}",
+ "noDebug": true,
+ "watchMode": false
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
index f660050..0b34175 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,5 +1,6 @@
{
"cSpell.words": [
+ "gitea",
"Immich",
"onlinepngtools"
],
diff --git a/bun.lock b/bun.lock
new file mode 100644
index 0000000..55b245b
--- /dev/null
+++ b/bun.lock
@@ -0,0 +1,31 @@
+{
+ "lockfileVersion": 1,
+ "workspaces": {
+ "": {
+ "devDependencies": {
+ "@types/bun": "latest",
+ "prettier": "^3.0.0",
+ },
+ "peerDependencies": {
+ "typescript": "^5",
+ },
+ },
+ },
+ "packages": {
+ "@types/bun": ["@types/bun@1.2.19", "", { "dependencies": { "bun-types": "1.2.19" } }, "sha512-d9ZCmrH3CJ2uYKXQIUuZ/pUnTqIvLDS0SK7pFmbx8ma+ziH/FRMoAq5bYpRG7y+w1gl+HgyNZbtqgMq4W4e2Lg=="],
+
+ "@types/node": ["@types/node@24.1.0", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w=="],
+
+ "@types/react": ["@types/react@19.1.9", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-WmdoynAX8Stew/36uTSVMcLJJ1KRh6L3IZRx1PZ7qJtBqT3dYTgyDTx8H1qoRghErydW7xw9mSJ3wS//tCRpFA=="],
+
+ "bun-types": ["bun-types@1.2.19", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-uAOTaZSPuYsWIXRpj7o56Let0g/wjihKCkeRqUBhlLVM/Bt+Fj9xTo+LhC1OV1XDaGkz4hNC80et5xgy+9KTHQ=="],
+
+ "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
+
+ "prettier": ["prettier@3.0.1", "", { "bin": "bin/prettier.cjs" }, "sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ=="],
+
+ "typescript": ["typescript@5.9.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A=="],
+
+ "undici-types": ["undici-types@7.8.0", "", {}, "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="],
+ }
+}
diff --git a/index.html b/index.html
index 8c2efb5..c237d4b 100644
--- a/index.html
+++ b/index.html
@@ -2,20 +2,21 @@
-
-
-
- www
+
+
+
+
+ www
-
+
\ No newline at end of file
diff --git a/package.json b/package.json
index 388d0e2..9c0697a 100644
--- a/package.json
+++ b/package.json
@@ -1,12 +1,20 @@
{
+ "devDependencies": {
+ "@types/bun": "latest",
+ "prettier": "^3.0.0"
+ },
+ "module": "index.ts",
+ "name": "www",
+ "peerDependencies": {
+ "typescript": "^5"
+ },
+ "private": true,
"scripts": {
- "prettier.check": "prettier . --check",
- "prettier.write": "prettier . --write",
+ "garbage-collect": "git gc",
"kanbn.board": "kanbn board",
"kanbn.board.json": "kanbn board -j > .kanbn/board.json",
- "garbage-collect": "git gc"
+ "prettier.check": "prettier . --check",
+ "prettier.write": "prettier . --write"
},
- "devDependencies": {
- "prettier": "^3.0.0"
- }
-}
+ "type": "module"
+}
\ No newline at end of file
diff --git a/slideshow/css/index.css b/slideshow/css/index.css
index 81cef89..ea388f3 100644
--- a/slideshow/css/index.css
+++ b/slideshow/css/index.css
@@ -24,4 +24,4 @@ body {
opacity: 1;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=1);
-}
+}
\ No newline at end of file
diff --git a/slideshow/index.html b/slideshow/index.html
index ab175f2..2fce5a6 100644
--- a/slideshow/index.html
+++ b/slideshow/index.html
@@ -2,26 +2,26 @@
-
-
-
-
-
-
- Slideshow
+
+
+
+
+
+
+ Slideshow
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/slideshow/index.json b/slideshow/index.json
index 8efc92f..bece1f4 100644
--- a/slideshow/index.json
+++ b/slideshow/index.json
@@ -1,17 +1,10 @@
{
+ "DataDirectory": "random-results",
+ "ImageInterval": 15123,
"ImageIntervalX": 9123,
"ImageIntervalXX": 21234,
- "ImageInterval": 15123,
- "JsonInterval": 59000,
"ImageZero": "images/1x1_00000000.png",
- "DataDirectoryX": "../.random",
- "DataDirectoryXX": "../Images-c9dbce3b-Results/F)Random/c9dbce3b/[]",
- "DataDirectory": "random-results",
- "ImmichUrlX": "http://192.168.11.2:3001/api/assets/",
- "ImmichUrlXX": "https://immich.phares.duckdns.org/api/assets/",
- "RandomPathsUrlX": "http://192.168.11.2:5009/api/v1/assets/5f0b1052-466d-44de-a554-226d7256850d/random-paths/",
- "RandomPathsUrlXX": "https://immichtoslideshow.phares.duckdns.org/api/v1/assets/5f0b1052-466d-44de-a554-226d7256850d/random-paths/",
- "RootX": "../.original",
- "RootXX": "../Images-c9dbce3b-Results/thumbs",
- "Root": "5f0b1052-466d-44de-a554-226d7256850d/"
-}
+ "JsonInterval": 59000,
+ "ListLength": 15,
+ "UserId": "93f51ef4-f1f8-48af-ab00-e00436d790ef"
+}
\ No newline at end of file
diff --git a/slideshow/scripts/index.js b/slideshow/scripts/index.js
index 3286c9e..adf7408 100644
--- a/slideshow/scripts/index.js
+++ b/slideshow/scripts/index.js
@@ -1,50 +1,51 @@
(function () {
- "use strict";
+ 'use strict';
- var _Root;
- var _RootAlt;
+ var _UserId;
var _ImageZero;
+ var _ListLength;
var _DataDirectory;
- var _RandomPathsUrl;
+ var _UniformResourceLocator;
var _Pause = 0;
var _Images = [];
- var _JsonInterval;
- var _ImageInterval;
var _ImageIndex = 0;
var _OpaqueIndex = 0;
- var _DeviceReadyDiv = $('#deviceReady div');
-
- var time = document.createElement('time');
- time.setAttribute('style', 'position: fixed;');
+ var _hasLast = false;
+ var _hasList = false;
+ var _hasTime = false;
+ var _TickLoadList = null;
+ var _DeviceReadyDiv = typeof document == 'undefined' ? undefined : $('#deviceReady div');
+ var _TimeElement = typeof document == 'undefined' ? undefined : document.createElement('time');
function loadData() {
- var currentDate = new Date();
- var mm = (new Date().getMonth() + 1).toString().padStart(2, '0');
- var dd = currentDate.getDate().toString().padStart(2, '0');
- if (window.location.href.indexOf('time') > 0) {
- time.innerText = mm + '-' + dd + '.json';
- }
- var url = _DataDirectory + '/' + mm + '-' + dd + '.json?nocache=2024-11-23-22-25';
+ const currentDate = new Date();
+ const dd = currentDate.getDate().toString().padStart(2, '0');
+ const mm = (new Date().getMonth() + 1).toString().padStart(2, '0');
+ const url = _UniformResourceLocator + '/slideshow/' + _DataDirectory + '/' + mm + '-' + dd + '.json?nocache=2025-08-02-11-33';
console.log(url);
- $.getJSON(url, function (data) {
- console.log('success', data.length);
- _Images = [];
- $.each(data, function (_, value) {
- // _Images.push(value.replaceAll("\\", "/"));
- _Images.push(value);
- });
- })
- .done(function () { console.log('second success'); })
- .fail(function (er) { console.log('error', er); })
- .always(function () { console.log('complete'); });
+ fetch(url, { nocache: new Date().getTime() })
+ .then((res) => res.text())
+ .then((text) => {
+ console.log(url + ' downloaded successfully');
+ const data = JSON.parse(text);
+ console.log('success', data.length);
+ _Images = [];
+ for (let i = 0; i < data.length; i++) {
+ _Images.push(_UniformResourceLocator + '/slideshow/' + _UserId + data[i]);
+ }
+ })
+ .catch((e) => console.error(e));
+ if (_TimeElement != undefined && _hasTime) {
+ _TimeElement.innerText = _UniformResourceLocator + ' ' + mm + '-' + dd + '.json';
+ }
}
function onTickJSON() {
- var currentDate = new Date();
- var currentHours = currentDate.getHours();
+ const currentDate = new Date();
+ const currentHours = currentDate.getHours();
if (currentHours === 0) {
- var currentMinutes = currentDate.getMinutes();
+ const currentMinutes = currentDate.getMinutes();
if (currentMinutes === 0) {
loadData();
}
@@ -52,18 +53,14 @@
}
function GetBackgroundImage() {
- var result = "background-image: url('" + _Root + _Images[_ImageIndex] + '?index=' + _ImageIndex + "'), url('";
- if (_RootAlt !== null) {
- result = result + _RootAlt + _Images[_ImageIndex] + '?index=' + _ImageIndex + "'), url('";
- }
- result = result + _ImageZero + "');";
+ let result = "background-image: url('" + _Images[_ImageIndex] + '?index=' + _ImageIndex + "'), url('" + _ImageZero + "');";
return result;
}
function onTickImage() {
if (_Images.length > 0 && _Pause === 0) {
- var currentDate = new Date();
- var currentHours = currentDate.getHours();
+ const currentDate = new Date();
+ const currentHours = currentDate.getHours();
if (currentHours >= 23 || currentHours <= 6) {
_DeviceReadyDiv.attr('style', 'background-color: #191717;');
}
@@ -73,7 +70,7 @@
if (_ImageIndex >= _Images.length) {
_ImageIndex = 0;
}
- var loadIndex;
+ let loadIndex;
switch (_OpaqueIndex) {
case 0:
loadIndex = 2;
@@ -89,13 +86,13 @@
break;
default:
}
- var backgroundImage = GetBackgroundImage();
+ const backgroundImage = GetBackgroundImage();
_DeviceReadyDiv.eq(loadIndex).attr('style', backgroundImage);
_DeviceReadyDiv.eq(_OpaqueIndex).addClass('opaque');
- if (window.location.href.indexOf('time') > 0) {
- var mm = (new Date().getMonth() + 1).toString().padStart(2, '0');
- var dd = currentDate.getDate().toString().padStart(2, '0');
- time.innerText = mm + '-' + dd + '.json' + ' ' + _Images[_ImageIndex];
+ if (_TimeElement != undefined && _hasTime) {
+ const mm = (new Date().getMonth() + 1).toString().padStart(2, '0');
+ const dd = currentDate.getDate().toString().padStart(2, '0');
+ _TimeElement.innerText = _UniformResourceLocator + ' ' + mm + '-' + dd + '.json' + ' ' + _Images[_ImageIndex];
}
}
}
@@ -103,7 +100,7 @@
function pause() {
_Pause = 1;
- $('#deviceReady').innerHTML = '';
+ _DeviceReadyDiv.innerHTML = '';
}
function goBack() {
@@ -114,7 +111,7 @@
if (_ImageIndex === 0) {
_ImageIndex = _Images.length - 1;
}
- var backgroundImage = GetBackgroundImage();
+ const backgroundImage = GetBackgroundImage();
_DeviceReadyDiv.attr('style', backgroundImage);
}
@@ -126,12 +123,12 @@
if (_ImageIndex >= _Images.length) {
_ImageIndex = 0;
}
- var backgroundImage = GetBackgroundImage();
+ const backgroundImage = GetBackgroundImage();
_DeviceReadyDiv.attr('style', backgroundImage);
}
function getInput(e) {
- var which = e.which;
+ const which = e.which;
switch (which) {
case 13: //Okay
if (_Pause === 0) {
@@ -139,7 +136,7 @@
}
else {
_Pause = 0;
- $('#deviceReady').innerHTML = '';
+ _DeviceReadyDiv.innerHTML = '';
}
break;
case 37: //Left
@@ -164,59 +161,102 @@
}
}
- if (window.location.href.indexOf('time') > 0) {
- document.body.appendChild(time);
+ function getUniformResourceLocator() {
+ let result;
+ if (typeof window == 'undefined') {
+ result = 'https://slideshow.phares.duckdns.org';
+ }
+ else {
+ result = window.location.protocol + '//' + window.location.host;
+ }
+ return result;
}
- if (window.location.href.indexOf('last') > 0) {
- var url = '../log-nginx/access.log?nocache=2024-11-23-22-25';
- $.get(url, function (data) {
- var arrayOfUrl = [];
- var arrayOfIndex = [];
- var arrayOfLines = data.match(/[^\r\n]+/g);
- for (var i = arrayOfLines.length - 1; i >= 0; i--) {
- arrayOfUrl = arrayOfLines[i].split('?index=');
- if (arrayOfUrl.length !== 2)
- continue;
- arrayOfIndex = arrayOfUrl[1].split(' ');
- if (arrayOfIndex.length < 2)
- continue;
- var index = parseInt(arrayOfIndex[0]);
- console.log('index', index);
- _ImageIndex = index;
- break;
- }
- })
- .fail(function (err) {
- console.error(err);
- });
- }
-
- $(document).ready(function () {
-
- console.log('onDeviceReady');
-
- document.addEventListener('keyup', getInput, false);
-
- var url = '../slideshow/index.json?nocache=2024-11-23-22-25';
+ function loadPage() {
+ const uniformResourceLocator = getUniformResourceLocator();
+ _hasLast = typeof window == 'undefined' ? false : window.location.href.indexOf('last') > 0;
+ _hasList = typeof window == 'undefined' ? false : window.location.href.indexOf('list') > 0;
+ _hasTime = typeof window == 'undefined' ? false : window.location.href.indexOf('time') > 0;
+ const url = uniformResourceLocator + '/slideshow/index.json?nocache=2025-08-02-11-33';
console.log(url);
- var _ = $.getJSON(url, function (data) {
- console.log(url + ' downloaded successfully');
- _RootAlt = null;
- _Root = data.Root;
- _ImageZero = data.ImageZero;
- _JsonInterval = data.JsonInterval;
- _ImageInterval = data.ImageInterval;
- _DataDirectory = data.DataDirectory;
- console.log(url + ' used successfully');
- })
- .done(function () {
+ fetch(url, { nocache: new Date().getTime() })
+ .then((res) => res.text())
+ .then((text) => {
+ console.log(url + ' downloaded successfully');
+ const data = JSON.parse(text);
+ _UserId = data.UserId;
+ _ListLength = data.ListLength;
+ _DataDirectory = data.DataDirectory;
+ _UniformResourceLocator = uniformResourceLocator;
+ _ImageZero = uniformResourceLocator + '/slideshow/' + data.ImageZero;
+ console.log(url + ' used successfully');
+ if (_TimeElement != undefined && _hasTime) {
+ _TimeElement.setAttribute('style', 'position: fixed;');
+ document.body.appendChild(_TimeElement);
+ }
+ if (_hasLast) {
+ loadLog();
+ }
loadData();
- _ = setInterval(onTickJSON, _JsonInterval);
- _ = setInterval(onTickImage, _ImageInterval);
+ if (!_hasList && _DeviceReadyDiv != undefined) {
+ setInterval(onTickJSON, data.JsonInterval);
+ setInterval(onTickImage, data.ImageInterval);
+ }
+ if (_hasList && _hasLast) {
+ _TickLoadList = setInterval(onTickLoadList, 500);
+ }
})
- .fail(function (er) { console.log('error', er); })
- .always(function () { console.log('complete'); });
- });
+ .catch((e) => console.error(e));
+ }
+
+ function onTickLoadList() {
+ if (_ImageIndex > 0 && _Images.length > 0) {
+ clearInterval(_TickLoadList);
+ let innerHTML = '';
+ for (let i = 0; i < _ListLength; i++) {
+ innerHTML += '![' + _ImageIndex + ' ' + _Images[_ImageIndex] + '](' + _Images[_ImageIndex] + ')
\n';
+ _ImageIndex -= 1;
+ if (_ImageIndex < 0) {
+ _ImageIndex = _Images.length - 1;
+ }
+ }
+ document.getElementById('deviceReady').innerHTML = innerHTML;
+ }
+ }
+
+ function loadLog() {
+ const url = _UniformResourceLocator + '/log-nginx/access.log?nocache=2025-08-02-11-33';
+ fetch(url, { nocache: new Date().getTime() })
+ .then((res) => res.text())
+ .then((text) => {
+ console.log(url + ' downloaded successfully');
+ let arrayOfUrl = [];
+ let arrayOfIndex = [];
+ const arrayOfLines = text.match(/[^\r\n]+/g);
+ for (let i = arrayOfLines.length - 1; i >= 0; i--) {
+ arrayOfUrl = arrayOfLines[i].split('?index=');
+ if (arrayOfUrl.length !== 2)
+ continue;
+ arrayOfIndex = arrayOfUrl[1].split(' ');
+ if (arrayOfIndex.length < 2)
+ continue;
+ let index = parseInt(arrayOfIndex[0]);
+ console.log('index', index);
+ _ImageIndex = index;
+ break;
+ }
+ })
+ .catch((e) => console.error(e));
+ }
+
+ if (typeof document == 'undefined') {
+ loadPage();
+ } else {
+ $(document).ready(function () {
+ console.log('onDeviceReady');
+ document.addEventListener('keyup', getInput, false);
+ loadPage();
+ });
+ }
})();
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..9c62f74
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,28 @@
+{
+ "compilerOptions": {
+ // Environment setup & latest features
+ "lib": ["ESNext"],
+ "target": "ESNext",
+ "module": "ESNext",
+ "moduleDetection": "force",
+ "jsx": "react-jsx",
+ "allowJs": true,
+
+ // Bundler mode
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "verbatimModuleSyntax": true,
+ "noEmit": true,
+
+ // Best practices
+ "strict": true,
+ "skipLibCheck": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUncheckedIndexedAccess": true,
+
+ // Some stricter flags (disabled by default)
+ "noUnusedLocals": false,
+ "noUnusedParameters": false,
+ "noPropertyAccessFromIndexSignature": false
+ }
+}