@synopackageland/cli 0.48.16 → 0.48.18
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/CHANGELOG.md +10 -0
- package/dist/error-registry.js +20 -0
- package/dist/host/catalog-install.d.ts +1 -0
- package/dist/host/catalog-install.js +6 -0
- package/dist/host/compose-project-recovery.d.ts +14 -0
- package/dist/host/compose-project-recovery.js +68 -0
- package/dist/host/container-pull.js +12 -1
- package/dist/host/dsm-client.js +3 -1
- package/dist/host/package-commands.js +4 -0
- package/dist/standalone/inspect-spk.d.ts +1 -0
- package/dist/standalone/inspect-spk.js +1 -0
- package/package.json +1 -1
- package/schema/dsm-api-contract.json +54 -5
- package/skills/SKILL.md +5 -0
- package/skills/reference/identity-gateway.md +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.48.18
|
|
4
|
+
|
|
5
|
+
- Skill documents HTTP/HTTPS handling: HTTP stays allowed with no automatic redirect, `identity_gateway.secure_context: required` for Apps that need a secure context, and upstream OIDC callbacks that follow the request scheme instead of a hard-coded https
|
|
6
|
+
|
|
7
|
+
## 0.48.17
|
|
8
|
+
|
|
9
|
+
- install and repair reclaim a stopped Container Manager project left behind by the same package (exact Compose path ownership) before reinstalling; named volumes, data and images are kept, and foreign or active projects stop the install
|
|
10
|
+
- repair verifies a pinned image already on the NAS by its full digest reference instead of pulling it again
|
|
11
|
+
- Add missing error registry entries and make the test suite pass under both root and non-root accounts
|
|
12
|
+
|
|
3
13
|
## 0.48.16
|
|
4
14
|
|
|
5
15
|
- install and deploy repair a broken package at its installed version with an in-place reinstall that keeps App data; healthy packages at the same version stay unchanged
|
package/dist/error-registry.js
CHANGED
|
@@ -332,6 +332,26 @@ export const ERROR_REGISTRY = {
|
|
|
332
332
|
description: "The package daemon declaration does not match the fixed argv, environment and lifecycle contract.",
|
|
333
333
|
suggestion: "Check daemon.exec, the per-architecture targets, args, env, uninstall_args and integer-second timeouts; remove shell, user and custom conf.",
|
|
334
334
|
},
|
|
335
|
+
STANDALONE_DAEMON_NOFILE_INVALID: {
|
|
336
|
+
code: "STANDALONE_DAEMON_NOFILE_INVALID",
|
|
337
|
+
description: "The daemon file-descriptor limit or package account is invalid.",
|
|
338
|
+
suggestion: "Use an integer daemon.nofile from 1024 to 1048576 and a valid non-root package ID; new builds currently require omitting daemon.nofile because activation is unsupported.",
|
|
339
|
+
},
|
|
340
|
+
STANDALONE_DAEMON_NOFILE_DSM_REQUIRED: {
|
|
341
|
+
code: "STANDALONE_DAEMON_NOFILE_DSM_REQUIRED",
|
|
342
|
+
description: "The declared DSM minimum does not support the daemon file-descriptor limit contract.",
|
|
343
|
+
suggestion: "Remove daemon.nofile; the legacy contract requires DSM 7.0-40761 or later and new builds currently reject activation.",
|
|
344
|
+
},
|
|
345
|
+
STANDALONE_DAEMON_NOFILE_SDK_REQUIRED: {
|
|
346
|
+
code: "STANDALONE_DAEMON_NOFILE_SDK_REQUIRED",
|
|
347
|
+
description: "The selected SDK version does not support the daemon file-descriptor limit contract.",
|
|
348
|
+
suggestion: "Remove daemon.nofile; the legacy contract requires SDK 0.49.5 or later and new builds currently reject activation.",
|
|
349
|
+
},
|
|
350
|
+
CTL_COMMAND_UNREGISTERED: {
|
|
351
|
+
code: "CTL_COMMAND_UNREGISTERED",
|
|
352
|
+
description: "A ctl command references a method that is absent from the RPC registry.",
|
|
353
|
+
suggestion: "Reference a registered RPC method in ctl commands; raw HTTP routes cannot be used as RPC methods.",
|
|
354
|
+
},
|
|
335
355
|
STANDALONE_DAEMON_RESTART_INVALID: {
|
|
336
356
|
code: "STANDALONE_DAEMON_RESTART_INVALID",
|
|
337
357
|
description: "daemon.restart does not match the bounded native crash-recovery policy.",
|
|
@@ -2,6 +2,7 @@ import { CtlError } from '../ctl/errors.js';
|
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import { progressReporter } from '../terminal-output.js';
|
|
4
4
|
import { pullContainerImages } from './container-pull.js';
|
|
5
|
+
import { reclaimOwnedComposeProject } from './compose-project-recovery.js';
|
|
5
6
|
import { savePullFailure } from './package-diagnostics.js';
|
|
6
7
|
import { readPackageOperation, operationOwnerAlive, savePackageOperation, clearPackageOperation, releasePackageOperation } from './package-operation.js';
|
|
7
8
|
import { cancelableInstall, installDelay, installWorkload, installCanceled } from './install-control.js';
|
|
@@ -496,6 +497,11 @@ export async function installPackageFromLocalSpk(options) {
|
|
|
496
497
|
if (before.state || before.installed === null ||
|
|
497
498
|
(options.repair && readPackageOperation(options.dsmOrigin, options.packageId)))
|
|
498
499
|
throw new CtlError('PACKAGE_BUSY', `Package ${options.packageId} already has an unresolved operation`, 'Check package status before installing again');
|
|
500
|
+
if (options.composeProject) {
|
|
501
|
+
phase = 'checking Compose project ownership';
|
|
502
|
+
await reclaimOwnedComposeProject({ ...options, projectName: options.composeProject,
|
|
503
|
+
reclaim: !before.installed || packageIsBroken(before), onProgress: progress });
|
|
504
|
+
}
|
|
499
505
|
if (options.containerImages?.length) {
|
|
500
506
|
phase = 'pulling container images';
|
|
501
507
|
try {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface RecoveryOptions {
|
|
2
|
+
dsmOrigin: string;
|
|
3
|
+
cookieHeader: string;
|
|
4
|
+
packageId: string;
|
|
5
|
+
/** Project name from the inspected SDK Compose plan. */
|
|
6
|
+
projectName: string;
|
|
7
|
+
/** Healthy upgrades retain the worker's existing registration. */
|
|
8
|
+
reclaim: boolean;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
onProgress?: (message: string) => void;
|
|
11
|
+
}
|
|
12
|
+
/** Administrator-side only. App hooks never receive this session or Docker access. */
|
|
13
|
+
export declare function reclaimOwnedComposeProject(options: RecoveryOptions): Promise<void>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { CtlError } from '../ctl/errors.js';
|
|
2
|
+
import { dsmFetch } from './dsm-http.js';
|
|
3
|
+
import { dsmOperationTimeoutMs, dsmRequestTimeoutMs } from '../nas/timeouts.js';
|
|
4
|
+
const record = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
5
|
+
const hint = 'Check this App in Container Manager. Resolve a foreign same-name project without deleting it. For an owned stopped project, preserve volumes, files and images when removing its registration, then repair this App again.';
|
|
6
|
+
const fail = (code, message) => new CtlError(code, message, hint);
|
|
7
|
+
/** Administrator-side only. App hooks never receive this session or Docker access. */
|
|
8
|
+
export async function reclaimOwnedComposeProject(options) {
|
|
9
|
+
const { packageId, projectName } = options;
|
|
10
|
+
if (!/^[A-Za-z][A-Za-z0-9_]*$/.test(packageId) || !/^[a-z0-9][a-z0-9_-]*$/.test(projectName))
|
|
11
|
+
throw fail('COMPOSE_PROJECT_INVALID', 'Invalid inspected Compose project identity');
|
|
12
|
+
const call = async (api, method, params = {}, version = 1) => {
|
|
13
|
+
const response = await dsmFetch(`${options.dsmOrigin}/webapi/entry.cgi`, {
|
|
14
|
+
method: 'POST', headers: { cookie: options.cookieHeader, 'content-type': 'application/x-www-form-urlencoded' }, signal: options.signal,
|
|
15
|
+
body: new URLSearchParams({ api, method, version: String(version), ...Object.fromEntries(Object.entries(params).map(([k, v]) => [k, JSON.stringify(v)])) }),
|
|
16
|
+
}, method === 'delete' ? dsmOperationTimeoutMs() : dsmRequestTimeoutMs());
|
|
17
|
+
const body = await response.json();
|
|
18
|
+
if (!response.ok || body?.success !== true)
|
|
19
|
+
throw fail('COMPOSE_PROJECT_RECOVERY_FAILED', `Container Manager ${method} failed (DSM ${Number(body?.error?.code) || 'unknown'}); no install request was sent`);
|
|
20
|
+
return body.data;
|
|
21
|
+
};
|
|
22
|
+
const inventory = async () => {
|
|
23
|
+
const data = await call('SYNO.Docker.Project', 'list');
|
|
24
|
+
if (!record(data) || Object.entries(data).some(([id, p]) => !record(p) || p.id !== id || typeof p.name !== 'string'))
|
|
25
|
+
throw fail('COMPOSE_PROJECT_INVENTORY_INVALID', 'Cannot verify Container Manager project inventory');
|
|
26
|
+
return Object.values(data);
|
|
27
|
+
};
|
|
28
|
+
const matches = (projects) => projects.filter(p => p.name === projectName);
|
|
29
|
+
const owned = (p) => p.is_package === true && typeof p.path === 'string' &&
|
|
30
|
+
(p.path === `/var/packages/${packageId}/target/compose` || new RegExp(`^/volume[1-9][0-9]*/@appstore/${packageId}/compose$`).test(p.path)) &&
|
|
31
|
+
(p.package_name === undefined || p.package_name === '' || p.package_name === packageId);
|
|
32
|
+
const stopped = (p) => ['STOPPED', 'CREATED'].includes(String(p.status)) &&
|
|
33
|
+
(p.state === '' || p.state === undefined) && Array.isArray(p.containerIds) && p.containerIds.every(id => typeof id === 'string');
|
|
34
|
+
const found = matches(await inventory());
|
|
35
|
+
if (!found.length)
|
|
36
|
+
return;
|
|
37
|
+
if (found.length !== 1 || !owned(found[0]))
|
|
38
|
+
throw fail('COMPOSE_PROJECT_CONFLICT', `Container Manager project ${projectName} cannot be proved to belong to ${packageId}; it was left untouched`);
|
|
39
|
+
if (!options.reclaim)
|
|
40
|
+
return;
|
|
41
|
+
const project = found[0];
|
|
42
|
+
if (!stopped(project))
|
|
43
|
+
throw fail('COMPOSE_PROJECT_NOT_STOPPED', `Stop the owned Container Manager project ${projectName} before repairing this App`);
|
|
44
|
+
// Older Docker forces --rmi all even when rmi=false. Unknown versions stay closed.
|
|
45
|
+
const packages = await call('SYNO.Core.Package', 'list', { additional: ['status'], ignore_hidden: false }, 2);
|
|
46
|
+
const manager = Array.isArray(packages?.packages) ? packages.packages.find((p) => p?.id === 'ContainerManager') : undefined;
|
|
47
|
+
if (typeof manager?.version !== 'string' || !/^24\.0\.2-\d+$/.test(manager.version))
|
|
48
|
+
throw fail('COMPOSE_PROJECT_RECOVERY_UNSUPPORTED', 'Automatic project recovery requires the verified Container Manager 24.0.2 image-preserving delete contract');
|
|
49
|
+
// Summary metadata proves ownership even when get/Detail cannot read the old
|
|
50
|
+
// definition (2105). Never rewrite Compose content or use get as a delete fallback.
|
|
51
|
+
const current = matches(await inventory());
|
|
52
|
+
if (current.length !== 1 || current[0].id !== project.id || !owned(current[0]) || !stopped(current[0]) ||
|
|
53
|
+
JSON.stringify(current[0].containerIds) !== JSON.stringify(project.containerIds))
|
|
54
|
+
throw fail('COMPOSE_PROJECT_CHANGED', 'Compose project changed during recovery; it was left untouched');
|
|
55
|
+
options.onProgress?.(`Recovering this App's stopped Compose project ${projectName}; retaining volumes, files and images…`);
|
|
56
|
+
try {
|
|
57
|
+
// Native delete can remove stopped containers/networks. These flags forbid
|
|
58
|
+
// named-volume and image deletion; no filesystem deletion API is called.
|
|
59
|
+
await call('SYNO.Docker.Project', 'delete', { id: project.id, volumes: false, rmi: false });
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
// Never replay a mutation with an uncertain outcome.
|
|
63
|
+
throw fail('COMPOSE_PROJECT_RECOVERY_FAILED', `${error instanceof CtlError && error.code === 'COMPOSE_PROJECT_RECOVERY_FAILED' ? error.message + '. ' : ''}Project removal did not confirm success; check Container Manager before retrying. No install request was sent`);
|
|
64
|
+
}
|
|
65
|
+
const remaining = await inventory();
|
|
66
|
+
if (remaining.some(p => p.id === project.id) || matches(remaining).length)
|
|
67
|
+
throw fail('COMPOSE_PROJECT_RECOVERY_FAILED', 'Project removal readback did not confirm the name is available; no install request was sent');
|
|
68
|
+
}
|
|
@@ -42,13 +42,15 @@ export async function pullContainerImages(options) {
|
|
|
42
42
|
throw fail('CONTAINER_PULL_STALLED', `no download progress for ${stallMs / 1000} seconds; NAS pull may still be running`);
|
|
43
43
|
return Math.max(1, Math.min(dsmRequestTimeoutMs(), deadline - Date.now(), stallMs - (Date.now() - lastAdvance)));
|
|
44
44
|
};
|
|
45
|
-
const call = async (method, params) => {
|
|
45
|
+
const call = async (method, params, missingImageOK = false) => {
|
|
46
46
|
const response = await dsmFetch(`${options.dsmOrigin}/webapi/entry.cgi`, {
|
|
47
47
|
method: 'POST', headers: { cookie: options.cookieHeader, 'content-type': 'application/x-www-form-urlencoded' },
|
|
48
48
|
signal: options.signal,
|
|
49
49
|
body: new URLSearchParams({ api: 'SYNO.Docker.Image', version: '1', method, ...params }),
|
|
50
50
|
}, remaining());
|
|
51
51
|
const body = await response.json();
|
|
52
|
+
if (response.ok && body?.success === false && missingImageOK && body.error?.code === 1202)
|
|
53
|
+
return undefined;
|
|
52
54
|
if (!response.ok || body?.success !== true) {
|
|
53
55
|
const error = body?.error;
|
|
54
56
|
throw fail('CONTAINER_PULL_FAILED', `Container Manager ${method}: HTTP ${response.status}, DSM ${error?.code ?? 'unknown'} ${typeof error?.description === 'string' ? error.description : ''}; cause unknown if not supplied by DSM`);
|
|
@@ -69,6 +71,15 @@ export async function pullContainerImages(options) {
|
|
|
69
71
|
progress(`${context}: pinned digest already present on NAS; no registry pull needed`);
|
|
70
72
|
continue;
|
|
71
73
|
}
|
|
74
|
+
// CM can omit digest from list. Ask the daemon to resolve the exact
|
|
75
|
+
// repository@manifest reference, never a config ID or remote update digest.
|
|
76
|
+
const detail = await call('get', { identity: JSON.stringify(image) }, true);
|
|
77
|
+
if (detail !== undefined) {
|
|
78
|
+
if (typeof detail?.id !== 'string' || !/^sha256:[a-f0-9]{64}$/.test(detail.id))
|
|
79
|
+
throw fail('CONTAINER_PULL_FAILED', 'invalid exact-reference image inspection');
|
|
80
|
+
progress(`${context}: pinned reference verified on NAS; no registry pull needed`);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
72
83
|
}
|
|
73
84
|
let task;
|
|
74
85
|
try {
|
package/dist/host/dsm-client.js
CHANGED
|
@@ -116,6 +116,7 @@ function createDsmNasHost(credentials, profileName) {
|
|
|
116
116
|
const members = await call('SYNO.Core.Group.Member', 'list', 1, { group: 'administrators', offset: '0', limit: '-1' });
|
|
117
117
|
if (!Array.isArray(members.data?.users) || !members.data.users.some((u) => u.name === credentials.username))
|
|
118
118
|
throw new CtlError('NAS_ADMIN_REQUIRED', 'Package installation requires a DSM administrator account', 'Log in with a DSM administrator account', 4);
|
|
119
|
+
const inspected = await inspectAnySpk(input.spkPath);
|
|
119
120
|
await installPackageFromLocalSpk({
|
|
120
121
|
dsmOrigin,
|
|
121
122
|
cookieHeader: cookieHeader ?? "",
|
|
@@ -124,7 +125,8 @@ function createDsmNasHost(credentials, profileName) {
|
|
|
124
125
|
version: input.version,
|
|
125
126
|
profileName,
|
|
126
127
|
extraValues: input.extraValues,
|
|
127
|
-
containerImages: containerImageReferences(
|
|
128
|
+
containerImages: containerImageReferences(inspected),
|
|
129
|
+
composeProject: inspected.compose?.projectName,
|
|
128
130
|
});
|
|
129
131
|
},
|
|
130
132
|
async getExecutorStatus(packageIdentity) {
|
|
@@ -165,6 +165,7 @@ export async function installPackage(spec, options = {}, connection) {
|
|
|
165
165
|
// Download, verify and inspect the entire plan before the first NAS write.
|
|
166
166
|
const files = new Map();
|
|
167
167
|
const images = new Map();
|
|
168
|
+
const composeProjects = new Map();
|
|
168
169
|
for (const entry of changes) {
|
|
169
170
|
let file = localFile;
|
|
170
171
|
if (!local || entry.package !== root.package) {
|
|
@@ -183,6 +184,8 @@ export async function installPackage(spec, options = {}, connection) {
|
|
|
183
184
|
throw fail("PACKAGE_IDENTITY_MISMATCH", "Downloaded SPK identity differs from the selected release");
|
|
184
185
|
files.set(entry.package, file);
|
|
185
186
|
images.set(entry.package, containerImageReferences(checked));
|
|
187
|
+
if (checked.compose?.projectName)
|
|
188
|
+
composeProjects.set(entry.package, checked.compose.projectName);
|
|
186
189
|
}
|
|
187
190
|
let completed;
|
|
188
191
|
for (const entry of changes) {
|
|
@@ -194,6 +197,7 @@ export async function installPackage(spec, options = {}, connection) {
|
|
|
194
197
|
spkPath: files.get(entry.package),
|
|
195
198
|
repair: actionFor(entry) === "repair",
|
|
196
199
|
containerImages: images.get(entry.package),
|
|
200
|
+
composeProject: composeProjects.get(entry.package),
|
|
197
201
|
extraValues: entry.package === root.package ? options.param : undefined,
|
|
198
202
|
});
|
|
199
203
|
if (entry.package === root.package)
|
|
@@ -901,6 +901,7 @@ async function inspectUnifiedCompose(dir, payload, metadata, findings) {
|
|
|
901
901
|
if (storageProblem)
|
|
902
902
|
throw new Error(`[${storageProblem.code}] ${storageProblem.message}`);
|
|
903
903
|
base.compose = {
|
|
904
|
+
projectName: c.plan.project_name,
|
|
904
905
|
...(c.plan.host_udp?.length ? { hostUdp: c.plan.host_udp } : {}),
|
|
905
906
|
...(c.plan.devices ? { devices: c.plan.devices } : {}),
|
|
906
907
|
...(c.plan.ingress ? { ingress: c.plan.ingress } : {}),
|
package/package.json
CHANGED
|
@@ -1059,6 +1059,54 @@
|
|
|
1059
1059
|
"standalone/root-window.ts"
|
|
1060
1060
|
],
|
|
1061
1061
|
"hubConfirmed": []
|
|
1062
|
+
},
|
|
1063
|
+
{
|
|
1064
|
+
"api": "SYNO.Docker.Project",
|
|
1065
|
+
"method": "list",
|
|
1066
|
+
"version": 1,
|
|
1067
|
+
"dsm": {
|
|
1068
|
+
"7.2": "unverified",
|
|
1069
|
+
"7.3": "unverified",
|
|
1070
|
+
"7.4": "unverified"
|
|
1071
|
+
},
|
|
1072
|
+
"parameters": {},
|
|
1073
|
+
"sources": [
|
|
1074
|
+
"host/compose-project-recovery.ts"
|
|
1075
|
+
]
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
"api": "SYNO.Docker.Project",
|
|
1079
|
+
"method": "delete",
|
|
1080
|
+
"version": 1,
|
|
1081
|
+
"dsm": {
|
|
1082
|
+
"7.2": "unverified",
|
|
1083
|
+
"7.3": "unverified",
|
|
1084
|
+
"7.4": "unverified"
|
|
1085
|
+
},
|
|
1086
|
+
"parameters": {
|
|
1087
|
+
"id": {},
|
|
1088
|
+
"volumes": {},
|
|
1089
|
+
"rmi": {}
|
|
1090
|
+
},
|
|
1091
|
+
"sources": [
|
|
1092
|
+
"host/compose-project-recovery.ts"
|
|
1093
|
+
]
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
"api": "SYNO.Docker.Image",
|
|
1097
|
+
"method": "get",
|
|
1098
|
+
"version": 1,
|
|
1099
|
+
"dsm": {
|
|
1100
|
+
"7.2": "unverified",
|
|
1101
|
+
"7.3": "unverified",
|
|
1102
|
+
"7.4": "confirmed"
|
|
1103
|
+
},
|
|
1104
|
+
"parameters": {
|
|
1105
|
+
"identity": {}
|
|
1106
|
+
},
|
|
1107
|
+
"sources": [
|
|
1108
|
+
"host/container-pull.ts"
|
|
1109
|
+
]
|
|
1062
1110
|
}
|
|
1063
1111
|
],
|
|
1064
1112
|
"sourceAudit": {
|
|
@@ -1075,13 +1123,14 @@
|
|
|
1075
1123
|
"deploy/spk-version.ts": "407a79491ffac8d00ecb9b056ab0b352e08bf6142871fa46f302fd217f98fc24",
|
|
1076
1124
|
"e2e/certificates.ts": "e9801e5f4d326d31c3c281e5106f34138493e26cd7f0ad2b1dd3f6a566832389",
|
|
1077
1125
|
"e2e/dsm.ts": "407fa489a7fa44a5fa851e4acc019acec582dd3bb02fa4f0e4c6f2f82d1d92da",
|
|
1078
|
-
"error-registry.ts": "
|
|
1079
|
-
"host/catalog-install.ts": "
|
|
1080
|
-
"host/
|
|
1081
|
-
"host/
|
|
1126
|
+
"error-registry.ts": "4c34a6e4c229ddc067a8ca9344cdd52b64a9a6352570600657260d6a55967125",
|
|
1127
|
+
"host/catalog-install.ts": "df27409d835a901658dae7c2048c9028c2dc886e17575fe9189e88ae705c0fd2",
|
|
1128
|
+
"host/compose-project-recovery.ts": "c76efa505f8ba14f50a8705b63d0f9f8a022b70505fe6a5f5976146afae17532",
|
|
1129
|
+
"host/container-pull.ts": "d85314dd265f7609ab1fda87e23cce0fa81165baeeaf79a792d7bb6dc10338e3",
|
|
1130
|
+
"host/dsm-client.ts": "52c34d520154e43d823a64dbb0ff7f3ae40e427fb835a5136ab6d847827a4b7a",
|
|
1082
1131
|
"host/dsm-compound.ts": "5674b6f11d2b36a86a97ac7edf590abb34bd72f441c1f43ab057a43cfb5d7e88",
|
|
1083
1132
|
"host/dsm-port-profile.ts": "9ebd06bbbc918267ef2d8a4ff9737b9d35579e45224dd4de362389921446ae8d",
|
|
1084
|
-
"host/package-commands.ts": "
|
|
1133
|
+
"host/package-commands.ts": "ba1debaee82b19f310efe59eb0692a6495282e0e5e2ac2b474a8b85465eadafc",
|
|
1085
1134
|
"host/port-info-lookup.ts": "b7af19dd8194bc424eb2100ce5953cf0737e8158da373e93b66627c6a7028c8e",
|
|
1086
1135
|
"host/port-info.ts": "9ab70c37860df681bee70039aebda9ad974fbd2e200fc2741daf9aacf7943905",
|
|
1087
1136
|
"host/share-lookup.ts": "c158baffc774cb7b5b36a82b633bc48f7b8522f67972ef09ab1a15a8b4609196",
|
package/skills/SKILL.md
CHANGED
|
@@ -385,6 +385,11 @@ App 不要預設強制 HTTPS。只有使用 secure context 能力(`getUserMedi
|
|
|
385
385
|
fragment 不保留。PortInfo 限管理員,一般使用者呼叫可能被拒或關閉 DSM 視窗;
|
|
386
386
|
一般使用者只顯示說明文字。查不到埠時不猜測、不阻擋說明頁。
|
|
387
387
|
|
|
388
|
+
HTTP 允許,不做自動 HTTP→HTTPS 轉址或自製轉址頁。identity gateway App 需要
|
|
389
|
+
secure context 時宣告 `identity_gateway.secure_context: required`;上游 OIDC
|
|
390
|
+
callback 必須跟隨實際請求的 scheme,不可在上游設定寫死 https。細節見
|
|
391
|
+
[identity-gateway.md](reference/identity-gateway.md) 的「HTTP, HTTPS and redirects」。
|
|
392
|
+
|
|
388
393
|
舊 DSM 分頁可能在其他分頁重新登入後繼續帶舊 `X-SYNO-TOKEN`。對明確宣告
|
|
389
394
|
`effect: read` 的一般 JSON RPC,可用 `createClient({sessionRetry: ...})`
|
|
390
395
|
搭配 `createDsmSession` 的 `refresh(rejectedToken)` 更新 token 後重試一次。
|
|
@@ -90,6 +90,28 @@ also apply: Cloudflare edge enforces the zone's upload limit, and long
|
|
|
90
90
|
responses need heartbeats within 60 seconds; use SSE or
|
|
91
91
|
`Cache-Control: no-transform` for streaming.
|
|
92
92
|
|
|
93
|
+
## HTTP, HTTPS and redirects
|
|
94
|
+
|
|
95
|
+
HTTP is allowed. Do not add an automatic HTTP→HTTPS redirect, a custom
|
|
96
|
+
redirect page or a forced-HTTPS upstream setting. The gateway shows the
|
|
97
|
+
existing HTTP warning; HTTPS behavior is unchanged.
|
|
98
|
+
|
|
99
|
+
Declare `identity_gateway.secure_context: required` only when the App truly
|
|
100
|
+
needs a secure context (WebCrypto `subtle`, `getUserMedia`, Service Worker,
|
|
101
|
+
clipboard, strict upstream Origin checks). It works for Compose and standalone
|
|
102
|
+
gateways; any value other than `required` fails `check`. HTTP top-level
|
|
103
|
+
navigations then get a localized HTTPS-required page with a user-operated
|
|
104
|
+
"Open using HTTPS" link and no automatic redirect; HTTP API, resource and
|
|
105
|
+
iframe requests get 403 `https_required`. The HTTPS port comes from DSM's own
|
|
106
|
+
declaration; when none is found, the page shows text guidance and never
|
|
107
|
+
guesses a port. See the CLI's `docs/path-ingress.md`.
|
|
108
|
+
|
|
109
|
+
Upstream OIDC callbacks and generated absolute URLs must follow the scheme of
|
|
110
|
+
the actual request. Never hard-code `https` in upstream settings (for example a
|
|
111
|
+
scheme override or a default-protocol variable set to https): sign-in over HTTP
|
|
112
|
+
then fails with a redirect_uri mismatch. Let upstream detect HTTPS through its
|
|
113
|
+
trusted proxy header instead. Test sign-in over both HTTP and HTTPS.
|
|
114
|
+
|
|
93
115
|
## Per-request OIDC browser origins (development)
|
|
94
116
|
|
|
95
117
|
`oidc.browser_redirect: {}` opts into per-request browser origins for SDK/CLI
|