@tomorrowos/sdk 0.1.1 → 0.1.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.
package/README.md CHANGED
@@ -61,6 +61,8 @@ npx tomorrowos build --platform tizen
61
61
 
62
62
  TomorrowOS has no required cloud service. Your CMS talks to your screens over your network.
63
63
 
64
+ **Player branding:** `GET /brand.json` returns the `brand` object passed to `new TomorrowOS({ brand })` (same host/port as `listen`). TomorrowOS players can fetch it to apply `backgroundColor`, logos, etc., without a separate static file server.
65
+
64
66
  ---
65
67
 
66
68
  ## Supported platforms (roadmap)
@@ -18,6 +18,7 @@ export interface ListenOptions {
18
18
  * If set, GET requests serve files from this directory (e.g. CMS UI assets).
19
19
  * `GET /` serves `staticIndex` (default `index.html`) under this root.
20
20
  * WebSocket upgrades on `/` are unchanged.
21
+ * Note: `GET /brand.json` is always served from the `brand` passed to the constructor (not from this folder).
21
22
  */
22
23
  staticRoot?: string;
23
24
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"tomorrowos.d.ts","sourceRoot":"","sources":["../src/tomorrowos.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAKxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,eAAe,CAAC;IACvB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,UAAU,CAA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OAAO,CAAC,mBAAmB;IA6D3B,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC,MAAM;YAgD7B,cAAc;YAmCd,UAAU;YAgDV,gBAAgB;IAgE9B,OAAO,CAAC,gBAAgB;CA8EzB"}
@@ -216,6 +216,12 @@ export class TomorrowOS extends EventEmitter {
216
216
  try {
217
217
  const url = new URL(req.url ?? "/", "http://localhost");
218
218
  const pathname = url.pathname;
219
+ /** Same-origin brand for TomorrowOS players (e.g. GET /brand.json + applyBrand). */
220
+ if (req.method === "GET" && pathname === "/brand.json") {
221
+ res.writeHead(200, { "Content-Type": "application/json; charset=utf-8" });
222
+ res.end(JSON.stringify(this.brand));
223
+ return;
224
+ }
219
225
  if (req.method === "GET" && this.staticRoot) {
220
226
  const served = await this.tryServeStatic(pathname, res);
221
227
  if (served)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomorrowos/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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-tomorrowos-cms",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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.1"
13
+ "@tomorrowos/sdk": "^0.1.2"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@types/node": "^20.0.0",