@tomorrowos/sdk 0.1.5 → 0.1.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomorrowos/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
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.1.
|
|
3
|
+
"version": "0.1.6",
|
|
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.1.
|
|
13
|
+
"@tomorrowos/sdk": "^0.1.6"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/node": "^20.0.0",
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
const PANEL_DEVICE_ID_KEY = "tomorrowos.panel.deviceId";
|
|
2
|
+
|
|
3
|
+
function getPanelDeviceId() {
|
|
4
|
+
return (
|
|
5
|
+
document.getElementById("deviceId")?.value?.trim() ||
|
|
6
|
+
localStorage.getItem(PANEL_DEVICE_ID_KEY) ||
|
|
7
|
+
""
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function setPanelDeviceId(deviceId) {
|
|
12
|
+
const id = String(deviceId || "").trim();
|
|
13
|
+
const el = document.getElementById("deviceId");
|
|
14
|
+
if (el) el.value = id;
|
|
15
|
+
if (id) localStorage.setItem(PANEL_DEVICE_ID_KEY, id);
|
|
16
|
+
else localStorage.removeItem(PANEL_DEVICE_ID_KEY);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
20
|
+
const saved = localStorage.getItem(PANEL_DEVICE_ID_KEY);
|
|
21
|
+
if (saved) setPanelDeviceId(saved);
|
|
22
|
+
});
|
|
23
|
+
|
|
1
24
|
async function verify() {
|
|
2
25
|
const code = document.getElementById("code").value;
|
|
3
26
|
|
|
@@ -12,12 +35,12 @@ async function verify() {
|
|
|
12
35
|
document.getElementById("result").textContent = JSON.stringify(data, null, 2);
|
|
13
36
|
|
|
14
37
|
if (data.deviceId) {
|
|
15
|
-
|
|
38
|
+
setPanelDeviceId(data.deviceId);
|
|
16
39
|
}
|
|
17
40
|
}
|
|
18
41
|
|
|
19
42
|
async function getInfo() {
|
|
20
|
-
const deviceId =
|
|
43
|
+
const deviceId = getPanelDeviceId();
|
|
21
44
|
|
|
22
45
|
if (!deviceId) {
|
|
23
46
|
alert("Please pair a device first.");
|
|
@@ -34,7 +57,7 @@ async function getInfo() {
|
|
|
34
57
|
}
|
|
35
58
|
|
|
36
59
|
async function getCapabilities() {
|
|
37
|
-
const deviceId =
|
|
60
|
+
const deviceId = getPanelDeviceId();
|
|
38
61
|
|
|
39
62
|
if (!deviceId) {
|
|
40
63
|
alert("Please pair a device first.");
|
|
@@ -50,7 +73,7 @@ async function getCapabilities() {
|
|
|
50
73
|
}
|
|
51
74
|
|
|
52
75
|
async function reboot() {
|
|
53
|
-
const deviceId =
|
|
76
|
+
const deviceId = getPanelDeviceId();
|
|
54
77
|
|
|
55
78
|
if (!deviceId) {
|
|
56
79
|
alert("Please pair a device first.");
|
|
@@ -71,7 +94,7 @@ async function reboot() {
|
|
|
71
94
|
}
|
|
72
95
|
|
|
73
96
|
async function setContent() {
|
|
74
|
-
const deviceId =
|
|
97
|
+
const deviceId = getPanelDeviceId();
|
|
75
98
|
const policyJsonText = document.getElementById("policyJson")?.value?.trim();
|
|
76
99
|
|
|
77
100
|
if (!deviceId) {
|
|
@@ -108,7 +131,7 @@ async function setContent() {
|
|
|
108
131
|
}
|
|
109
132
|
|
|
110
133
|
async function clearContent() {
|
|
111
|
-
const deviceId =
|
|
134
|
+
const deviceId = getPanelDeviceId();
|
|
112
135
|
|
|
113
136
|
if (!deviceId) {
|
|
114
137
|
alert("Please pair a device first.");
|