@synopackageland/cli 0.48.7 → 0.48.9

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.
@@ -284,7 +284,10 @@ ${ns}.callOnce = function (method, params, options, requestTimeout, envelope) {
284
284
  var recoveryCanceled;
285
285
  var dispatch = function () { return fetch(${JSON.stringify(cgiUrl(pkg))}, {
286
286
  method: "POST",
287
+ mode: "same-origin",
287
288
  credentials: "same-origin",
289
+ redirect: "error",
290
+ cache: "no-store",
288
291
  headers: headers,
289
292
  body: JSON.stringify(envelope || { method: method, params: params || {} }),
290
293
  signal: controller.signal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.48.7",
3
+ "version": "0.48.9",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
package/skills/SKILL.md CHANGED
@@ -360,6 +360,37 @@ upstreams with a hardcoded base path. Read [reference/identity-gateway.md](refer
360
360
  for reserved paths, install-time ownership checks and unchanged auth policy.
361
361
  Apps requiring `/` cannot use ingress.
362
362
 
363
+ ## HTTPS 與舊 DSM token
364
+
365
+ 不是每個 App 都需要 HTTPS,很多 App 用 HTTP 就夠。一般 CRUD、設定或檔案類
366
+ App 不要預設強制 HTTPS。只有使用 secure context 能力(`getUserMedia`、
367
+ 剪貼簿讀寫、Service Worker、WebCrypto `subtle` 等)、瀏覽器 Extension 或外部
368
+ 裝置配對,或 App 的嚴格 Origin 驗證確實要求 HTTPS 時,才明確啟用限制。
369
+
370
+ 要求 HTTPS 的 App 應回專屬碼 `https_required`,不可混成 `NOT_AUTHENTICATED`
371
+ 或 `session_required`,否則重新登入也無法解決。可選用 Go
372
+ `api.RequireSecureOrigin(request)`;它不取代 session、同源或權限檢查。
373
+ 前端以 `identityCopy(locale).httpsTitle` 和 `errors.https_required` 顯示
374
+ 「需要 HTTPS/請改用 HTTPS」頁,提供重新開啟 App 的說明。
375
+ 只有 `ctx.user?.isAdmin === true` 才呼叫 `readDsmPorts(ctx)`,從 `dms_https`
376
+ 取得實際 HTTPS 埠並提供 DSM 連結;也可用 SDK `readDsmHttpsURL(ctx, location.href)`
377
+ 處理此限制。PortInfo 限管理員,一般使用者呼叫可能被拒或關閉 DSM 視窗;
378
+ 一般使用者只顯示說明文字。查不到埠時不猜測、不阻擋說明頁。
379
+
380
+ 舊 DSM 分頁可能在其他分頁重新登入後繼續帶舊 `X-SYNO-TOKEN`。對明確宣告
381
+ `effect: read` 的一般 JSON RPC,可用 `createClient({sessionRetry: ...})`
382
+ 搭配 `createDsmSession` 的 `refresh(rejectedToken)` 更新 token 後重試一次。
383
+ `sessionRetry.operations` 必須來自 App 可信的 effect 資料並明確標示 `kind`;
384
+ 只有 `kind: rpc` 可重試。寫入、AI、串流、batch 和不明方法均不自動重試,
385
+ 失敗後保留原錯誤。既有 `ctx.call` 不會因 SDK 更新而自動啟用此功能。
386
+ 完整 API 與 opt-in 理由見 SDK 的
387
+ [HTTPS 與 session 恢復指南](https://github.com/synopackageland/syno-pkg-land-sdk/blob/main/docs/https-and-session-recovery.md)。
388
+
389
+ 驗收時分別從 `http://<host>:5000` 與 `https://<host>:5001` 開啟 App(DSM
390
+ 自訂埠改用實際值),各驗管理員與一般使用者;HTTP 應能正常使用,或明確顯示
391
+ HTTPS 要求,不能陷入重登入循環。另驗跨分頁重新登入後的讀取恢復,並確認
392
+ 寫入、AI、串流不重送。
393
+
363
394
  ## Maintaining this CLI
364
395
 
365
396
  For CLI releases, `npm run gates` runs basic build/typecheck, core unit checks,
@@ -15,6 +15,28 @@ I capability: init --with login or add login enables Go-native standalone identi
15
15
 
16
16
  B files needs the current user's DSM session. A jobs processes owner-bound private copies as the package account without administrator setup. Neither App identity nor login alone grants offline File Station access.
17
17
 
18
+ ## HTTPS and stale DSM tokens
19
+
20
+ HTTP is sufficient for many CRUD, settings and file Apps. Require HTTPS only
21
+ when the App needs secure context browser features, pairing or a strict secure
22
+ Origin policy. Return `https_required`, separate from authentication failures,
23
+ and render `identityCopy(locale).httpsTitle` / `errors.https_required` with a
24
+ way to reopen through HTTPS. Go `api.RequireSecureOrigin(request)` is opt-in
25
+ and supplements the existing origin/session/permission checks.
26
+
27
+ Only administrators may call `readDsmPorts(ctx)` to find `dms_https`;
28
+ `readDsmHttpsURL(ctx, location.href)` provides this guard and a DSM link.
29
+ Ordinary users receive instructions only: PortInfo can refuse their session
30
+ or close their DSM window. Never guess a configured port.
31
+
32
+ After another tab signs in, an old page can retain a stale `X-SYNO-TOKEN`.
33
+ `createClient` offers opt-in `sessionRetry` using `createDsmSession.refresh`:
34
+ only trusted `effect: read`, `kind: rpc` entries retry once on `session_required`.
35
+ Writes, AI, streams, batches, unknown methods and other failures never replay.
36
+ This does not automatically wrap the generated `ctx.call`. Read the SDK's
37
+ [API and policy guide](https://github.com/synopackageland/syno-pkg-land-sdk/blob/main/docs/https-and-session-recovery.md)
38
+ and the [main skill's validation guidance](../SKILL.md#https-與舊-dsm-token).
39
+
18
40
 
19
41
  ## Permanent destination integration
20
42