@synopackageland/cli 0.54.7 → 0.54.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.
- package/CHANGELOG.md +10 -0
- package/README.md +20 -0
- package/dist/build-spk/wizard-messages.d.ts +11 -0
- package/dist/build-spk/wizard-messages.js +11 -0
- package/dist/native-http-schema/source.json +1 -1
- package/dist/runtime/sdk-source.d.ts +1 -1
- package/dist/runtime/sdk-source.js +1 -1
- package/dist/standalone/compose.d.ts +1 -4
- package/dist/standalone/identity-gateway.d.ts +10 -0
- package/dist/standalone/identity-gateway.js +48 -2
- package/dist/standalone/inspect-spk.js +26 -4
- package/dist/standalone/install-ports.d.ts +5 -6
- package/dist/standalone/install-ports.js +10 -3
- package/dist/standalone/manifest.js +8 -2
- package/dist/standalone/native-gateway.d.ts +5 -1
- package/dist/standalone/native-gateway.js +31 -8
- package/dist/standalone/short-paths.d.ts +22 -0
- package/dist/standalone/short-paths.js +45 -1
- package/dist/standalone/spk.js +12 -3
- package/docs/install-ports.md +27 -12
- package/docs/path-ingress.md +59 -0
- package/package.json +1 -1
- package/schema/identity-gateway.v1.schema.json +17 -0
- package/skills/reference/identity-gateway.md +9 -0
- package/skills/reference/install.md +2 -2
- package/skills/reference/ui-vue.md +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.54.9 (2026-11-18)
|
|
4
|
+
|
|
5
|
+
- Use SDK 0.53.51 by default.
|
|
6
|
+
- `identity_gateway.origin` adds a second, administrator-only browser origin to a path-ingress App: an HTTPS port (`https`, default for the installer port `gateway_origin`) served by DSM's nginx through a `server` block (`sso/native-origin-nginx.conf`) and the gateway's separate mutually authenticated socket, forwarded to a package Unix socket (`upstream`). Optional `cookies: dsm-passthrough` forwards the upstream's own DSM cookies except `id`/`did`; optional `headers` sends the administrator. It needs `install.ports: true`, DSM 7.2-64570 and an SDK with `OriginVersion`. A port conflict on this port only warns. `inspect` replays the server block and the gateway origin.
|
|
7
|
+
|
|
8
|
+
## 0.54.8 (2026-11-18)
|
|
9
|
+
|
|
10
|
+
- Use SDK 0.53.50 by default.
|
|
11
|
+
- A short path keeps its address: `https://<nas>:5001/m` stays `/m` in the address bar instead of becoming `/webman/3rdparty/<package>/app/<build>/m/index.html`. The redirect now puts `spl-short=<path>` first in the query; the build puts a small script first in the `<head>` of each `.html` stable page a short path opens (before the UI digest), which adds `<base href>` with the page's real URL and replaces the address with the short path, keeping the rest of the query and the fragment. A short path to `app` is handled by the SDK's entry boot. Reload, bookmarks and Add to Home Screen open the short path, and therefore the current build; the stable page and build URLs keep working and keep their own address. A short path to `app` needs the App's frontend `@synopackageland/sdk` 0.53.50 or later; an older one keeps the marker in the query.
|
|
12
|
+
|
|
3
13
|
## 0.54.7 (2026-11-17)
|
|
4
14
|
|
|
5
15
|
- App metadata accepts `screenshots_mobile`, a list of phone screenshots under the same rules as `screenshots` (at most 5 `https://` PNG or JPG URLs). `screenshots` stays the desktop list. The App page on synopkgland.com shows phone screenshots under a Mobile tab; DSM Package Center shows only `screenshots`.
|
package/README.md
CHANGED
|
@@ -487,6 +487,26 @@ App's short path returns DSM's 404, and an upgrade replaces the file. With
|
|
|
487
487
|
`portal`, short paths still stay on DSM's server only: their target,
|
|
488
488
|
`/webman/3rdparty/`, is not served on 80/443.
|
|
489
489
|
|
|
490
|
+
The address bar keeps the short path. The redirect puts `spl-short=<path>`
|
|
491
|
+
first in the query (`/connect` → `…/m/index.html?spl-short=connect&<query>`).
|
|
492
|
+
For a stable page whose target is an `.html` file, the build puts a small
|
|
493
|
+
script first in the target's `<head>` (after the page's own `<base>`, if it
|
|
494
|
+
has one), before the UI digest. On a page with the marker of one of its
|
|
495
|
+
declared paths, the script adds `<base href>` with the page's real URL, so
|
|
496
|
+
relative scripts, styles, images, `fetch` and Expo/Vite chunk URLs keep
|
|
497
|
+
resolving in the build folder, then `history.replaceState` shows
|
|
498
|
+
`/connect?<query>#<fragment>`. A reload, a bookmark or iOS Add to Home Screen
|
|
499
|
+
therefore opens the short path again and lands on the current build. A short
|
|
500
|
+
path to `app` does the same in the SDK's entry boot, which also keeps it
|
|
501
|
+
across a DSM sign-in in the same tab. A page opened without the marker (the
|
|
502
|
+
stable page or build URL itself, an Application Portal domain or port) keeps
|
|
503
|
+
its URL, and the long URLs keep working. Code that reads `location.pathname`
|
|
504
|
+
sees the short path: derive package URLs from `document.baseURI` or a
|
|
505
|
+
relative URL instead. With the `<base>`, a link that is only a fragment
|
|
506
|
+
(`href="#top"`) resolves to the page's real URL and reloads it there. A Web
|
|
507
|
+
App Manifest's `start_url` stays the App's own; Android Chrome's install uses
|
|
508
|
+
it, not the address bar.
|
|
509
|
+
|
|
490
510
|
`check` refuses the root, DSM and SDK names (the reserved list of custom ingress,
|
|
491
511
|
including `/mobile`, `/webman`, `/webapi`, `/sharing` and `/synopkgland`), a
|
|
492
512
|
path that overlaps the package's own ingress, an undeclared page
|
|
@@ -65,6 +65,17 @@ export declare const WIZARD_MESSAGES: {
|
|
|
65
65
|
es: string;
|
|
66
66
|
it: string;
|
|
67
67
|
};
|
|
68
|
+
"ports.origin": {
|
|
69
|
+
en: string;
|
|
70
|
+
"zh-TW": string;
|
|
71
|
+
"zh-CN": string;
|
|
72
|
+
ja: string;
|
|
73
|
+
ko: string;
|
|
74
|
+
de: string;
|
|
75
|
+
fr: string;
|
|
76
|
+
es: string;
|
|
77
|
+
it: string;
|
|
78
|
+
};
|
|
68
79
|
"ports.signin": {
|
|
69
80
|
en: string;
|
|
70
81
|
"zh-TW": string;
|
|
@@ -65,6 +65,17 @@ export const WIZARD_MESSAGES = {
|
|
|
65
65
|
"es": "Puerto HTTPS",
|
|
66
66
|
"it": "Porta HTTPS"
|
|
67
67
|
},
|
|
68
|
+
"ports.origin": {
|
|
69
|
+
"en": "Dedicated HTTPS port",
|
|
70
|
+
"zh-TW": "專用 HTTPS 連接埠",
|
|
71
|
+
"zh-CN": "专用 HTTPS 端口",
|
|
72
|
+
"ja": "専用 HTTPS ポート",
|
|
73
|
+
"ko": "전용 HTTPS 포트",
|
|
74
|
+
"de": "Eigener HTTPS-Port",
|
|
75
|
+
"fr": "Port HTTPS dédié",
|
|
76
|
+
"es": "Puerto HTTPS dedicado",
|
|
77
|
+
"it": "Porta HTTPS dedicata"
|
|
78
|
+
},
|
|
68
79
|
"ports.signin": {
|
|
69
80
|
"en": "Local sign-in port",
|
|
70
81
|
"zh-TW": "本機登入連接埠",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"module":"github.com/synopackageland/syno-pkg-land-sdk","version":"0.53.
|
|
1
|
+
{"module":"github.com/synopackageland/syno-pkg-land-sdk","version":"0.53.51","local":false}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { goPrivateCovers } from './go-env.js';
|
|
2
2
|
import { type ExecutorManifest } from './sdk-executor-manifest.js';
|
|
3
3
|
/** Pinned SDK for CLI-owned controllers and Compose planning; App pins take precedence. */
|
|
4
|
-
export declare const DEFAULT_SDK_VERSION = "0.53.
|
|
4
|
+
export declare const DEFAULT_SDK_VERSION = "0.53.51";
|
|
5
5
|
export declare const SDK_PACKAGE = "@synopackageland/sdk";
|
|
6
6
|
export declare const SDK_MODULE = "github.com/synopackageland/syno-pkg-land-sdk";
|
|
7
7
|
export declare const EXECUTOR_MODULE = "github.com/synopackageland/syno-pkg-land-sdk/executor";
|
|
@@ -5,7 +5,7 @@ import { tmpdir } from 'node:os';
|
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { readExecutorManifest, predatesExecutorManifest } from './sdk-executor-manifest.js';
|
|
7
7
|
/** Pinned SDK for CLI-owned controllers and Compose planning; App pins take precedence. */
|
|
8
|
-
export const DEFAULT_SDK_VERSION = '0.53.
|
|
8
|
+
export const DEFAULT_SDK_VERSION = '0.53.51';
|
|
9
9
|
export const SDK_PACKAGE = '@synopackageland/sdk';
|
|
10
10
|
export const SDK_MODULE = 'github.com/synopackageland/syno-pkg-land-sdk';
|
|
11
11
|
export const EXECUTOR_MODULE = `${SDK_MODULE}/executor`;
|
|
@@ -115,10 +115,7 @@ export declare function composeManifestContext(m: Pick<StandaloneManifest, 'iden
|
|
|
115
115
|
composeMounts: true | undefined;
|
|
116
116
|
sharedFolder: SharedFolder | undefined;
|
|
117
117
|
installSettings: InstallSettings | undefined;
|
|
118
|
-
installPorts: Record<string,
|
|
119
|
-
default: number;
|
|
120
|
-
protocol: "tcp";
|
|
121
|
-
}> | undefined;
|
|
118
|
+
installPorts: Record<string, import("./install-ports.js").PortDefinition> | undefined;
|
|
122
119
|
};
|
|
123
120
|
export declare function readComposeApp(value: unknown, root: string, arches: NativeArchFamily[], fail: (e: StandaloneError) => void, context?: {
|
|
124
121
|
package?: string;
|
|
@@ -102,6 +102,16 @@ export interface IdentityGateway {
|
|
|
102
102
|
account?: {
|
|
103
103
|
on_delete: DeleteAction[];
|
|
104
104
|
};
|
|
105
|
+
/** A second, administrator-only HTTPS origin on its own installer port (see docs/origin-port.md). */
|
|
106
|
+
origin?: GatewayOrigin;
|
|
107
|
+
}
|
|
108
|
+
export interface GatewayOrigin {
|
|
109
|
+
/** Default HTTPS port; the administrator may change it (install.ports). */
|
|
110
|
+
https: number;
|
|
111
|
+
/** `unix:<name>.sock`: the App's private socket under var/run. */
|
|
112
|
+
upstream: string;
|
|
113
|
+
cookies?: "dsm-passthrough";
|
|
114
|
+
headers?: Partial<Record<"user" | "email" | "name" | "groups" | "uid", string>>;
|
|
105
115
|
}
|
|
106
116
|
/** One delete step; {uid} and {name} are the only placeholders. */
|
|
107
117
|
export type DeleteAction = {
|
|
@@ -64,6 +64,10 @@ function unixUpstreamSdkSupported(dir) {
|
|
|
64
64
|
const source = join(dir, "idgateway/unix_upstream.go");
|
|
65
65
|
return existsSync(source) && /const UnixUpstreamVersion = 1\b/.test(readFileSync(source, "utf8"));
|
|
66
66
|
}
|
|
67
|
+
function originSdkSupported(dir) {
|
|
68
|
+
const source = join(dir, "idgateway/origin_port.go");
|
|
69
|
+
return existsSync(source) && /const OriginVersion = 1\b/.test(readFileSync(source, "utf8"));
|
|
70
|
+
}
|
|
67
71
|
function upstreamAuthSdkSupported(dir) {
|
|
68
72
|
const source = join(dir, "idgateway/upstream_auth.go");
|
|
69
73
|
return existsSync(source) && /const UpstreamAuthPathsVersion = 1\b/.test(readFileSync(source, "utf8"));
|
|
@@ -190,8 +194,9 @@ export function readIdentityGateway(value, daemon, fail, packagedPayload = false
|
|
|
190
194
|
"oidc",
|
|
191
195
|
"token",
|
|
192
196
|
"account",
|
|
197
|
+
"origin",
|
|
193
198
|
])) {
|
|
194
|
-
return invalid("accepts only sdk, external_access, secure_context, mode, access, upstream_access, groups, upstream, listen, passthrough, upstream_auth_paths, optional_passthrough, redirects, email_domain, session_ttl, roles, headers, oidc, token and
|
|
199
|
+
return invalid("accepts only sdk, external_access, secure_context, mode, access, upstream_access, launch_path, ingress, groups, max_upload_bytes, response_header_timeout_seconds, upstream, listen, passthrough, upstream_auth_paths, optional_passthrough, redirects, email_domain, session_ttl, roles, headers, oidc, token, account and origin.");
|
|
195
200
|
}
|
|
196
201
|
const v = value;
|
|
197
202
|
if (v.secure_context !== undefined && v.secure_context !== "required")
|
|
@@ -301,15 +306,43 @@ export function readIdentityGateway(value, daemon, fail, packagedPayload = false
|
|
|
301
306
|
![listen.http, listen.https].every((p) => p === undefined || port(p)))
|
|
302
307
|
return invalid("listen needs an http and/or https port.");
|
|
303
308
|
const issuer = record(v.oidc) ? v.oidc.issuer_port : undefined;
|
|
309
|
+
let origin;
|
|
310
|
+
if (v.origin !== undefined) {
|
|
311
|
+
const o = v.origin;
|
|
312
|
+
const originHeaders = record(o) ? o.headers : undefined;
|
|
313
|
+
if (!record(o) || !only(o, ["https", "upstream", "cookies", "headers"]) ||
|
|
314
|
+
!Number.isInteger(o.https) || o.https < 1024 || o.https > 65535 ||
|
|
315
|
+
typeof o.upstream !== "string" || !unixUpstreamSocket(o.upstream) ||
|
|
316
|
+
(o.cookies !== undefined && o.cookies !== "dsm-passthrough") ||
|
|
317
|
+
(originHeaders !== undefined && (!record(originHeaders) || !only(originHeaders, ["user", "email", "name", "groups", "uid"]) ||
|
|
318
|
+
!Object.values(originHeaders).every(headerName) || !originHeaders.user)))
|
|
319
|
+
return invalid("origin needs https (1024-65535), upstream unix:<name>.sock, optional cookies: dsm-passthrough and optional headers with user.");
|
|
320
|
+
if (composeBridge)
|
|
321
|
+
return invalid("origin cannot be combined with compose.");
|
|
322
|
+
try {
|
|
323
|
+
if (!originSdkSupported(sdkSource(v.sdk).goDir))
|
|
324
|
+
return invalid("The selected SDK lacks the second origin (OriginVersion); use a matching SDK release or an explicit development source override.");
|
|
325
|
+
}
|
|
326
|
+
catch {
|
|
327
|
+
return invalid("The SDK origin source is unavailable; use matching SDK sources.");
|
|
328
|
+
}
|
|
329
|
+
origin = {
|
|
330
|
+
https: o.https,
|
|
331
|
+
upstream: o.upstream,
|
|
332
|
+
...(o.cookies !== undefined ? { cookies: "dsm-passthrough" } : {}),
|
|
333
|
+
...(originHeaders !== undefined ? { headers: originHeaders } : {}),
|
|
334
|
+
};
|
|
335
|
+
}
|
|
304
336
|
const ports = [
|
|
305
337
|
listen.http,
|
|
306
338
|
listen.https,
|
|
307
339
|
...(composeBridge || unixSocket ? [] : [v.upstream]),
|
|
308
340
|
issuer,
|
|
341
|
+
origin?.https,
|
|
309
342
|
].filter((p) => p !== undefined);
|
|
310
343
|
if (new Set(ports).size !== ports.length ||
|
|
311
344
|
ports.some((p) => DSM_PORTS.includes(p)))
|
|
312
|
-
return invalid("listen, upstream
|
|
345
|
+
return invalid("listen, upstream, oidc.issuer_port and origin.https must be distinct and not DSM's 5000/5001.");
|
|
313
346
|
const passthrough = v.passthrough ?? [];
|
|
314
347
|
if (!strings(passthrough, (p) => localPath(p) && p !== "/" && !/^\/_sso(\/|$)/.test(p)))
|
|
315
348
|
return invalid("passthrough must be path prefixes such as /share/, outside /_sso.");
|
|
@@ -410,6 +443,7 @@ export function readIdentityGateway(value, daemon, fail, packagedPayload = false
|
|
|
410
443
|
...(v.session_ttl ? { session_ttl: v.session_ttl } : {}),
|
|
411
444
|
...(roles ? { roles } : {}),
|
|
412
445
|
...(headers ? { headers: headers } : {}),
|
|
446
|
+
...(origin ? { origin } : {}),
|
|
413
447
|
};
|
|
414
448
|
if (v.mode === "oidc") {
|
|
415
449
|
const o = v.oidc;
|
|
@@ -568,6 +602,16 @@ export function identityGatewayConfig(m) {
|
|
|
568
602
|
...(g.roles ? { roles: g.roles } : {}),
|
|
569
603
|
...(g.headers ? { headers: g.headers } : {}),
|
|
570
604
|
...(g.oidc ? { oidc: g.oidc } : {}),
|
|
605
|
+
...(g.origin
|
|
606
|
+
? {
|
|
607
|
+
origin: {
|
|
608
|
+
https: g.origin.https,
|
|
609
|
+
upstream: `unix:/var/packages/${m.package}/var/run/${unixUpstreamSocket(g.origin.upstream)}`,
|
|
610
|
+
...(g.origin.cookies ? { cookies: g.origin.cookies } : {}),
|
|
611
|
+
...(g.origin.headers ? { headers: g.origin.headers } : {}),
|
|
612
|
+
},
|
|
613
|
+
}
|
|
614
|
+
: {}),
|
|
571
615
|
...(g.token
|
|
572
616
|
? {
|
|
573
617
|
token: {
|
|
@@ -623,6 +667,8 @@ export async function buildIdentityGateway(m, arch, work, run) {
|
|
|
623
667
|
runtimeBudgetSource(sdk.goDir, m);
|
|
624
668
|
if (m.identityGateway.secure_context && !secureContextSdkSupported(sdk.goDir))
|
|
625
669
|
throw new StandaloneBuildError("STANDALONE_IDENTITY_GATEWAY_INVALID", "secure_context requires an SDK with HTTPS guidance support; upgrade the selected SDK and use matching SDK sources.");
|
|
670
|
+
if (m.identityGateway.origin && !originSdkSupported(sdk.goDir))
|
|
671
|
+
throw new StandaloneBuildError("STANDALONE_IDENTITY_GATEWAY_INVALID", "The selected SDK lacks the second origin (OriginVersion); use a matching SDK release or an explicit development source override.");
|
|
626
672
|
if (unixUpstreamSocket(m.identityGateway.upstream) && !unixUpstreamSdkSupported(sdk.goDir))
|
|
627
673
|
throw new StandaloneBuildError("STANDALONE_IDENTITY_GATEWAY_INVALID", "The selected SDK lacks unix upstream support (UnixUpstreamVersion); use a matching SDK release or an explicit development source override.");
|
|
628
674
|
if (m.identityGateway.upstream_auth_paths && !upstreamAuthSdkSupported(sdk.goDir))
|
|
@@ -17,7 +17,8 @@ import { readInstallSettings, settingsInstallSteps, settingsConfig, renderSettin
|
|
|
17
17
|
import { MODULE_UI_ENTRY, uiTreeDigest } from "./ui-assets.js";
|
|
18
18
|
import { minifyUi, isUiBundle } from "./public-ui.js";
|
|
19
19
|
import { nativePortal } from "./portal.js";
|
|
20
|
-
import {
|
|
20
|
+
import { unixUpstreamSocket } from "./gateway-ingress-only.js";
|
|
21
|
+
import { nativeGatewaySupported, renderNativeGatewayConfig, renderNativeOriginConfig, NATIVE_ORIGIN_CONFIG, renderNativeGatewayDiagnostic, renderNativeGatewayPrepare, NATIVE_GATEWAY_CONFIG, gatewayEntryPath } from './native-gateway.js';
|
|
21
22
|
import { inspectPortalInfo } from "../portal/info.js";
|
|
22
23
|
import { isDeepStrictEqual } from "node:util";
|
|
23
24
|
import { inspectCtlArtifacts } from './native-http-inspect.js';
|
|
@@ -1362,7 +1363,7 @@ async function recoverNativeGateway(dir, value, info, findings) {
|
|
|
1362
1363
|
throw new Error('invalid native gateway record');
|
|
1363
1364
|
const plan = value;
|
|
1364
1365
|
if (typeof plan.sdk !== 'string' || !plan.listen || typeof plan.listen !== 'object' || Array.isArray(plan.listen)
|
|
1365
|
-
|| !plan.ingress && !Object.keys(plan.listen).length || Object.keys(plan).some(k => !['sdk', 'listen', 'ingress'].includes(k))
|
|
1366
|
+
|| !plan.ingress && !Object.keys(plan.listen).length || Object.keys(plan).some(k => !['sdk', 'listen', 'ingress', 'origin'].includes(k))
|
|
1366
1367
|
|| Object.entries(plan.listen).some(([k, v]) => !['http', 'https'].includes(k) || !Number.isInteger(v) || v < 1 || v > 65535))
|
|
1367
1368
|
throw new Error('invalid native gateway ports');
|
|
1368
1369
|
const target = { package: info.package, os_min_ver: info.os_min_ver, identityGateway: plan };
|
|
@@ -1370,15 +1371,24 @@ async function recoverNativeGateway(dir, value, info, findings) {
|
|
|
1370
1371
|
throw new Error('invalid gateway ingress namespace');
|
|
1371
1372
|
if (!nativeGatewaySupported(target))
|
|
1372
1373
|
throw new Error('unsupported native gateway SDK/DSM floor');
|
|
1374
|
+
const origin = plan.origin;
|
|
1375
|
+
if (origin !== undefined && !nativeOriginRecord(origin))
|
|
1376
|
+
throw new Error('invalid native gateway origin');
|
|
1373
1377
|
const root = join(dir, 'native-gateway-inspection');
|
|
1374
1378
|
mkdirSync(root);
|
|
1375
|
-
await extractSpkArchive({ file: join(dir, 'package.tgz'), cwd: root, filter: path => ['sso/gateway.json', 'ui/sso/open.cgi', NATIVE_GATEWAY_CONFIG].includes(path.replace(/^\.\//, '')) });
|
|
1379
|
+
await extractSpkArchive({ file: join(dir, 'package.tgz'), cwd: root, filter: path => ['sso/gateway.json', 'ui/sso/open.cgi', NATIVE_GATEWAY_CONFIG, NATIVE_ORIGIN_CONFIG].includes(path.replace(/^\.\//, '')) });
|
|
1376
1380
|
const config = JSON.parse(readFileSync(join(root, 'sso/gateway.json'), 'utf8'));
|
|
1377
1381
|
if (config.native_ingress !== true || config.package !== info.package || !isDeepStrictEqual(config.listen, plan.listen) || config.ingress_path !== plan.ingress?.path
|
|
1378
1382
|
|| config.state_dir !== `/var/packages/${info.package}/var/sso`)
|
|
1379
1383
|
throw new Error('native gateway config does not match its package');
|
|
1380
1384
|
if (readOptional(join(root, NATIVE_GATEWAY_CONFIG)) !== renderNativeGatewayConfig(target))
|
|
1381
1385
|
throw new Error('native gateway ingress differs from its fixed proxy');
|
|
1386
|
+
const expectedOrigin = origin && { https: origin.https, upstream: `unix:/var/packages/${info.package}/var/run/${unixUpstreamSocket(origin.upstream)}`,
|
|
1387
|
+
...(origin.cookies ? { cookies: origin.cookies } : {}), ...(origin.headers ? { headers: origin.headers } : {}) };
|
|
1388
|
+
if (!isDeepStrictEqual(config.origin, expectedOrigin))
|
|
1389
|
+
throw new Error('native gateway origin does not match its package');
|
|
1390
|
+
if (readOptional(join(root, NATIVE_ORIGIN_CONFIG)) !== (origin ? renderNativeOriginConfig(target) : undefined))
|
|
1391
|
+
throw new Error('native gateway origin differs from its fixed proxy');
|
|
1382
1392
|
for (const key of ['startstop_restart_services'])
|
|
1383
1393
|
if (!(info[key] ?? '').split(/\s+/).includes('nginx.service'))
|
|
1384
1394
|
throw new Error(`native gateway requires INFO ${key}`);
|
|
@@ -1400,6 +1410,18 @@ async function recoverNativeGateway(dir, value, info, findings) {
|
|
|
1400
1410
|
return undefined;
|
|
1401
1411
|
}
|
|
1402
1412
|
}
|
|
1413
|
+
/** The recorded identity_gateway.origin: exactly what the manifest reader accepts. */
|
|
1414
|
+
function nativeOriginRecord(v) {
|
|
1415
|
+
if (!v || typeof v !== 'object' || Array.isArray(v))
|
|
1416
|
+
return false;
|
|
1417
|
+
const o = v, h = o.headers;
|
|
1418
|
+
return Object.keys(o).every(k => ['https', 'upstream', 'cookies', 'headers'].includes(k))
|
|
1419
|
+
&& Number.isInteger(o.https) && o.https >= 1024 && o.https <= 65535
|
|
1420
|
+
&& unixUpstreamSocket(o.upstream) !== undefined && (o.cookies === undefined || o.cookies === 'dsm-passthrough')
|
|
1421
|
+
&& (h === undefined || !!h && typeof h === 'object' && !Array.isArray(h)
|
|
1422
|
+
&& Object.entries(h).every(([k, name]) => ['user', 'email', 'name', 'groups', 'uid'].includes(k) && typeof name === 'string' && /^[A-Za-z0-9][A-Za-z0-9-]{0,63}$/.test(name))
|
|
1423
|
+
&& typeof h.user === 'string');
|
|
1424
|
+
}
|
|
1403
1425
|
function recoverDaemonNode(value, findings) {
|
|
1404
1426
|
if (value === undefined)
|
|
1405
1427
|
return undefined;
|
|
@@ -1729,7 +1751,7 @@ async function inspectInstallSettings(dir, payload, metadata, findings) {
|
|
|
1729
1751
|
const expected = portDefaults({ ...m, identityGateway: { ...actualGateway, sdk: gateway.sdk, ...(actualGateway.ingress_path ? { ingress: { path: actualGateway.ingress_path } } : {}) } });
|
|
1730
1752
|
if (config.schema !== 1 || config.package !== info.package || !isDeepStrictEqual(config.ports, ports) || !isDeepStrictEqual(ports, expected))
|
|
1731
1753
|
throw new Error('port defaults differ from gateway listeners');
|
|
1732
|
-
const required = ['sso/gateway.json', 'daemon/config.json', ...(actualGateway.native_ingress ? ['sso/native-nginx.conf'] : []), ...(settings ? ['install/settings.json'] : []), ...payload.filter(p => /^ui\/window-[0-9]+\.js$/.test(p.path)).map(p => p.path)].sort();
|
|
1754
|
+
const required = ['sso/gateway.json', 'daemon/config.json', ...(actualGateway.native_ingress ? ['sso/native-nginx.conf'] : []), ...(actualGateway.origin ? [NATIVE_ORIGIN_CONFIG] : []), ...(settings ? ['install/settings.json'] : []), ...payload.filter(p => /^ui\/window-[0-9]+\.js$/.test(p.path)).map(p => p.path)].sort();
|
|
1733
1755
|
if (!isDeepStrictEqual(Object.keys(config.files).sort(), required))
|
|
1734
1756
|
throw new Error('port templates must cover every generated port consumer');
|
|
1735
1757
|
for (const [path, source] of Object.entries(config.files)) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { StandaloneManifest } from './manifest.js';
|
|
2
2
|
import type { Translate } from '../build-spk/wizard-i18n.js';
|
|
3
|
-
export
|
|
3
|
+
export type PortDefinition = {
|
|
4
4
|
default: number;
|
|
5
5
|
protocol: 'tcp';
|
|
6
|
-
|
|
6
|
+
conflict?: 'warn';
|
|
7
|
+
};
|
|
8
|
+
export declare function portDefaults(m: Pick<StandaloneManifest, 'identityGateway' | 'installPorts'>): Record<string, PortDefinition>;
|
|
7
9
|
export declare function withPort(m: StandaloneManifest, key: string, value: number): StandaloneManifest;
|
|
8
10
|
interface PortMessages {
|
|
9
11
|
reserved: string;
|
|
@@ -11,10 +13,7 @@ interface PortMessages {
|
|
|
11
13
|
duplicate: string;
|
|
12
14
|
}
|
|
13
15
|
export declare function portFieldValidator(pkg: string, key: string, reason: string, messages?: PortMessages): string;
|
|
14
|
-
export declare function portInstallSteps(m: Pick<StandaloneManifest, 'package' | 'installPorts' | 'identityGateway'>, definitions?: Record<string, {
|
|
15
|
-
default: number;
|
|
16
|
-
protocol: "tcp";
|
|
17
|
-
}>): (t: Translate) => {
|
|
16
|
+
export declare function portInstallSteps(m: Pick<StandaloneManifest, 'package' | 'installPorts' | 'identityGateway'>, definitions?: Record<string, PortDefinition>): (t: Translate) => {
|
|
18
17
|
step_title: string;
|
|
19
18
|
items: ({
|
|
20
19
|
type: string;
|
|
@@ -7,10 +7,18 @@ export function portDefaults(m) {
|
|
|
7
7
|
return Object.fromEntries([
|
|
8
8
|
...Object.entries(g.ingress ? {} : g.listen ?? {}).map(([key, value]) => ['gateway_' + key, { default: value, protocol: 'tcp' }]),
|
|
9
9
|
...(g.oidc ? [['oidc_issuer', { default: g.oidc.issuer_port, protocol: 'tcp' }]] : []),
|
|
10
|
+
// An administrator-chosen origin port only warns about a registered service.
|
|
11
|
+
...(g.origin ? [['gateway_origin', { default: g.origin.https, protocol: 'tcp', conflict: 'warn' }]] : []),
|
|
10
12
|
]);
|
|
11
13
|
}
|
|
14
|
+
function portValue(m, key) {
|
|
15
|
+
const g = m.identityGateway;
|
|
16
|
+
return key === 'oidc_issuer' ? g.oidc.issuer_port : key === 'gateway_origin' ? g.origin.https : g.listen[key.slice(8)];
|
|
17
|
+
}
|
|
12
18
|
export function withPort(m, key, value) {
|
|
13
19
|
const g = m.identityGateway;
|
|
20
|
+
if (key === 'gateway_origin')
|
|
21
|
+
return { ...m, identityGateway: { ...g, origin: { ...g.origin, https: value } } };
|
|
14
22
|
return { ...m, identityGateway: { ...g, listen: { ...g.listen, ...(key.startsWith('gateway_') ? { [key.slice(8)]: value } : {}) }, ...(g.oidc ? { oidc: { ...g.oidc, ...(key === 'oidc_issuer' ? { issuer_port: value } : {}) } } : {}) } };
|
|
15
23
|
}
|
|
16
24
|
/** Validate port syntax; service conflicts are advisory and never block Next. */
|
|
@@ -85,7 +93,7 @@ export function portInstallSteps(m, definitions = portDefaults(m)) {
|
|
|
85
93
|
return (t) => m.installPorts ? [{
|
|
86
94
|
step_title: t('ports.title'),
|
|
87
95
|
items: [{ desc: t('ports.notice') }, ...Object.entries(definitions).flatMap(([key, p]) => {
|
|
88
|
-
const label = t(key === 'gateway_http' ? 'ports.http' : key === 'gateway_https' ? 'ports.https' : 'ports.signin');
|
|
96
|
+
const label = t(key === 'gateway_http' ? 'ports.http' : key === 'gateway_https' ? 'ports.https' : key === 'gateway_origin' ? 'ports.origin' : 'ports.signin');
|
|
89
97
|
return [
|
|
90
98
|
{ type: 'textfield', desc: label, subitems: [{ key: 'pkgwizard_port_' + key, desc: label, defaultValue: String(p.default), validator: { allowBlank: false, fn: portFieldValidator(m.package, key, t('ports.invalid'), { reserved: t('ports.reserved', { port: '{port}' }), conflict: t('ports.conflict', { port: '{port}', service: '{service}' }), duplicate: t('ports.duplicate', { port: '{port}' }) }) } }] },
|
|
91
99
|
{ desc: `<div id="synopkgland-port-warning-${m.package}-${key}" role="status" aria-live="polite" style="min-height:44px;visibility:hidden"></div>` },
|
|
@@ -112,8 +120,7 @@ export function writePortPayload(m, root, render) {
|
|
|
112
120
|
const files = render(marked);
|
|
113
121
|
let index = 0;
|
|
114
122
|
for (const [key] of Object.entries(ports)) {
|
|
115
|
-
const
|
|
116
|
-
const value = key === 'oidc_issuer' ? g.oidc.issuer_port : g.listen[key.slice(8)];
|
|
123
|
+
const value = portValue(marked, key);
|
|
117
124
|
for (const path of Object.keys(files))
|
|
118
125
|
files[path] = files[path].replaceAll(String(value), '@@PORT_' + key + '@@');
|
|
119
126
|
index++;
|
|
@@ -10,7 +10,7 @@ import { daemonNoFileSdkProblem, daemonNoFileIdentityProblem, DAEMON_NOFILE_MIN_
|
|
|
10
10
|
import { readAllowedSecretFiles } from "../secret-files.js";
|
|
11
11
|
import { readRegistry, registryFile } from '../ctl/registry.js';
|
|
12
12
|
import { gatewayIngressPathProblem, gatewayIngressOwnershipSupported } from './gateway-ingress.js';
|
|
13
|
-
import { nativeGatewaySdk } from "./native-gateway.js";
|
|
13
|
+
import { nativeGatewaySdk, nativeGatewaySupported } from "./native-gateway.js";
|
|
14
14
|
import { portDefaults } from "./install-ports.js";
|
|
15
15
|
import { readMemoryAdvice, readMinMemoryMb } from "./install-memory.js";
|
|
16
16
|
import { readPackageDependencies, packageDependencies, dependencyError } from "./package-dependencies.js";
|
|
@@ -369,13 +369,19 @@ function readManifest(raw, c) {
|
|
|
369
369
|
c.fail('STANDALONE_IDENTITY_GATEWAY_INVALID', 'Custom ingress requires SDK 0.44.0 or later; update identity_gateway.sdk.');
|
|
370
370
|
if (daemonIngressMinDsmProblem(typeof raw.os_min_ver === "string" ? raw.os_min_ver : undefined))
|
|
371
371
|
c.fail('STANDALONE_IDENTITY_GATEWAY_INVALID', 'identity_gateway.ingress requires DSM 7.2-64570 or later.');
|
|
372
|
-
if (installPorts && !identityGateway.oidc)
|
|
372
|
+
if (installPorts && !identityGateway.oidc && !identityGateway.origin)
|
|
373
373
|
c.fail('INSTALL_PORT_INVALID', 'Path ingress has no public gateway ports; remove install.ports.');
|
|
374
374
|
if (identityGateway.external_access?.single_origin)
|
|
375
375
|
c.fail('STANDALONE_IDENTITY_GATEWAY_INVALID', 'Path ingress uses the DSM origin and cannot combine with external_access.single_origin.');
|
|
376
376
|
}
|
|
377
377
|
if (installPorts && !identityGateway)
|
|
378
378
|
c.fail('INSTALL_PORT_INVALID', 'install.ports requires an identity gateway');
|
|
379
|
+
if (identityGateway?.origin) {
|
|
380
|
+
if (!installPorts)
|
|
381
|
+
c.fail('INSTALL_PORT_INVALID', 'identity_gateway.origin needs install.ports: true, so the administrator can choose its port.');
|
|
382
|
+
if (!nativeGatewaySupported({ package: raw.package, os_min_ver: osMinVer, identityGateway }))
|
|
383
|
+
c.fail('STANDALONE_IDENTITY_GATEWAY_INVALID', 'identity_gateway.origin is served by DSM nginx and requires DSM 7.2-64570 or later.');
|
|
384
|
+
}
|
|
379
385
|
if (installPorts && identityGateway) {
|
|
380
386
|
const [major, minor, patch] = identityGateway.sdk.split('.').map(Number);
|
|
381
387
|
if (major === 0 && (minor < 38 || minor === 38 && patch < 2))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IdentityGateway } from './identity-gateway.js';
|
|
2
|
-
export type NativeGatewayPlan = Pick<IdentityGateway, 'sdk' | 'listen' | 'ingress'>;
|
|
2
|
+
export type NativeGatewayPlan = Pick<IdentityGateway, 'sdk' | 'listen' | 'ingress' | 'origin'>;
|
|
3
3
|
type Target = {
|
|
4
4
|
package: string;
|
|
5
5
|
os_min_ver?: string;
|
|
@@ -7,6 +7,8 @@ type Target = {
|
|
|
7
7
|
installPorts?: true;
|
|
8
8
|
};
|
|
9
9
|
export declare const NATIVE_GATEWAY_CONFIG = "sso/native-nginx.conf";
|
|
10
|
+
/** The second origin's own `server` block (identity_gateway.origin). */
|
|
11
|
+
export declare const NATIVE_ORIGIN_CONFIG = "sso/native-origin-nginx.conf";
|
|
10
12
|
export declare function nativeGatewaySdk(sdk: string): boolean;
|
|
11
13
|
export declare function nativeGatewaySupported(m: Target): boolean;
|
|
12
14
|
/** Observe the boundary before DSM acquires web-config, without claiming port ownership. */
|
|
@@ -16,6 +18,8 @@ export declare function renderNativeGatewayPortWait(m: Target, hook: string): st
|
|
|
16
18
|
export declare function gatewayEntryPath(m: Target): string;
|
|
17
19
|
export declare function legacyGatewayNotice(): string;
|
|
18
20
|
export declare function nativeGatewayResource(m: Target): Record<string, unknown> | undefined;
|
|
21
|
+
/** The second origin: DSM's certificate on its own port, to the gateway's origin socket. */
|
|
22
|
+
export declare function renderNativeOriginConfig(m: Target): string;
|
|
19
23
|
export declare function renderNativeGatewayConfig(m: Target): string;
|
|
20
24
|
/** Runs after DSM creates pkgvar, before package start activates the nginx resource. */
|
|
21
25
|
export declare function renderNativeGatewayPrepare(m: Target): string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { gatewayIngressPathProblem, gatewayIngressOwnershipSupported } from './gateway-ingress.js';
|
|
2
2
|
import { isDsmAtLeast, PORTAL_MIN_DSM } from '../build-spk/dsm-version.js';
|
|
3
3
|
export const NATIVE_GATEWAY_CONFIG = 'sso/native-nginx.conf';
|
|
4
|
+
/** The second origin's own `server` block (identity_gateway.origin). */
|
|
5
|
+
export const NATIVE_ORIGIN_CONFIG = 'sso/native-origin-nginx.conf';
|
|
4
6
|
// Earlier SDK releases do not understand native_ingress. Keep their JSON ABI
|
|
5
7
|
// and put an explanation in front of their existing direct-port launcher.
|
|
6
8
|
export function nativeGatewaySdk(sdk) {
|
|
@@ -110,22 +112,22 @@ export function legacyGatewayNotice() {
|
|
|
110
112
|
export function nativeGatewayResource(m) {
|
|
111
113
|
if (!nativeGatewaySupported(m))
|
|
112
114
|
return undefined;
|
|
115
|
+
// The origin port is always an installer port: DSM's port-config resource
|
|
116
|
+
// (install/<package>.sc) registers it, so the server entry lists no ports.
|
|
117
|
+
const origin = m.identityGateway.origin ? [{ type: 'server', relpath: NATIVE_ORIGIN_CONFIG }] : [];
|
|
113
118
|
if (m.identityGateway.ingress)
|
|
114
|
-
return { "nginx-static-config": { enable: [{ type: "dsm", relpath: NATIVE_GATEWAY_CONFIG }] } };
|
|
119
|
+
return { "nginx-static-config": { enable: [{ type: "dsm", relpath: NATIVE_GATEWAY_CONFIG }, ...origin] } };
|
|
115
120
|
const g = m.identityGateway, https = g.listen.https ?? g.listen.http;
|
|
116
121
|
const ports = [https, ...(g.listen.http && g.listen.http !== https ? [g.listen.http] : [])];
|
|
117
122
|
return { 'nginx-static-config': { enable: [{ type: 'server', relpath: NATIVE_GATEWAY_CONFIG,
|
|
118
|
-
...(!m.installPorts ? { ports: ports.map(port => ({ port, protocol: 'tcp', schema: port === https ? 'https' : 'http' })) } : {}) }] } };
|
|
123
|
+
...(!m.installPorts ? { ports: ports.map(port => ({ port, protocol: 'tcp', schema: port === https ? 'https' : 'http' })) } : {}) }, ...origin] } };
|
|
119
124
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return '';
|
|
123
|
-
const g = m.identityGateway, port = g.listen.https ?? g.listen.http;
|
|
124
|
-
const state = `/var/packages/${m.package}/var/sso`;
|
|
125
|
+
function nativeProxy(pkg, socket) {
|
|
126
|
+
const state = `/var/packages/${pkg}/var/sso`;
|
|
125
127
|
// Public ssl_certificate is deliberately inherited from DSM's http context.
|
|
126
128
|
// Only nginx's master reads the package's private upstream key. No DSM key
|
|
127
129
|
// is read or copied by the package, and no secret appears in this config.
|
|
128
|
-
|
|
130
|
+
return ` proxy_pass https://unix:${socket}:;
|
|
129
131
|
proxy_http_version 1.1;
|
|
130
132
|
proxy_ssl_verify on;
|
|
131
133
|
proxy_ssl_verify_depth 1;
|
|
@@ -142,6 +144,27 @@ export function renderNativeGatewayConfig(m) {
|
|
|
142
144
|
proxy_buffering off;
|
|
143
145
|
proxy_read_timeout 3600s;
|
|
144
146
|
`;
|
|
147
|
+
}
|
|
148
|
+
/** The second origin: DSM's certificate on its own port, to the gateway's origin socket. */
|
|
149
|
+
export function renderNativeOriginConfig(m) {
|
|
150
|
+
const o = m.identityGateway?.origin;
|
|
151
|
+
if (!o || !nativeGatewaySupported(m))
|
|
152
|
+
return '';
|
|
153
|
+
return `server {
|
|
154
|
+
listen ${o.https} ssl;
|
|
155
|
+
listen [::]:${o.https} ssl;
|
|
156
|
+
server_name _;
|
|
157
|
+
client_max_body_size 0;
|
|
158
|
+
location / {
|
|
159
|
+
${nativeProxy(m.package, `/tmp/synopkgland-gateway-${m.package}-origin.sock`)} }
|
|
160
|
+
}
|
|
161
|
+
`;
|
|
162
|
+
}
|
|
163
|
+
export function renderNativeGatewayConfig(m) {
|
|
164
|
+
if (!nativeGatewaySupported(m))
|
|
165
|
+
return '';
|
|
166
|
+
const g = m.identityGateway, port = g.listen.https ?? g.listen.http;
|
|
167
|
+
const proxy = nativeProxy(m.package, `/tmp/synopkgland-gateway-${m.package}.sock`);
|
|
145
168
|
if (g.ingress) {
|
|
146
169
|
const problem = gatewayIngressPathProblem(m.package, g.ingress.path);
|
|
147
170
|
if (problem)
|
|
@@ -9,10 +9,20 @@ import { type StablePages } from "./stable-pages.js";
|
|
|
9
9
|
* relative Location: no proxy, no upstream, no cookie and no package code runs,
|
|
10
10
|
* so they widen no access. The browser keeps the query (passed on) and the
|
|
11
11
|
* fragment (never sent to the server, kept across the redirect).
|
|
12
|
+
*
|
|
13
|
+
* The redirect puts `spl-short=<path>` first in the query. The page it opens
|
|
14
|
+
* then shows the short path in the address bar again (history.replaceState),
|
|
15
|
+
* with a `<base>` that keeps its relative URLs on the page's own folder: a
|
|
16
|
+
* stable page's target through the landing script below, the entry page
|
|
17
|
+
* through the SDK's entry boot. Only a page reached through the short path
|
|
18
|
+
* has the marker, so a page opened on another origin (an Application Portal
|
|
19
|
+
* domain or port, where the short path does not exist) keeps its own URL.
|
|
12
20
|
*/
|
|
13
21
|
export type ShortPaths = Record<string, string>;
|
|
14
22
|
export declare const SHORT_PATHS_CONFIG = "etc/short-paths-nginx.conf";
|
|
15
23
|
export declare const SHORT_PATH_LIMIT = 4;
|
|
24
|
+
/** The query parameter the redirect puts first; its value is the path without the leading /. */
|
|
25
|
+
export declare const SHORT_PATH_MARKER = "spl-short";
|
|
16
26
|
/** Undefined when valid; otherwise why. `stablePages` are the package's declared pages. */
|
|
17
27
|
export declare function shortPathsProblem(value: unknown, stablePages: StablePages | undefined): string | undefined;
|
|
18
28
|
/** DSM before 7.2 rejects an unsigned web-config, the worker that adds the locations. */
|
|
@@ -28,6 +38,18 @@ export declare function shortPathTarget(pkg: string, page: string): string;
|
|
|
28
38
|
* 302 is never cached permanently, so a removed package leaves no stale redirect.
|
|
29
39
|
*/
|
|
30
40
|
export declare function renderShortPathsConfig(pkg: string, paths: ShortPaths): string;
|
|
41
|
+
/**
|
|
42
|
+
* The script a stable page's target gets first in its head when a short path
|
|
43
|
+
* opens the page. It runs before the page's own scripts: with the marker of a
|
|
44
|
+
* declared path first in the query, it adds `<base href>` with the page's own
|
|
45
|
+
* URL (unless the page has one) and replaces the address with the short path,
|
|
46
|
+
* the rest of the query and the fragment. Anything else leaves the page alone.
|
|
47
|
+
*/
|
|
48
|
+
export declare function shortPathLanding(paths: string[]): string;
|
|
49
|
+
/** The page with the landing after its <base> (resolved against the page's own URL), else first in <head>, else after the doctype, else first. */
|
|
50
|
+
export declare function withShortPathLanding(html: string, paths: string[]): string;
|
|
51
|
+
/** Each stable page target a short path opens, with those paths; only HTML pages get the landing. */
|
|
52
|
+
export declare function shortPathLandings(paths: ShortPaths, stablePages: StablePages | undefined): Map<string, string[]>;
|
|
31
53
|
export declare function shortPathsResourceEntry(): {
|
|
32
54
|
type: string;
|
|
33
55
|
relpath: string;
|
|
@@ -4,6 +4,8 @@ import { STABLE_PAGE_FILE } from "./stable-pages.js";
|
|
|
4
4
|
import { ENTRY_SHORT_PATH_TARGET, entryPagePath } from "./entry-page.js";
|
|
5
5
|
export const SHORT_PATHS_CONFIG = "etc/short-paths-nginx.conf";
|
|
6
6
|
export const SHORT_PATH_LIMIT = 4;
|
|
7
|
+
/** The query parameter the redirect puts first; its value is the path without the leading /. */
|
|
8
|
+
export const SHORT_PATH_MARKER = "spl-short";
|
|
7
9
|
const PATH = /^\/[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
8
10
|
const PACKAGE = /^[A-Za-z][A-Za-z0-9]{1,63}$/;
|
|
9
11
|
/** The lifecycle hooks that check the paths before DSM activates the resource, as for custom ingress. */
|
|
@@ -57,7 +59,49 @@ export function shortPathTarget(pkg, page) {
|
|
|
57
59
|
* 302 is never cached permanently, so a removed package leaves no stale redirect.
|
|
58
60
|
*/
|
|
59
61
|
export function renderShortPathsConfig(pkg, paths) {
|
|
60
|
-
return checked(pkg, paths).map(([path, page]) => [path, `${path}/`].map(from => `location = ${from} {\n absolute_redirect off;\n return 302 ${shortPathTarget(pkg, page)}
|
|
62
|
+
return checked(pkg, paths).map(([path, page]) => [path, `${path}/`].map(from => `location = ${from} {\n absolute_redirect off;\n return 302 ${shortPathTarget(pkg, page)}?${SHORT_PATH_MARKER}=${path.slice(1)}&$args;\n}\n`).join("")).join("");
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The script a stable page's target gets first in its head when a short path
|
|
66
|
+
* opens the page. It runs before the page's own scripts: with the marker of a
|
|
67
|
+
* declared path first in the query, it adds `<base href>` with the page's own
|
|
68
|
+
* URL (unless the page has one) and replaces the address with the short path,
|
|
69
|
+
* the rest of the query and the fragment. Anything else leaves the page alone.
|
|
70
|
+
*/
|
|
71
|
+
export function shortPathLanding(paths) {
|
|
72
|
+
if (!paths.length || paths.some(path => path.length > 65 || !PATH.test(path)))
|
|
73
|
+
throw new Error("Invalid ui.short_paths declaration");
|
|
74
|
+
return `<script>(function () {
|
|
75
|
+
try {
|
|
76
|
+
var m = /^\\?${SHORT_PATH_MARKER}=([a-z0-9]+(?:-[a-z0-9]+)*)(?:&|$)/.exec(location.search);
|
|
77
|
+
if (!m || ${JSON.stringify([...paths].sort())}.indexOf("/" + m[1]) < 0) return;
|
|
78
|
+
if (!document.querySelector("base[href]")) {
|
|
79
|
+
var base = document.createElement("base"), head = document.head || document.documentElement;
|
|
80
|
+
base.href = location.origin + location.pathname;
|
|
81
|
+
head.insertBefore(base, head.firstChild);
|
|
82
|
+
}
|
|
83
|
+
var rest = location.search.slice(m[0].length);
|
|
84
|
+
history.replaceState(history.state, "", "/" + m[1] + (rest ? "?" + rest : "") + location.hash);
|
|
85
|
+
} catch (e) {}
|
|
86
|
+
})();</script>`;
|
|
87
|
+
}
|
|
88
|
+
/** The page with the landing after its <base> (resolved against the page's own URL), else first in <head>, else after the doctype, else first. */
|
|
89
|
+
export function withShortPathLanding(html, paths) {
|
|
90
|
+
const tag = shortPathLanding(paths);
|
|
91
|
+
const at = /<base\b[^>]*>/i.exec(html) ?? /<head\b[^>]*>/i.exec(html) ?? /^\s*<!doctype\b[^>]*>/i.exec(html);
|
|
92
|
+
const end = at ? at.index + at[0].length : 0;
|
|
93
|
+
return html.slice(0, end) + tag + html.slice(end);
|
|
94
|
+
}
|
|
95
|
+
/** Each stable page target a short path opens, with those paths; only HTML pages get the landing. */
|
|
96
|
+
export function shortPathLandings(paths, stablePages) {
|
|
97
|
+
const out = new Map();
|
|
98
|
+
for (const [path, page] of Object.entries(paths)) {
|
|
99
|
+
const target = page === ENTRY_SHORT_PATH_TARGET ? undefined : stablePages?.[page];
|
|
100
|
+
if (!target || !/\.html?$/i.test(target))
|
|
101
|
+
continue;
|
|
102
|
+
out.set(target, [...(out.get(target) ?? []), path].sort());
|
|
103
|
+
}
|
|
104
|
+
return out;
|
|
61
105
|
}
|
|
62
106
|
export function shortPathsResourceEntry() {
|
|
63
107
|
return { type: "dsm", relpath: SHORT_PATHS_CONFIG };
|
package/dist/standalone/spk.js
CHANGED
|
@@ -8,7 +8,7 @@ import { portDefaults, portInstallSteps, writePortPayload } from "./install-port
|
|
|
8
8
|
import { packageDependencies, dependencyInfo } from "./package-dependencies.js";
|
|
9
9
|
import { settingsInstallSteps, settingsConfig, nativeFolderConfig } from './install-settings.js';
|
|
10
10
|
import { backupConfig, backupHookProblem, backupRecord, renderBackupScripts, BACKUP_PAYLOAD_DIR, BACKUP_SCRIPTS_DIR, BACKUP_SCRIPT_MODES } from './hyper-backup.js';
|
|
11
|
-
import { nativeGatewaySupported, nativeGatewaySdk, renderNativeGatewayConfig, NATIVE_GATEWAY_CONFIG, legacyGatewayNotice, gatewayEntryPath } from './native-gateway.js';
|
|
11
|
+
import { nativeGatewaySupported, nativeGatewaySdk, renderNativeGatewayConfig, NATIVE_GATEWAY_CONFIG, renderNativeOriginConfig, NATIVE_ORIGIN_CONFIG, legacyGatewayNotice, gatewayEntryPath } from './native-gateway.js';
|
|
12
12
|
import { portalInfoFields } from "../portal/info.js";
|
|
13
13
|
import { sdkSource } from "../runtime/sdk-source.js";
|
|
14
14
|
import { resolvedSdkLaunch } from "../contract/app-launch.js";
|
|
@@ -30,7 +30,7 @@ import { renderStandaloneScript } from "./lifecycle.js";
|
|
|
30
30
|
import { APP_SCRIPTS_DIR, APP_SCRIPTS_SPK_DIR } from "./app-scripts.js";
|
|
31
31
|
import { MODULE_UI_ENTRY, precompressUiTree, uiTreeDigest } from "./ui-assets.js";
|
|
32
32
|
import { writeStablePages } from "./stable-pages.js";
|
|
33
|
-
import { SHORT_PATHS_CONFIG, renderShortPathsConfig } from "./short-paths.js";
|
|
33
|
+
import { SHORT_PATHS_CONFIG, renderShortPathsConfig, shortPathLandings, withShortPathLanding } from "./short-paths.js";
|
|
34
34
|
import { enforcePublicUi, isUiBundle, logicalUiFile, minifyUi, minifyUiTree, storedUiSecretIgnores, uiFiles } from "./public-ui.js";
|
|
35
35
|
import { codedMessage } from "../errors.js";
|
|
36
36
|
import { CHECKSUM_PLACEHOLDER, DIGEST_PLACEHOLDER, largestInstalledInfo, projectInstalledInfoIssue, stagedInstalledInfoIssue } from "../spk/installed-info.js";
|
|
@@ -106,6 +106,12 @@ export async function assembleStandaloneSpk(options) {
|
|
|
106
106
|
copyUiTree(manifest.ui.dir, appDir, manifest.root);
|
|
107
107
|
else
|
|
108
108
|
mkdirSync(appDir, { recursive: true });
|
|
109
|
+
// Before the digest: a page a short path opens shows that path again.
|
|
110
|
+
for (const [target, paths] of shortPathLandings(manifest.ui?.shortPaths ?? {}, manifest.ui?.stablePages)) {
|
|
111
|
+
const file = join(appDir, target);
|
|
112
|
+
if (existsSync(file) && lstatSync(file).isFile())
|
|
113
|
+
writeFileSync(file, withShortPathLanding(readFileSync(file, "utf8"), paths));
|
|
114
|
+
}
|
|
109
115
|
minifyUiTree(appDir);
|
|
110
116
|
precompressUiTree(appDir);
|
|
111
117
|
const moduleUi = hasSdkWindow(manifest) && existsSync(join(appDir, MODULE_UI_ENTRY));
|
|
@@ -166,6 +172,8 @@ export async function assembleStandaloneSpk(options) {
|
|
|
166
172
|
writeFile(join(staging, "package", GATEWAY_CONFIG_PATH), identityGatewayConfig(manifest));
|
|
167
173
|
if (nativeGatewaySupported(manifest))
|
|
168
174
|
writeFile(join(staging, 'package', NATIVE_GATEWAY_CONFIG), renderNativeGatewayConfig(manifest));
|
|
175
|
+
if (renderNativeOriginConfig(manifest))
|
|
176
|
+
writeFile(join(staging, 'package', NATIVE_ORIGIN_CONFIG), renderNativeOriginConfig(manifest));
|
|
169
177
|
if (!nativeGatewaySdk(manifest.identityGateway.sdk))
|
|
170
178
|
writeFile(join(staging, 'package/ui/sso/open.html'), legacyGatewayNotice());
|
|
171
179
|
}
|
|
@@ -273,6 +281,7 @@ export async function assembleStandaloneSpk(options) {
|
|
|
273
281
|
writePortPayload(manifest, join(staging, 'package'), variant => ({
|
|
274
282
|
'sso/gateway.json': identityGatewayConfig(variant),
|
|
275
283
|
...(nativeGatewaySupported(variant) ? { [NATIVE_GATEWAY_CONFIG]: renderNativeGatewayConfig(variant) } : {}),
|
|
284
|
+
...(renderNativeOriginConfig(variant) ? { [NATIVE_ORIGIN_CONFIG]: renderNativeOriginConfig(variant) } : {}),
|
|
276
285
|
...(hasSdkWindow(variant) ? { ['ui/' + windowScriptName(variant)]: renderWindowScript(variant, assetVersion, icons, options.portalText, moduleVersion) } : {}),
|
|
277
286
|
...(variant.daemon || variant.compose ? { 'daemon/config.json': daemonConfig(variant) } : {}),
|
|
278
287
|
...(variant.installSettings ? { 'install/settings.json': JSON.stringify(settingsConfig(variant), null, 2) + '\n' } : {}),
|
|
@@ -337,7 +346,7 @@ export async function assembleStandaloneSpk(options) {
|
|
|
337
346
|
...(gatewayAdmissionPolicy(manifest.identityGateway, manifest.entry) ? { provider_only_oidc: gatewayAdmissionPolicy(manifest.identityGateway, manifest.entry) } : {}),
|
|
338
347
|
...(manifest.identityGateway && gatewayExternalAccess(manifest.identityGateway)
|
|
339
348
|
? { gateway_external: gatewayExternalAccess(manifest.identityGateway) } : {}),
|
|
340
|
-
...(nativeGatewaySupported(manifest) ? { native_gateway: { sdk: manifest.identityGateway.sdk, listen: manifest.identityGateway.listen, ...(manifest.identityGateway.ingress ? { ingress: manifest.identityGateway.ingress } : {}) } } : {}),
|
|
349
|
+
...(nativeGatewaySupported(manifest) ? { native_gateway: { sdk: manifest.identityGateway.sdk, listen: manifest.identityGateway.listen, ...(manifest.identityGateway.ingress ? { ingress: manifest.identityGateway.ingress } : {}), ...(manifest.identityGateway.origin ? { origin: manifest.identityGateway.origin } : {}) } } : {}),
|
|
341
350
|
...(manifest.daemon?.ingress ? { daemon_ingress: manifest.daemon.ingress } : {}),
|
|
342
351
|
...(manifest.daemon?.node ? { daemon_node: manifest.daemon.node } : {}),
|
|
343
352
|
...(manifest.daemon?.nofile !== undefined ? { daemon_nofile: manifest.daemon.nofile } : {}),
|
package/docs/install-ports.md
CHANGED
|
@@ -10,18 +10,24 @@ identity_gateway:
|
|
|
10
10
|
listen: {https: 28443}
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
The manifest's gateway HTTP/HTTPS listeners
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
The manifest's gateway HTTP/HTTPS listeners, optional local OIDC issuer port
|
|
14
|
+
and optional second origin port (`identity_gateway.origin.https`, key
|
|
15
|
+
`gateway_origin`) are the defaults. The install wizard shows each port with a
|
|
16
|
+
localized label and reason. It refuses values that are not a number in
|
|
17
|
+
1024–65535. Reserved DSM/discovery ports, duplicates and conflicts returned by
|
|
18
|
+
DSM's `SYNO.Core.Service.PortInfo` listing are inline warnings; Next stays
|
|
19
|
+
available. An unreadable listing establishes no conflict.
|
|
19
20
|
|
|
20
21
|
The SDK repeats the check with DSM's `servicetool --conf-port-conflict-check` as
|
|
21
22
|
the package account. It parses the documented `IsConflict` output and allows
|
|
22
23
|
only its exact existing service ID during upgrade. A successful command exit
|
|
23
|
-
alone does not mean a port is free. A
|
|
24
|
-
|
|
24
|
+
alone does not mean a port is free. A confirmed conflict refuses the port,
|
|
25
|
+
except for ports declared with `conflict: warn` in `install/ports.json` (the
|
|
26
|
+
CLI declares `gateway_origin` this way): their conflict is written to stderr,
|
|
27
|
+
which DSM keeps in the installation log, and the port is kept. Format, range,
|
|
28
|
+
reserved and duplicate values are always refused. A concurrent change can still
|
|
29
|
+
race a check; DSM's native resource acquisition and the listener bind remain
|
|
30
|
+
final checks.
|
|
25
31
|
|
|
26
32
|
The package-account preinst controller materializes the selected values into all
|
|
27
33
|
generated consumers: gateway configuration, nginx ingress, DSM window launcher,
|
|
@@ -56,10 +62,19 @@ fixed protocol discovery ports keep their upstream contract; changing a public
|
|
|
56
62
|
host listener does not change the container's internal listening port.
|
|
57
63
|
|
|
58
64
|
Upgrade retains the saved port selection and ignores new wizard environment
|
|
59
|
-
values.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
values. The UI never copies private retained settings into a package or report.
|
|
66
|
+
|
|
67
|
+
## Change ports after installation
|
|
68
|
+
|
|
69
|
+
An App's own settings page changes installed ports with the SDK's
|
|
70
|
+
`installsettings.ChangePorts(payload, package, pkgvar, map[string]int{"gateway_origin": 6443})`,
|
|
71
|
+
run as the package account. Only declared keys change; the same refusals and
|
|
72
|
+
conflict policies as installation apply, and warnings are returned. It rewrites
|
|
73
|
+
the generated payload files, `install/<package>.sc`, the environment and the
|
|
74
|
+
retained values, so later upgrades keep the change. DSM applies the new nginx
|
|
75
|
+
and port-config resources only when the package starts: restart the package
|
|
76
|
+
afterwards (the SDK's `selfrestart`). Re-enter any required HTTPS origin that
|
|
77
|
+
names a changed port. Reinstalling with new wizard values also works.
|
|
63
78
|
|
|
64
79
|
Use `--param pkgwizard_port_gateway_https=29443` for a first CLI deployment;
|
|
65
80
|
programmatic upgrades reject port changes. Apps must adopt `install.ports: true`
|
package/docs/path-ingress.md
CHANGED
|
@@ -136,6 +136,65 @@ package and check both the active nginx location and an authenticated browser
|
|
|
136
136
|
navigation. Include anonymous denial, the original entry policy and upstream
|
|
137
137
|
assets/API calls; a successful install response alone is insufficient.
|
|
138
138
|
|
|
139
|
+
## Second origin port
|
|
140
|
+
|
|
141
|
+
An App with path ingress can also serve a separate browser origin, for example
|
|
142
|
+
to show another web application that needs `/` and its own cookies:
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
install:
|
|
146
|
+
ports: true
|
|
147
|
+
identity_gateway:
|
|
148
|
+
sdk: <sdk-with-OriginVersion>
|
|
149
|
+
mode: none
|
|
150
|
+
upstream: unix:reverse-ingress.sock
|
|
151
|
+
ingress: {path: /synopkgland/ExampleApp/}
|
|
152
|
+
upstream_auth_paths: [/reverse]
|
|
153
|
+
origin:
|
|
154
|
+
https: 5443 # default; the installer may change it
|
|
155
|
+
upstream: unix:dsm-relay.sock # /var/packages/<package>/var/run/<name>.sock
|
|
156
|
+
cookies: dsm-passthrough # optional
|
|
157
|
+
headers: {user: X-Relay-User} # optional; needs user
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`origin` needs `ingress`, `install.ports: true`, no Compose, DSM 7.2-64570 or
|
|
161
|
+
later and an SDK whose `idgateway` declares `OriginVersion = 1`. Its keys are
|
|
162
|
+
`https` (1024–65535, not a reserved DSM port and not another gateway port),
|
|
163
|
+
`upstream` (a Unix socket of the package, as above), `cookies` and `headers`.
|
|
164
|
+
|
|
165
|
+
The build adds `sso/native-origin-nginx.conf`, a DSM nginx `server` block that
|
|
166
|
+
listens on the port with DSM's certificate and forwards everything to the
|
|
167
|
+
gateway's second mutually authenticated socket
|
|
168
|
+
(`/tmp/synopkgland-gateway-<package>-origin.sock`). It is enabled with
|
|
169
|
+
`nginx-static-config` `{type: server}` next to the `dsm` path entry; the
|
|
170
|
+
`port-config` resource registers the port. `inspect` replays this block and the
|
|
171
|
+
gateway's `origin` entry.
|
|
172
|
+
|
|
173
|
+
On that port the gateway:
|
|
174
|
+
|
|
175
|
+
- admits only DSM administrators (the entry is always `admin-only`), whatever the
|
|
176
|
+
App's own entry policy;
|
|
177
|
+
- uses its own session cookie, `synopkgland_sso_<package>_origin`;
|
|
178
|
+
- accepts the sign-in return only for `https://<same host>:<port>/_sso/return`.
|
|
179
|
+
The browser must already be signed in to DSM on that host; otherwise the
|
|
180
|
+
origin shows `login_required` instead of DSM's login page;
|
|
181
|
+
- sends the signed-in administrator in `headers` when `user` is set, otherwise
|
|
182
|
+
no identity;
|
|
183
|
+
- proxies WebSocket upgrades and long polls without a response timeout.
|
|
184
|
+
|
|
185
|
+
Cookies: by default the gateway strips DSM's cookies as on every other route.
|
|
186
|
+
`cookies: dsm-passthrough` forwards the upstream's own `_SSID`, `_CrPoSt`,
|
|
187
|
+
`stay_login` and other cookies in both directions, leaves response
|
|
188
|
+
`Set-Cookie` headers to the upstream, and removes only the gateway's cookies and
|
|
189
|
+
DSM's `id` and `did`, which belong to the DSM origin on the same host.
|
|
190
|
+
|
|
191
|
+
The port is the installer port `gateway_origin`. The wizard shows it as
|
|
192
|
+
"Dedicated HTTPS port"; a port that DSM already lists as used is a warning only,
|
|
193
|
+
for this port also in the package-account controller. Format, range, reserved
|
|
194
|
+
and duplicate values are refused. A port that is really in use makes the App
|
|
195
|
+
fail to start. To change the port after installation, see
|
|
196
|
+
[installer-selected ports](install-ports.md#change-ports-after-installation).
|
|
197
|
+
|
|
139
198
|
## Application Portal
|
|
140
199
|
|
|
141
200
|
With `portal`, every generated path ingress is also registered as `type: www`
|
package/package.json
CHANGED
|
@@ -9,6 +9,23 @@
|
|
|
9
9
|
"type": "string",
|
|
10
10
|
"enum": ["required"],
|
|
11
11
|
"description": "Require an HTTPS browser origin; HTTP document navigations show localized guidance, other App requests receive https_required; omit to retain HTTP support"
|
|
12
|
+
},
|
|
13
|
+
"origin": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"description": "A second, administrator-only HTTPS origin on its own port, served by DSM nginx with DSM's certificate; needs install.ports: true so the administrator can choose the port",
|
|
16
|
+
"required": ["https", "upstream"],
|
|
17
|
+
"properties": {
|
|
18
|
+
"https": {"type": "integer", "minimum": 1024, "maximum": 65535, "description": "Default port; installer and App settings may change it"},
|
|
19
|
+
"upstream": {"type": "string", "pattern": "^unix:[a-z0-9][a-z0-9-]{0,58}\\.sock$", "description": "The App's private socket under var/run"},
|
|
20
|
+
"cookies": {"type": "string", "enum": ["dsm-passthrough"], "description": "Forward DSM's _SSID, _CrPoSt and stay_login cookies both ways (a proxied DSM)"},
|
|
21
|
+
"headers": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"required": ["user"],
|
|
24
|
+
"properties": {"user": {"type": "string"}, "email": {"type": "string"}, "name": {"type": "string"}, "groups": {"type": "string"}, "uid": {"type": "string"}},
|
|
25
|
+
"additionalProperties": false
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"additionalProperties": false
|
|
12
29
|
}
|
|
13
30
|
},
|
|
14
31
|
"additionalProperties": true
|
|
@@ -375,3 +375,12 @@ NAS route ownership, including saved aliases and stopped SDK packages, and fails
|
|
|
375
375
|
closed if inventory cannot be checked. DSM owns registration, upgrade replacement
|
|
376
376
|
and uninstall cleanup; never overwrite or remove another owner's config. The
|
|
377
377
|
menu CGI URL remains stable. See [path ingress](https://github.com/synopackageland/syno-pkg-land-cli/blob/main/docs/path-ingress.md).
|
|
378
|
+
|
|
379
|
+
A path-ingress App may add `identity_gateway.origin: {https: 5443, upstream: unix:<name>.sock}`
|
|
380
|
+
for a second, administrator-only browser origin on its own HTTPS port (DSM nginx
|
|
381
|
+
`server` block, installer port `gateway_origin`, conflicts only warn). It needs
|
|
382
|
+
`install.ports: true` and an SDK with `OriginVersion`. `cookies: dsm-passthrough`
|
|
383
|
+
forwards the upstream's own cookies except DSM's `id`/`did`; `headers.user`
|
|
384
|
+
sends the administrator's name. The browser must already be signed in to DSM.
|
|
385
|
+
Change the port later with `installsettings.ChangePorts` and a package restart.
|
|
386
|
+
See [second origin port](https://github.com/synopackageland/syno-pkg-land-cli/blob/main/docs/path-ingress.md#second-origin-port).
|
|
@@ -49,7 +49,7 @@ The upgrade wizard prefills and submits the recorded folder without a separate c
|
|
|
49
49
|
|
|
50
50
|
Uninstall retains the share, files and package account's ACL because DSM data-share Release does nothing. Old selected shares can retain that ACL too. To revoke it, an administrator opens Control Panel > Shared Folder > the folder > Edit > Permissions > System internal user, clears the package account's Read only/Read/Write permission and saves, preserving other rows and data. See [shared-folder behavior](../../docs/shared-folders.md).
|
|
51
51
|
|
|
52
|
-
Port fields default to declared gateway HTTP/HTTPS
|
|
52
|
+
Port fields default to declared gateway HTTP/HTTPS, local OIDC listener and second-origin (`gateway_origin`) ports. Validation refuses noncanonical numbers and values outside 1024–65535. Reserved DSM/discovery ports, duplicate selections and conflicts from DSM's `SYNO.Core.Service.PortInfo` inventory produce inline warnings; Next remains available. The inventory is advisory: API, permission or parsing failures do not block Next, and an unsupported row does not hide a later confirmed conflict. DSM's all-protocol entries cover TCP too; numeric ports and string ranges are accepted. The package-account controller repeats the native service conflict check and materializes gateway, nginx, launcher, daemon and `.sc` port-config data from the selected values. A real conflict can still prevent the App from starting.
|
|
53
53
|
|
|
54
54
|
Native subprocesses and Compose `.env` receive `SYNOPKGLAND_PORT_GATEWAY_HTTP`, `SYNOPKGLAND_PORT_GATEWAY_HTTPS` and, when declared, `SYNOPKGLAND_PORT_OIDC_ISSUER`. Go Apps can read `installsettings.PortValues(payloadRoot)`. Bind upstream public-port configuration declaratively:
|
|
55
55
|
|
|
@@ -66,7 +66,7 @@ compose:
|
|
|
66
66
|
|
|
67
67
|
Existing runtime file templates can use the same variable in the App's own configuration. Container-internal listener and fixed discovery ports keep their upstream contract. Do not hard-code the selected host port elsewhere.
|
|
68
68
|
|
|
69
|
-
Upgrade retains the saved ports and ignores submitted replacements.
|
|
69
|
+
Upgrade retains the saved ports and ignores submitted replacements. To change ports, the App calls the SDK's `installsettings.ChangePorts` as the package account and restarts the package, or the user reinstalls; then re-enter any required HTTPS origin with its new HTTPS port. The package-account check refuses a confirmed conflict except on a `conflict: warn` port (`gateway_origin`), where it only warns. First-install CLI automation accepts `--param pkgwizard_port_gateway_https=29443`; programmatic upgrade refuses port changes. Omit `install.ports` when no identity gateway is declared.
|
|
70
70
|
|
|
71
71
|
Use `install.settings` with `type: https-origin`, a localized label and explicit `required: true` for an origin needed by the App. The wizard blocks Next for missing or malformed values and checks the selected HTTPS port. Runtime validation repeats the check.
|
|
72
72
|
|
|
@@ -288,6 +288,11 @@ ui:
|
|
|
288
288
|
- build 寫入 `etc/short-paths-nginx.conf`:`location = /connect` 與 `location = /connect/`,回 302、相對 `Location`
|
|
289
289
|
(`absolute_redirect off`,經反向代理或 tunnel 進來也不會被帶到 :5001),query 照傳,fragment 由瀏覽器保留。
|
|
290
290
|
不 proxy、不碰 cookie、不跑套件程式。
|
|
291
|
+
- 網址列維持短網址:302 在 query 最前面加 `spl-short=<path>`;`.html` 目標頁由 build 在 `<head>` 最前面(頁面已有 `<base>` 就放在它後面)
|
|
292
|
+
插一段小 script,加上指向實際頁面的 `<base href>` 後用 `history.replaceState` 換回 `/connect?<query>#<fragment>`;短網址到 `app` 由 SDK entry boot
|
|
293
|
+
處理(同分頁 DSM 登入後也維持)。重新整理、書籤、iOS 加到主畫面都回到短網址並載入目前 build;沒有標記(直接開 stable page/長網址、
|
|
294
|
+
Application Portal 網域)就不改網址,長網址照常可用。頁面程式讀 `location.pathname` 會得到短網址,套件內網址請用 `document.baseURI`
|
|
295
|
+
或相對網址;只有 fragment 的連結(`href="#top"`)會解析到實際頁面並重新載入。
|
|
291
296
|
- DSM `web-config` worker 在套件啟動時加入 DSM server(5000/5001 與 DSM 自訂網域),停止時移除;停止或解除安裝後回 404。
|
|
292
297
|
有 `portal` 也只註冊在 DSM server:80/443 不提供 `/webman/3rdparty/`。
|
|
293
298
|
- 規則:單一小寫片段(字母、數字、中間的 `-`,最多 64 字元,不可結尾 `/`),最多 4 個;不可用 `/`、DSM/SDK 名稱
|