@tomorrowos/sdk 0.2.3 → 0.2.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomorrowos/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "TomorrowOS CMS server SDK — WebSocket transport, pairing, device commands, optional static CMS UI. Includes CLI (tomorrowos init / build) and starter templates.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-cms",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "CMS server on @tomorrowos/sdk. Add your UI (React, static files, etc.) alongside this server.",
|
|
5
5
|
"private": true,
|
|
6
6
|
"type": "module",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"build-player": "tomorrowos build --platform tizen"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@tomorrowos/sdk": "^0.2.
|
|
13
|
+
"@tomorrowos/sdk": "^0.2.4"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/node": "^20.0.0",
|
|
@@ -9,7 +9,6 @@ let playlistItems = [];
|
|
|
9
9
|
let devicesCache = [];
|
|
10
10
|
|
|
11
11
|
let devicePollTimer = null;
|
|
12
|
-
let deviceUptimeTimer = null;
|
|
13
12
|
|
|
14
13
|
function escapeHtml(value) {
|
|
15
14
|
return String(value ?? "")
|
|
@@ -58,16 +57,6 @@ function formatDeviceOnlineLabel(device) {
|
|
|
58
57
|
return formatDurationMs(Date.now() - bootMs);
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
function updateDeviceUptimeLabels() {
|
|
62
|
-
document.querySelectorAll(".device-card[data-device-id]").forEach((card) => {
|
|
63
|
-
const deviceId = card.dataset.deviceId;
|
|
64
|
-
const device = devicesCache.find((d) => d.deviceId === deviceId);
|
|
65
|
-
if (!device) return;
|
|
66
|
-
const el = card.querySelector(".device-online-time");
|
|
67
|
-
if (el) el.textContent = formatDeviceOnlineLabel(device);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
60
|
async function fetchDevices() {
|
|
72
61
|
try {
|
|
73
62
|
const res = await fetch("/devices");
|
|
@@ -136,8 +125,7 @@ function renderDeviceCards() {
|
|
|
136
125
|
const dd = document.createElement("dd");
|
|
137
126
|
if (label === "Device online") {
|
|
138
127
|
dd.className = "device-online-time";
|
|
139
|
-
dd.title =
|
|
140
|
-
"Current time minus this TV last boot time (refreshes every 30 seconds)";
|
|
128
|
+
dd.title = "Current time minus this TV last boot time";
|
|
141
129
|
}
|
|
142
130
|
dd.textContent = value;
|
|
143
131
|
row.appendChild(dt);
|
|
@@ -198,14 +186,11 @@ function renderDeviceCards() {
|
|
|
198
186
|
|
|
199
187
|
function startDevicePolling() {
|
|
200
188
|
if (devicePollTimer) clearInterval(devicePollTimer);
|
|
201
|
-
if (deviceUptimeTimer) clearInterval(deviceUptimeTimer);
|
|
202
189
|
|
|
203
190
|
void fetchDevices();
|
|
204
191
|
devicePollTimer = setInterval(() => {
|
|
205
192
|
void fetchDevices();
|
|
206
193
|
}, 8000);
|
|
207
|
-
|
|
208
|
-
deviceUptimeTimer = setInterval(updateDeviceUptimeLabels, 30_000);
|
|
209
194
|
}
|
|
210
195
|
|
|
211
196
|
function showResult(data) {
|