@synopackageland/cli 0.54.4 → 0.54.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/runtime/approval-diff.js +8 -2
- package/dist/spk/approval-baseline.d.ts +6 -0
- package/dist/spk/approval-baseline.js +153 -0
- package/dist/spk/inspect.d.ts +1 -1
- package/dist/spk/inspect.js +7 -0
- package/dist/standalone/entry-page.d.ts +18 -9
- package/dist/standalone/entry-page.js +18 -9
- package/dist/standalone/inspect-spk.js +10 -0
- package/dist/standalone/mobile.d.ts +6 -1
- package/dist/standalone/mobile.js +38 -12
- package/dist/standalone/spk.js +1 -1
- package/docs/app-entry.md +22 -0
- package/package.json +1 -1
- package/skills/SKILL.md +4 -4
- package/skills/reference/approval-upgrades.md +19 -15
- package/skills/reference/create.md +3 -3
- package/skills/reference/mobile.md +18 -6
- package/skills/reference/portal.md +3 -3
- package/skills/reference/ui-vue.md +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.54.6 (2026-11-15)
|
|
4
|
+
|
|
5
|
+
- Approval baselines with an SDK inventory read historical approval facts instead of replaying the latest UI and lifecycle formats. Older entry pages without `launch.html` remain comparable; missing facts, inconsistent payload/asset pins and invalid executor task bindings report `APPROVAL_BASELINE_INVALID` with the failing fact.
|
|
6
|
+
- The build-stamped entry runtime writes `meta[name="synopkgland-build"]` before boot. Cached fixed entry HTML can identify the current build without changing its bytes or URL.
|
|
7
|
+
|
|
8
|
+
## 0.54.5 (2026-11-15)
|
|
9
|
+
|
|
10
|
+
- The url launcher, a short path to `app` and the mobile `entry` open the fixed entry page as `launch.html`, a file name no earlier build used. Browsers cached the old build-specific `entry.html` as fresh for years (DSM sends package files without Cache-Control and with a 1970 Last-Modified), so after an upgrade the main menu could open the old build. `entry.html` keeps the same fixed content for old links. `inspect` checks both pages and reports a launcher that still points at `entry.html`.
|
|
11
|
+
- The generated entry page starts downloading the App's first screen while it signs in: the classic `app.js` as a preload and the first-screen modules listed in the build's `entry-preload.json` as `modulepreload`. App code still runs only after the identity is verified.
|
|
12
|
+
- Skill references name the entry SDK requirement without a release number.
|
|
13
|
+
|
|
3
14
|
## 0.54.4 (2026-11-15)
|
|
4
15
|
|
|
5
16
|
- SDK-window Apps with `ui.launch: new-page` open the SDK entry page from DSM's main menu and Package Center: `ui/config` registers `SYNO.SDS.<pkg>.Instance` as a `type: "url"` launcher at `/webman/3rdparty/<pkg>/app/entry.html`, keeping `defaultAlias`, the sign-in style and Application Privileges, so the App no longer waits for DSM's desktop to boot. Console, compose and identity-gateway Apps keep their launchers. Every such App gets an entry page, not only `mobile.entry: app`.
|
|
@@ -87,9 +87,15 @@ export async function spkApprovalDiff(current, baseline, report) {
|
|
|
87
87
|
if (!baseline)
|
|
88
88
|
return noApproval(nextReport) ? notRequired() : approvalDiff(undefined, undefined);
|
|
89
89
|
const next = inventory(nextReport);
|
|
90
|
-
|
|
90
|
+
let old;
|
|
91
|
+
try {
|
|
92
|
+
old = await inspectAnySpk(baseline, { baseline: true });
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
throw new Error('[APPROVAL_BASELINE_INVALID] Cannot read baseline archive or approval facts: ' + error.message);
|
|
96
|
+
}
|
|
91
97
|
if (!old.dsm.ok || old.findings.length)
|
|
92
|
-
throw new Error('[APPROVAL_BASELINE_INVALID] Baseline
|
|
98
|
+
throw new Error('[APPROVAL_BASELINE_INVALID] Baseline approval facts are invalid: ' + [...old.findings, ...old.dsm.errors.map(e => e.message)].join('; '));
|
|
93
99
|
const diff = old.package === nextReport.package && old.arch === nextReport.arch && noApproval(old) && noApproval(nextReport) ? notRequired() : approvalDiff(inventory(old), next);
|
|
94
100
|
return resourceDiff(old, nextReport, diff);
|
|
95
101
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SpkInspection } from '../standalone/inspect-spk.js';
|
|
2
|
+
/** Read facts, never replay the current CLI's UI or lifecycle generators on a released package.
|
|
3
|
+
* Archive safety is checked by the caller before this private directory is read.
|
|
4
|
+
* Checksums and executor pins establish consistency, not publisher authenticity.
|
|
5
|
+
*/
|
|
6
|
+
export declare function inspectApprovalBaseline(dir: string, payload: SpkInspection['payload']): SpkInspection;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { parseDocument } from 'yaml';
|
|
5
|
+
import { parseInfo } from './check-info.js';
|
|
6
|
+
import { Findings } from './findings.js';
|
|
7
|
+
import { inspectExecutor, inspectExecutorAnchor } from '../runtime/executor-inspect.js';
|
|
8
|
+
function object(value) {
|
|
9
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
10
|
+
}
|
|
11
|
+
/** Read facts, never replay the current CLI's UI or lifecycle generators on a released package.
|
|
12
|
+
* Archive safety is checked by the caller before this private directory is read.
|
|
13
|
+
* Checksums and executor pins establish consistency, not publisher authenticity.
|
|
14
|
+
*/
|
|
15
|
+
export function inspectApprovalBaseline(dir, payload) {
|
|
16
|
+
const findings = [];
|
|
17
|
+
const result = { signed: existsSync(join(dir, 'syno_signature.asc')), payload, findings, capabilities: [] };
|
|
18
|
+
let fact = 'INFO identity';
|
|
19
|
+
try {
|
|
20
|
+
const infoText = readFileSync(join(dir, 'INFO'), 'utf8');
|
|
21
|
+
const parsed = new Findings();
|
|
22
|
+
const info = Object.fromEntries(parseInfo(infoText, parsed));
|
|
23
|
+
if (parsed.list.length)
|
|
24
|
+
throw Error(parsed.list.map(f => f.message).join('; '));
|
|
25
|
+
for (const key of ['package', 'arch', 'version'])
|
|
26
|
+
if (!info[key])
|
|
27
|
+
throw Error(`missing INFO ${key}`);
|
|
28
|
+
if (!/^[A-Za-z][A-Za-z0-9_]{1,63}$/.test(info.package))
|
|
29
|
+
throw Error('invalid INFO package');
|
|
30
|
+
Object.assign(result, { package: info.package, arch: info.arch, version: info.version });
|
|
31
|
+
fact = 'payload checksum';
|
|
32
|
+
const checksum = createHash('md5').update(readFileSync(join(dir, 'package.tgz'))).digest('hex');
|
|
33
|
+
if (info.checksum?.toLowerCase() !== checksum)
|
|
34
|
+
throw Error('INFO checksum does not match package.tgz');
|
|
35
|
+
fact = 'capability inventory';
|
|
36
|
+
const metadata = readObject(join(dir, 'sdk-package.json'));
|
|
37
|
+
if (metadata.schema !== 2 || !Array.isArray(metadata.capabilities) ||
|
|
38
|
+
metadata.capabilities.some((c) => typeof c !== 'string' || !['files', 'jobs', 'identity', 'rootOps', 'delegate', 'webapi', 'composeMounts'].includes(c)) ||
|
|
39
|
+
new Set(metadata.capabilities).size !== metadata.capabilities.length)
|
|
40
|
+
throw Error('sdk-package.json must contain schema 2 capabilities');
|
|
41
|
+
result.capabilities = metadata.capabilities.map((name) => ({ name, requiresAdminApproval: ['rootOps', 'delegate', 'webapi'].includes(name) }));
|
|
42
|
+
fact = 'recorded entry asset digests';
|
|
43
|
+
for (const name of ['mobile', 'entry_page']) {
|
|
44
|
+
const record = metadata[name];
|
|
45
|
+
if (record === undefined)
|
|
46
|
+
continue;
|
|
47
|
+
if (!object(record) || !object(record.files) || !Object.keys(record.files).length)
|
|
48
|
+
throw Error(`invalid ${name} file inventory`);
|
|
49
|
+
for (const [path, digest] of Object.entries(record.files)) {
|
|
50
|
+
if (!/^(?:[\w~-][\w.~-]*\/)*[\w~-][\w.~-]*$/.test(path) || typeof digest !== 'string' || !/^[a-f0-9]{64}$/.test(digest))
|
|
51
|
+
throw Error(`invalid ${name} file pin`);
|
|
52
|
+
const actual = createHash('sha256').update(readFileSync(join(dir, 'approval-payload/ui/app', path))).digest('hex');
|
|
53
|
+
if (actual !== digest)
|
|
54
|
+
throw Error(`${name} digest mismatch for ${path}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
fact = 'package privilege';
|
|
58
|
+
const privilege = readObject(join(dir, 'conf/privilege'));
|
|
59
|
+
if (JSON.stringify(privilege) !== JSON.stringify({ defaults: { 'run-as': 'package' } }))
|
|
60
|
+
throw Error('conf/privilege must contain only defaults.run-as: package');
|
|
61
|
+
fact = 'DSM resource registrations';
|
|
62
|
+
const resources = existsSync(join(dir, 'conf/resource')) ? readObject(join(dir, 'conf/resource')) : undefined;
|
|
63
|
+
const paths = new Set(payload.map(p => p.path));
|
|
64
|
+
// These files/declarations require registrations even if conf/resource was removed.
|
|
65
|
+
if (resources)
|
|
66
|
+
validateResources(resources, paths, dir);
|
|
67
|
+
const web = object(resources?.['web-config']) ? resources['web-config'] : undefined;
|
|
68
|
+
const nginx = object(web?.['nginx-static-config']) ? web['nginx-static-config'].enable : undefined;
|
|
69
|
+
const required = [
|
|
70
|
+
...(metadata.daemon_ingress ? ['daemon/ingress-nginx.conf'] : []),
|
|
71
|
+
...(metadata.native_gateway ? ['sso/native-nginx.conf'] : []),
|
|
72
|
+
...(metadata.short_paths ? ['etc/short-paths-nginx.conf'] : []),
|
|
73
|
+
];
|
|
74
|
+
for (const path of required)
|
|
75
|
+
if (!Array.isArray(nginx) || !nginx.some(e => object(e) && e.relpath === path))
|
|
76
|
+
throw Error(`missing registration for ${path}`);
|
|
77
|
+
if (paths.has('etc/portal.json') && !web?.['app-portal'])
|
|
78
|
+
throw Error('missing app-portal registration');
|
|
79
|
+
if (resources) {
|
|
80
|
+
result.resources = resources;
|
|
81
|
+
}
|
|
82
|
+
fact = 'executor policy, payload pins and task templates';
|
|
83
|
+
const hasExecutor = result.capabilities.some(c => c.requiresAdminApproval) ||
|
|
84
|
+
payload.some(p => p.path.startsWith('executor/')) || info.synopkgland_executor_sha256 !== undefined;
|
|
85
|
+
if (hasExecutor) {
|
|
86
|
+
const inspected = inspectExecutor(join(dir, 'approval-payload'), info.package, info.arch);
|
|
87
|
+
if (!inspected.executor || inspected.findings.length)
|
|
88
|
+
throw Error(inspected.findings.join('; '));
|
|
89
|
+
const anchor = inspectExecutorAnchor(infoText, inspected.executor.executorDigest);
|
|
90
|
+
if (anchor.length)
|
|
91
|
+
throw Error(anchor.join('; '));
|
|
92
|
+
result.executor = inspected.executor;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
if (error.message.startsWith('[SDK_DOWNLOAD_FAILED]'))
|
|
97
|
+
throw error;
|
|
98
|
+
findings.push(`Cannot read approval fact ${fact}: ${error.message}`);
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
function readObject(path) {
|
|
103
|
+
const text = readFileSync(path, 'utf8');
|
|
104
|
+
const value = JSON.parse(text);
|
|
105
|
+
if (parseDocument(text, { uniqueKeys: true }).errors.length || !object(value))
|
|
106
|
+
throw Error(`${path.split('/').pop()} must be an unambiguous JSON object`);
|
|
107
|
+
return value;
|
|
108
|
+
}
|
|
109
|
+
/** Interpret the shipped registrations, without requiring today's serialization or HTML targets. */
|
|
110
|
+
function validateResources(resources, paths, dir) {
|
|
111
|
+
const allowed = ['web-config', 'data-share', 'systemd-user-unit', 'docker-project', 'webservice', 'video-driver', 'port-config'];
|
|
112
|
+
for (const [worker, value] of Object.entries(resources)) {
|
|
113
|
+
if (!allowed.includes(worker) || !object(value))
|
|
114
|
+
throw Error(`unreadable resource worker ${worker}`);
|
|
115
|
+
if (worker === 'systemd-user-unit' && (!existsSync(join(dir, 'conf/systemd')) || !readdirSync(join(dir, 'conf/systemd')).length))
|
|
116
|
+
throw Error('missing systemd unit inventory');
|
|
117
|
+
}
|
|
118
|
+
const web = resources['web-config'];
|
|
119
|
+
if (object(web)) {
|
|
120
|
+
if (Object.keys(web).some(k => !['app-portal', 'nginx-static-config'].includes(k)))
|
|
121
|
+
throw Error('unknown web-config registration');
|
|
122
|
+
const nginx = web['nginx-static-config'];
|
|
123
|
+
if (nginx !== undefined) {
|
|
124
|
+
if (!object(nginx) || Object.keys(nginx).length !== 1 || !Array.isArray(nginx.enable) || !nginx.enable.length)
|
|
125
|
+
throw Error('invalid nginx-static-config inventory');
|
|
126
|
+
const seen = new Set();
|
|
127
|
+
for (const e of nginx.enable) {
|
|
128
|
+
if (!object(e) || Object.keys(e).length !== 2 || typeof e.type !== 'string' || !['dsm', 'www', 'server'].includes(e.type) || typeof e.relpath !== 'string')
|
|
129
|
+
throw Error('invalid nginx registration');
|
|
130
|
+
const key = `${e.type}:${e.relpath}`;
|
|
131
|
+
if (seen.has(key))
|
|
132
|
+
throw Error('duplicate nginx registration');
|
|
133
|
+
seen.add(key);
|
|
134
|
+
if (e.type === 'www' && !web['app-portal'])
|
|
135
|
+
throw Error('www registration has no app-portal');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// DSM resource paths must point to files in this package, never another package.
|
|
140
|
+
function references(value) {
|
|
141
|
+
if (!object(value) && !Array.isArray(value))
|
|
142
|
+
return;
|
|
143
|
+
for (const [key, child] of Object.entries(value)) {
|
|
144
|
+
if (key === 'relpath' || key.endsWith('-relpath') || key === 'protocol-file') {
|
|
145
|
+
if (typeof child !== 'string' || !paths.has(child))
|
|
146
|
+
throw Error(`resource ${key} does not name a payload file: ${String(child)}`);
|
|
147
|
+
}
|
|
148
|
+
else
|
|
149
|
+
references(child);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
references(resources);
|
|
153
|
+
}
|
package/dist/spk/inspect.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface SpkReport extends SpkInspection {
|
|
|
4
4
|
/** Built by synopkgland, so its build contract (`findings`) was checked too. */
|
|
5
5
|
synopkgland: boolean;
|
|
6
6
|
info?: Record<string, string>;
|
|
7
|
-
/**
|
|
7
|
+
/** DSM 7 format validation; baseline mode validates historical approval facts instead. */
|
|
8
8
|
dsm: {
|
|
9
9
|
ok: boolean;
|
|
10
10
|
errors: SpkFinding[];
|
package/dist/spk/inspect.js
CHANGED
|
@@ -15,6 +15,13 @@ const CONTAINER_MARKER = "synology-app.yaml";
|
|
|
15
15
|
* others are never held to it.
|
|
16
16
|
*/
|
|
17
17
|
export async function inspectAnySpk(spkPath, options = {}) {
|
|
18
|
+
if (options.baseline) {
|
|
19
|
+
const facts = await readFacts(spkPath);
|
|
20
|
+
if (facts.top.has('sdk-package.json') || facts.payload.some(p => p.path.startsWith('executor/'))) {
|
|
21
|
+
const inspection = await inspectSpk(spkPath, undefined, options);
|
|
22
|
+
return { ...inspection, synopkgland: true, dsm: { ok: inspection.findings.length === 0, errors: [], warnings: [] } };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
18
25
|
const validation = await validateSpk(spkPath, { sourceMaps: false });
|
|
19
26
|
const dsm = { ok: validation.ok, errors: validation.errors, warnings: validation.warnings };
|
|
20
27
|
const facts = await readFacts(spkPath);
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import type { StandaloneManifest } from "./manifest.js";
|
|
2
2
|
/**
|
|
3
|
-
* The SDK entry page: `ui/app/
|
|
4
|
-
* `/webman/3rdparty/<package>/app/
|
|
3
|
+
* The SDK entry page: `ui/app/launch.html`, served by DSM at
|
|
4
|
+
* `/webman/3rdparty/<package>/app/launch.html` without DSM's desktop.
|
|
5
5
|
*
|
|
6
6
|
* DSM serves package files with no Cache-Control, Last-Modified 1970 and an
|
|
7
|
-
* ETag of the size alone
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* ETag of the size alone. Browsers treat such a file as fresh for years
|
|
8
|
+
* (heuristic freshness is a tenth of its age) and open it from the cache
|
|
9
|
+
* without asking DSM, even after an upgrade. The page is therefore fixed
|
|
10
|
+
* bytes, the same in every build and package: it reads the current build
|
|
11
|
+
* from `entry.json` with a no-store, cache-busted request and loads that
|
|
12
|
+
* build's `?v=` stamped module, stylesheet and icon.
|
|
13
|
+
*
|
|
14
|
+
* Before CLI 0.54.4, `entry.html` carried its build, so a browser that opened
|
|
15
|
+
* it keeps that build's page. Every launch therefore opens `launch.html`, a
|
|
16
|
+
* name no build ever served with other bytes; `entry.html` stays, as the same
|
|
17
|
+
* page, for older links. Changing the page's bytes needs a new file name.
|
|
12
18
|
*/
|
|
13
|
-
export declare const ENTRY_PAGE_FILE = "
|
|
19
|
+
export declare const ENTRY_PAGE_FILE = "launch.html";
|
|
20
|
+
/** The entry page's earlier name, kept with the same bytes for older links and registrations. */
|
|
21
|
+
export declare const LEGACY_ENTRY_PAGE_FILE = "entry.html";
|
|
14
22
|
export declare const ENTRY_POINTER_FILE = "entry.json";
|
|
15
23
|
export declare function entryPagePath(pkg: string): string;
|
|
16
24
|
/** The ui.short_paths target that names the entry page instead of a stable page. */
|
|
@@ -27,7 +35,8 @@ export declare function entryLauncher(manifest: LauncherManifest): boolean;
|
|
|
27
35
|
export declare function hasEntryPage(manifest: LauncherManifest & Pick<StandaloneManifest, "mobile">): boolean;
|
|
28
36
|
/** The first short path (in path order) that opens the entry page; ctx.entryURL uses it. */
|
|
29
37
|
export declare function entryShortPath(manifest: Pick<StandaloneManifest, "ui">): string | undefined;
|
|
30
|
-
/** Fixed bytes: a cached copy from any build or package keeps working, since it reads entry.json.
|
|
38
|
+
/** Fixed bytes: a cached copy from any build or package keeps working, since it reads entry.json.
|
|
39
|
+
* Never change them under the same file name (see ENTRY_PAGE_FILE). */
|
|
31
40
|
export declare const ENTRY_PAGE_STUB = "<!doctype html>\n<html><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\"><meta name=\"referrer\" content=\"same-origin\"><title></title><style>html,body,.dsmapp-root{margin:0;height:100%;min-height:100%}</style></head>\n<body><div class=\"dsmapp-root\"></div><noscript>This page needs JavaScript.</noscript><script>\n(function () {\n var asset = /^\\.\\/(?:[\\w~-][\\w.~-]*\\/)*[\\w~-][\\w.~-]*\\?v=[0-9a-f]{64}$/;\n function fail() { document.body.textContent = \"This page is not available. Reload to try again.\"; }\n function add(parent, tag, attrs) { var node = document.createElement(tag); for (var key in attrs) node[key] = attrs[key]; parent.appendChild(node); return node; }\n try {\n fetch(\"entry.json?t=\" + Date.now(), {cache: \"no-store\", credentials: \"same-origin\", redirect: \"error\"})\n .then(function (r) { if (!r.ok) throw 0; return r.json(); })\n .then(function (p) {\n if (!p || p.v !== 1 || typeof p.title !== \"string\" || !asset.test(p.script) || !asset.test(p.css) || !asset.test(p.icon)) throw 0;\n document.title = p.title;\n add(document.head, \"link\", {rel: \"icon\", href: p.icon});\n add(document.head, \"link\", {rel: \"stylesheet\", href: p.css});\n add(document.body, \"script\", {type: \"module\", src: p.script, onerror: fail});\n })\n .catch(fail);\n } catch (e) { fail(); }\n})();\n</script></body></html>\n";
|
|
32
41
|
export interface EntryPointer {
|
|
33
42
|
v: 1;
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import { resolvedSdkLaunch } from "../contract/app-launch.js";
|
|
2
2
|
/**
|
|
3
|
-
* The SDK entry page: `ui/app/
|
|
4
|
-
* `/webman/3rdparty/<package>/app/
|
|
3
|
+
* The SDK entry page: `ui/app/launch.html`, served by DSM at
|
|
4
|
+
* `/webman/3rdparty/<package>/app/launch.html` without DSM's desktop.
|
|
5
5
|
*
|
|
6
6
|
* DSM serves package files with no Cache-Control, Last-Modified 1970 and an
|
|
7
|
-
* ETag of the size alone
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* ETag of the size alone. Browsers treat such a file as fresh for years
|
|
8
|
+
* (heuristic freshness is a tenth of its age) and open it from the cache
|
|
9
|
+
* without asking DSM, even after an upgrade. The page is therefore fixed
|
|
10
|
+
* bytes, the same in every build and package: it reads the current build
|
|
11
|
+
* from `entry.json` with a no-store, cache-busted request and loads that
|
|
12
|
+
* build's `?v=` stamped module, stylesheet and icon.
|
|
13
|
+
*
|
|
14
|
+
* Before CLI 0.54.4, `entry.html` carried its build, so a browser that opened
|
|
15
|
+
* it keeps that build's page. Every launch therefore opens `launch.html`, a
|
|
16
|
+
* name no build ever served with other bytes; `entry.html` stays, as the same
|
|
17
|
+
* page, for older links. Changing the page's bytes needs a new file name.
|
|
12
18
|
*/
|
|
13
|
-
export const ENTRY_PAGE_FILE = "
|
|
19
|
+
export const ENTRY_PAGE_FILE = "launch.html";
|
|
20
|
+
/** The entry page's earlier name, kept with the same bytes for older links and registrations. */
|
|
21
|
+
export const LEGACY_ENTRY_PAGE_FILE = "entry.html";
|
|
14
22
|
export const ENTRY_POINTER_FILE = "entry.json";
|
|
15
23
|
export function entryPagePath(pkg) {
|
|
16
24
|
return `/webman/3rdparty/${pkg}/app/${ENTRY_PAGE_FILE}`;
|
|
@@ -38,7 +46,8 @@ export function entryShortPath(manifest) {
|
|
|
38
46
|
return undefined;
|
|
39
47
|
return Object.entries(paths).filter(([, page]) => page === ENTRY_SHORT_PATH_TARGET).map(([path]) => path).sort()[0];
|
|
40
48
|
}
|
|
41
|
-
/** Fixed bytes: a cached copy from any build or package keeps working, since it reads entry.json.
|
|
49
|
+
/** Fixed bytes: a cached copy from any build or package keeps working, since it reads entry.json.
|
|
50
|
+
* Never change them under the same file name (see ENTRY_PAGE_FILE). */
|
|
42
51
|
export const ENTRY_PAGE_STUB = `<!doctype html>
|
|
43
52
|
<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"><meta name="referrer" content="same-origin"><title></title><style>html,body,.dsmapp-root{margin:0;height:100%;min-height:100%}</style></head>
|
|
44
53
|
<body><div class="dsmapp-root"></div><noscript>This page needs JavaScript.</noscript><script>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { folderPickerWizardFiles } from '../build-spk/folder-picker.js';
|
|
2
|
+
import { inspectApprovalBaseline } from '../spk/approval-baseline.js';
|
|
2
3
|
import { parseDsmStrings } from "./dsm-texts.js";
|
|
3
4
|
import { readTCPListeners } from "./tcp-listeners.js";
|
|
4
5
|
import { entryRecordProblem, inspectEntryFiles, inspectMobileFiles, mobileRecordProblem } from './mobile.js';
|
|
@@ -91,6 +92,15 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
|
|
|
91
92
|
if (findings.length)
|
|
92
93
|
return { signed: existsSync(join(dir, 'syno_signature.asc')), payload: [], findings, capabilities: [] };
|
|
93
94
|
}
|
|
95
|
+
if (options.baseline && (existsSync(join(dir, 'sdk-package.json')) || (await listPayload(join(dir, 'package.tgz'), findings)).some(p => p.path.startsWith('executor/')))) {
|
|
96
|
+
const payload = await listPayload(join(dir, 'package.tgz'), findings);
|
|
97
|
+
const target = join(dir, 'approval-payload');
|
|
98
|
+
mkdirSync(target);
|
|
99
|
+
findings.push(...await extractSpkArchive({ file: join(dir, 'package.tgz'), cwd: target }));
|
|
100
|
+
const baseline = inspectApprovalBaseline(dir, payload);
|
|
101
|
+
baseline.findings.unshift(...findings);
|
|
102
|
+
return baseline;
|
|
103
|
+
}
|
|
94
104
|
if (!expectedKind && existsSync(join(dir, "native-layout.json"))) {
|
|
95
105
|
let dependencies;
|
|
96
106
|
try {
|
|
@@ -62,7 +62,12 @@ export declare const ENTRY_SDK_MIN = "0.53.45";
|
|
|
62
62
|
/** Pure packaging glue; login, cache, portal and host behavior stay in the bundled SDK.
|
|
63
63
|
* Writes the entry page for the url launcher and for a mobile App entry, and
|
|
64
64
|
* mobile.json for a mobile declaration. */
|
|
65
|
-
|
|
65
|
+
/** The App's first-screen ES modules: an optional `entry-preload.json` at the
|
|
66
|
+
* root of the UI directory, written by the App's own build, lists up to 16
|
|
67
|
+
* paths relative to that directory (for example its main chunk). */
|
|
68
|
+
export declare const ENTRY_PRELOAD_FILE = "entry-preload.json";
|
|
69
|
+
export declare function entryPreload(appDir: string | undefined): string[];
|
|
70
|
+
export declare function renderMobileAssets(manifest: StandaloneManifest, uiDigest: string, moduleVersion?: string, appDir?: string): Promise<MobileAssets | undefined>;
|
|
66
71
|
/** Validate the entry page record before using any of its paths. */
|
|
67
72
|
export declare function entryRecordProblem(record: unknown): string | undefined;
|
|
68
73
|
/** The recorded files as built: the fixed page, this build's pointer and digests. */
|
|
@@ -15,7 +15,7 @@ import { renderExecutorApproval } from './executor-approval.js';
|
|
|
15
15
|
import { CALL_RETRY_RUNTIME } from './call-retry.js';
|
|
16
16
|
import { MOBILE_APPROVAL_WEBAPI } from './mobile-approval-webapi.js';
|
|
17
17
|
import { daemonIngressPath, readDaemonIngress } from './daemon-ingress.js';
|
|
18
|
-
import { ENTRY_PAGE_STUB, ENTRY_POINTER_FILE, entryLauncher, entryPointerProblem, entryShortPath, hasEntryPage, renderEntryPointer } from './entry-page.js';
|
|
18
|
+
import { ENTRY_PAGE_FILE, ENTRY_PAGE_STUB, ENTRY_POINTER_FILE, LEGACY_ENTRY_PAGE_FILE, entryLauncher, entryPointerProblem, entryShortPath, hasEntryPage, renderEntryPointer } from './entry-page.js';
|
|
19
19
|
const schema = JSON.parse(readFileSync(new URL('../../schema/mobile.v1.schema.json', import.meta.url), 'utf8'));
|
|
20
20
|
const ajv = new Ajv({ allErrors: true });
|
|
21
21
|
const validate = ajv.compile(schema);
|
|
@@ -37,7 +37,7 @@ export function mobileRegistration(record) {
|
|
|
37
37
|
return {
|
|
38
38
|
schema: 1, package: record.package, version: record.version, build: record.build,
|
|
39
39
|
name: record.name, icon: `./icons/mobile-192.png?v=${record.build}`,
|
|
40
|
-
entry: mobile.entry === 'app' ?
|
|
40
|
+
entry: mobile.entry === 'app' ? ENTRY_PAGE_FILE : record.gatewayEntry,
|
|
41
41
|
...(record.portal ? { portal: record.portal } : {}),
|
|
42
42
|
start: mobile.start ?? '/', capabilities: mobile.capabilities ?? [],
|
|
43
43
|
...(mobile.intake ? { intake: mobile.intake } : {}), status: mobile.status ?? false, minShell: mobile.min_shell ?? 1,
|
|
@@ -118,7 +118,27 @@ function entryRuntimeProblem(runtime, version) {
|
|
|
118
118
|
/** Pure packaging glue; login, cache, portal and host behavior stay in the bundled SDK.
|
|
119
119
|
* Writes the entry page for the url launcher and for a mobile App entry, and
|
|
120
120
|
* mobile.json for a mobile declaration. */
|
|
121
|
-
|
|
121
|
+
/** The App's first-screen ES modules: an optional `entry-preload.json` at the
|
|
122
|
+
* root of the UI directory, written by the App's own build, lists up to 16
|
|
123
|
+
* paths relative to that directory (for example its main chunk). */
|
|
124
|
+
export const ENTRY_PRELOAD_FILE = 'entry-preload.json';
|
|
125
|
+
export function entryPreload(appDir) {
|
|
126
|
+
const file = appDir && join(appDir, ENTRY_PRELOAD_FILE);
|
|
127
|
+
if (!file || !existsSync(file))
|
|
128
|
+
return [];
|
|
129
|
+
let list;
|
|
130
|
+
try {
|
|
131
|
+
list = JSON.parse(readFileSync(file, 'utf8'));
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
list = undefined;
|
|
135
|
+
}
|
|
136
|
+
if (!Array.isArray(list) || list.length > 16 || !list.every(path => typeof path === 'string' &&
|
|
137
|
+
/^(?:[\w~-][\w.~-]*\/)*[\w~-][\w.~-]*\.m?js$/.test(path) && existsSync(join(appDir, path))))
|
|
138
|
+
throw new Error(`[ENTRY_PRELOAD_INVALID] ${ENTRY_PRELOAD_FILE} must be a JSON array of at most 16 .js or .mjs files in the UI directory, as relative paths without ".."`);
|
|
139
|
+
return list;
|
|
140
|
+
}
|
|
141
|
+
export async function renderMobileAssets(manifest, uiDigest, moduleVersion, appDir) {
|
|
122
142
|
const mobile = manifest.mobile;
|
|
123
143
|
const entry = hasEntryPage(manifest);
|
|
124
144
|
if (!mobile && !entry)
|
|
@@ -174,10 +194,14 @@ function attachExecutor(ctx, desktopWebApi) {
|
|
|
174
194
|
const version = hash.digest('hex');
|
|
175
195
|
if (entry) {
|
|
176
196
|
const appBundle = `${moduleVersion ? `./${moduleVersion}/${MODULE_UI_ENTRY}` : './app.js'}?v=${version}`;
|
|
197
|
+
// Chunks keep the URL the App resolves against its own script: no query.
|
|
198
|
+
const preload = entryPreload(appDir).map(path => `./${moduleVersion ? `${moduleVersion}/` : ''}${path}`);
|
|
177
199
|
const options = {
|
|
178
200
|
packageId: manifest.package, build: version, displayName: name.en,
|
|
179
|
-
//
|
|
180
|
-
|
|
201
|
+
// Downloaded while identity is pending, run only by mount: a module as
|
|
202
|
+
// modulepreload, a classic app.js as preload (as=script).
|
|
203
|
+
appIcon: `./icons/mobile-192.png?v=${version}`, ...(moduleVersion ? { appBundle } : { appScript: appBundle }),
|
|
204
|
+
...(preload.length ? { preload } : {}),
|
|
181
205
|
...(manifest.portal ? { portal: { defaultAlias: manifest.portal.alias } } : {}),
|
|
182
206
|
...(shortPath ? { shortPath } : {}),
|
|
183
207
|
requestTimeout,
|
|
@@ -189,7 +213,7 @@ function attachExecutor(ctx, desktopWebApi) {
|
|
|
189
213
|
const loadApp = moduleVersion
|
|
190
214
|
? `import(${json(appBundle)})`
|
|
191
215
|
: `new Promise((resolve,reject)=>{const script=document.createElement('script');script.src=new URL(${json(appBundle)},import.meta.url).href;script.dataset.package=${json(manifest.package)};script.onload=()=>resolve(window.DsmPackageApps?.[${json(manifest.package)}]);script.onerror=reject;document.head.appendChild(script)})`;
|
|
192
|
-
const source = `import {bootEntryPage} from ${json(entryModule(manifest))};\n${approval}
|
|
216
|
+
const source = `import {bootEntryPage} from ${json(entryModule(manifest))};\n${approval}const buildMeta=document.querySelector('meta[name="synopkgland-build"]')||document.head.appendChild(document.createElement('meta'));buildMeta.name='synopkgland-build';buildMeta.content=${json(version)};\nbootEntryPage({...${json(options)},root:document.querySelector('.dsmapp-root'),mount:async(root,ctx)=>{${approval ? 'attachExecutor(ctx);' : ''}const app=await ${loadApp};if(typeof app?.mount!=='function')throw new Error('The UI must export mount(root, ctx)');return app.mount(root,ctx)}});`;
|
|
193
217
|
const bundled = await build({ stdin: { contents: source, resolveDir: manifest.root, sourcefile: 'synopkgland-entry.generated.js' }, bundle: true, write: false, format: 'esm', platform: 'browser', target: 'es2022', minify: true, keepNames: true, plugins: [{ name: 'app-import', setup(api) { api.onResolve({ filter: /[?]v=/ }, args => ({ path: args.path, external: true })); } }], legalComments: 'none' });
|
|
194
218
|
files.set('entry.js', Buffer.from(bundled.outputFiles[0].text));
|
|
195
219
|
const contextSource = approval
|
|
@@ -198,7 +222,8 @@ function attachExecutor(ctx, desktopWebApi) {
|
|
|
198
222
|
const context = await build({ stdin: { contents: contextSource, resolveDir: manifest.root, sourcefile: 'synopkgland-context.generated.js' }, bundle: true, write: false, format: 'esm', platform: 'browser', target: 'es2022', minify: true, keepNames: true, legalComments: 'none' });
|
|
199
223
|
files.set('entry-context.js', Buffer.from(context.outputFiles[0].text));
|
|
200
224
|
const css = moduleVersion ? `./${moduleVersion}/app.css` : './app.css';
|
|
201
|
-
files.set(
|
|
225
|
+
files.set(ENTRY_PAGE_FILE, Buffer.from(ENTRY_PAGE_STUB));
|
|
226
|
+
files.set(LEGACY_ENTRY_PAGE_FILE, Buffer.from(ENTRY_PAGE_STUB));
|
|
202
227
|
files.set(ENTRY_POINTER_FILE, Buffer.from(renderEntryPointer(version, name.en, css)));
|
|
203
228
|
}
|
|
204
229
|
if (record) {
|
|
@@ -211,7 +236,7 @@ function attachExecutor(ctx, desktopWebApi) {
|
|
|
211
236
|
return { build: version, files, ...(record ? { record } : {}),
|
|
212
237
|
...(entry ? { entry: { build: version, launcher: entryLauncher(manifest), files: Object.fromEntries(Object.entries(inventory).filter(([path]) => path !== 'mobile.json')) } } : {}) };
|
|
213
238
|
}
|
|
214
|
-
const ENTRY_FILES = [
|
|
239
|
+
const ENTRY_FILES = [ENTRY_PAGE_FILE, LEGACY_ENTRY_PAGE_FILE, ENTRY_POINTER_FILE, 'entry.js', 'entry-context.js', 'icons/mobile-192.png', 'icons/mobile-512.png'];
|
|
215
240
|
/** Validate the entry page record before using any of its paths. */
|
|
216
241
|
export function entryRecordProblem(record) {
|
|
217
242
|
const r = record;
|
|
@@ -231,8 +256,9 @@ export function inspectEntryFiles(root, record) {
|
|
|
231
256
|
if (!existsSync(join(root, path)) || digest(readFileSync(join(root, path))) !== hash)
|
|
232
257
|
return `${path} differs from the generated build`;
|
|
233
258
|
}
|
|
234
|
-
|
|
235
|
-
|
|
259
|
+
for (const page of [ENTRY_PAGE_FILE, LEGACY_ENTRY_PAGE_FILE])
|
|
260
|
+
if (readFileSync(join(root, page), 'utf8') !== ENTRY_PAGE_STUB)
|
|
261
|
+
return `${page} is not the fixed entry page`;
|
|
236
262
|
return entryPointerProblem(readFileSync(join(root, ENTRY_POINTER_FILE), 'utf8'), record.build);
|
|
237
263
|
}
|
|
238
264
|
/** Validate the replay inventory before using any of its paths. */
|
|
@@ -252,10 +278,10 @@ export function mobileRecordProblem(record) {
|
|
|
252
278
|
return 'invalid gateway entry';
|
|
253
279
|
if (r.portal && !isPortalAlias(r.portal.defaultAlias))
|
|
254
280
|
return 'invalid portal alias';
|
|
255
|
-
if (!r.files['mobile.json'] || !r.files['icons/mobile-192.png'] || !r.files['icons/mobile-512.png'] || (r.declaration.entry === 'app' && (!r.files[
|
|
281
|
+
if (!r.files['mobile.json'] || !r.files['icons/mobile-192.png'] || !r.files['icons/mobile-512.png'] || (r.declaration.entry === 'app' && (!r.files[ENTRY_PAGE_FILE] || !r.files[LEGACY_ENTRY_PAGE_FILE] || !r.files['entry.js'] || !r.files['entry-context.js'])))
|
|
256
282
|
return 'missing registration or icon inventory';
|
|
257
283
|
for (const [path, hash] of Object.entries(r.files))
|
|
258
|
-
if (!/^(entry\.(?:html|js|json)|entry-context\.js|mobile\.json|icons\/mobile-(?:192|512)\.png)$/.test(path) || typeof hash !== 'string' || !/^[a-f0-9]{64}$/.test(hash))
|
|
284
|
+
if (!/^(entry\.(?:html|js|json)|launch\.html|entry-context\.js|mobile\.json|icons\/mobile-(?:192|512)\.png)$/.test(path) || typeof hash !== 'string' || !/^[a-f0-9]{64}$/.test(hash))
|
|
259
285
|
return 'invalid asset inventory';
|
|
260
286
|
return undefined;
|
|
261
287
|
}
|
package/dist/standalone/spk.js
CHANGED
|
@@ -110,7 +110,7 @@ export async function assembleStandaloneSpk(options) {
|
|
|
110
110
|
precompressUiTree(appDir);
|
|
111
111
|
const moduleUi = hasSdkWindow(manifest) && existsSync(join(appDir, MODULE_UI_ENTRY));
|
|
112
112
|
const uiDigest = uiTreeDigest(appDir, moduleUi);
|
|
113
|
-
const mobile = await renderMobileAssets(manifest, uiDigest, moduleUi ? uiDigest : undefined);
|
|
113
|
+
const mobile = await renderMobileAssets(manifest, uiDigest, moduleUi ? uiDigest : undefined, appDir);
|
|
114
114
|
const assetVersion = mobile?.build ?? uiDigest.slice(0, 12);
|
|
115
115
|
const moduleVersion = moduleUi ? uiDigest : undefined;
|
|
116
116
|
if (moduleVersion) {
|
package/docs/app-entry.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# App entry and explicit API registration
|
|
2
2
|
|
|
3
|
+
## Verify the running entry build
|
|
4
|
+
|
|
5
|
+
The entry page's `launch.html` and compatibility `entry.html` stay fixed across
|
|
6
|
+
builds. They fetch `entry.json` with `cache: no-store` and a cache-busting query,
|
|
7
|
+
then load its build-stamped `entry.js?v=...`. That runtime writes the current
|
|
8
|
+
build into `<meta name="synopkgland-build">` before starting sign-in or mounting
|
|
9
|
+
the App, including when the browser uses a previously cached HTML page.
|
|
10
|
+
|
|
11
|
+
In the entry page's browser console, read:
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
document.querySelector('meta[name="synopkgland-build"]')?.content
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Compare it with `build` in the freshly fetched `entry.json` and the loaded
|
|
18
|
+
`entry.js` request's `v` parameter. A missing marker means the current entry
|
|
19
|
+
runtime has not executed; the marker alone does not prove sign-in or App mount
|
|
20
|
+
succeeded. The fixed HTML source deliberately contains no build value. This
|
|
21
|
+
marker applies to the standalone App entry page, not the shared DSM desktop.
|
|
22
|
+
|
|
23
|
+
## Admission policy
|
|
24
|
+
|
|
3
25
|
`entry: admin-only` admits verified DSM administrators before any App handler,
|
|
4
26
|
including a public route, batch member, streamed response, upload or download.
|
|
5
27
|
`entry: app-privilege` admits verified sessions allowed by DSM Application
|
package/package.json
CHANGED
package/skills/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: Initialize, extend, check, build, inspect, and deploy Synology appl
|
|
|
5
5
|
|
|
6
6
|
# Independent Synology SPKs
|
|
7
7
|
|
|
8
|
-
Files under ui/ (including mobile.json and entry.html) are public static files readable without sign-in; never put secrets there. Access control is the EntryGate/backend.
|
|
8
|
+
Files under ui/ (including mobile.json, launch.html and entry.html) are public static files readable without sign-in; never put secrets there. Access control is the EntryGate/backend.
|
|
9
9
|
|
|
10
10
|
For native DSM strings and fixed desktop notifications, read
|
|
11
11
|
[reference/dsm-texts.md](reference/dsm-texts.md) (`synopkgland skill show dsm-texts`).
|
|
@@ -347,11 +347,11 @@ Scaffold 明確寫入此選擇,plain/binary 使用 `new-page`,Vue UI SDK
|
|
|
347
347
|
預設的 `dsm-window`(省略 `ui.launch`)。原生 manifest 省略 `ui.launch` 時解析為 `dsm-window`,CLI 不猜測前端依賴。
|
|
348
348
|
|
|
349
349
|
`new-page` 讓主選單與套件中心以 DSM `type: "url"` launcher 在新分頁開 App 的 entry 頁
|
|
350
|
-
`/webman/3rdparty/<package>/app/
|
|
350
|
+
`/webman/3rdparty/<package>/app/launch.html`(SDK `bootEntryPage`,不載入 DSM 桌面);Portal alias 與
|
|
351
351
|
`/?launchApp=…` 連結由 DSM 轉到同一頁(DSM 會丟掉 query、把 launchParam 拆成單一字元,SDK 都會處理)。
|
|
352
|
-
entry 頁每次 build 都是相同的固定內容,從 `entry.json`(no-store)讀當前 build 的 `?v=`
|
|
352
|
+
entry 頁每次 build 都是相同的固定內容,從 `entry.json`(no-store)讀當前 build 的 `?v=` 資產,書籤不會停在舊版。較早 CLI 的 `entry.html` 內含 build,瀏覽器會把它當成多年有效的快取、升級後仍直接開舊版,所以入口改用從未有過舊內容的 `launch.html`;`entry.html` 保留相同的固定內容給舊連結。
|
|
353
353
|
build 需要在 UI build 目錄或專案根目錄安裝含 `/entry` 的 `@synopackageland/sdk`(缺少時 `MOBILE_SDK_ENTRY_MISSING`),
|
|
354
|
-
|
|
354
|
+
且要用支援 `ctx.entryURL` 的 SDK(過舊時 `ENTRY_SDK_OUTDATED`,錯誤訊息會寫出最低版本)。`ctx.fullPage`、`ctx.appIcon`、`ctx.uiUpdate`、
|
|
355
355
|
SynoToken/session、`ctx.launchParams`/`onLaunch`、`entry` 權限照舊;分享與書籤用 `ctx.entryURL`(`ui.short_paths`
|
|
356
356
|
有指向 `app` 的路徑時是短網址,否則是 entry 頁網址),App 內的位置放在 `?link=`。宣告 `identity_gateway` 的 App
|
|
357
357
|
仍用 `type: "standalone"`(DSM 視窗要接續 OIDC 冷登入)。不需要 `pureEnv` 或 `allowAltPort`。
|
|
@@ -35,21 +35,25 @@ then uses the existing PasswordConfirm and exact task readback. Older protected
|
|
|
35
35
|
runtimes without diagnostic support show an explicit unknown explanation. No App
|
|
36
36
|
option supplies an approved baseline or permission claim.
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
The current SPK receives
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
38
|
+
For a baseline with `sdk-package.json`, comparison reads approval facts rather
|
|
39
|
+
than replaying today's UI, wizard or lifecycle generators. Older entry pages
|
|
40
|
+
may lack `launch.html`, and their short-path targets and lifecycle wrappers may
|
|
41
|
+
use historical formats. The current SPK still receives full current-format
|
|
42
|
+
inspection. Baseline errors identify the fact that could not be read.
|
|
43
|
+
|
|
44
|
+
The baseline reader checks archive safety, INFO identity and payload checksum,
|
|
45
|
+
the capability inventory, recorded entry asset digests, package-account
|
|
46
|
+
privilege, resource registrations and their referenced files. Executor packages
|
|
47
|
+
also require the policy, root payload digests, executor pins and INFO anchor,
|
|
48
|
+
and task templates from the recorded SDK. Missing or inconsistent facts fail
|
|
49
|
+
with `APPROVAL_BASELINE_INVALID`. A well-formed historical resource registration
|
|
50
|
+
is compared as shipped; it need not equal today's generated serialization.
|
|
51
|
+
Unknown workers, foreign paths and duplicate nginx registrations are rejected.
|
|
52
|
+
|
|
53
|
+
These checks establish internal consistency, not publisher authenticity. Use
|
|
54
|
+
the trusted, previously released artifact and verify its published hash. In
|
|
55
|
+
particular, lifecycle scripts are outside this approval-fact comparison; use
|
|
56
|
+
the CLI that built a release for its full historical format inspection.
|
|
53
57
|
|
|
54
58
|
JSON `resource_changes` and text `Resource` lines show the old and new DSM
|
|
55
59
|
registrations. Adding an ingress registration, including `www` for the same
|
|
@@ -264,11 +264,11 @@ Scaffold 明確寫入此選擇,plain/binary 使用 `new-page`,Vue UI SDK
|
|
|
264
264
|
預設的 `dsm-window`(省略 `ui.launch`)。原生 manifest 省略 `ui.launch` 時解析為 `dsm-window`,CLI 不猜測前端依賴。
|
|
265
265
|
|
|
266
266
|
`new-page` 讓主選單與套件中心以 DSM `type: "url"` launcher 在新分頁開 App 的 entry 頁
|
|
267
|
-
`/webman/3rdparty/<package>/app/
|
|
267
|
+
`/webman/3rdparty/<package>/app/launch.html`(SDK `bootEntryPage`,不載入 DSM 桌面);Portal alias 與
|
|
268
268
|
`/?launchApp=…` 連結由 DSM 轉到同一頁(DSM 會丟掉 query、把 launchParam 拆成單一字元,SDK 都會處理)。
|
|
269
|
-
entry 頁每次 build 都是相同的固定內容,從 `entry.json`(no-store)讀當前 build 的 `?v=`
|
|
269
|
+
entry 頁每次 build 都是相同的固定內容,從 `entry.json`(no-store)讀當前 build 的 `?v=` 資產,書籤不會停在舊版。較早 CLI 的 `entry.html` 內含 build,瀏覽器會把它當成多年有效的快取、升級後仍直接開舊版,所以入口改用從未有過舊內容的 `launch.html`;`entry.html` 保留相同的固定內容給舊連結。
|
|
270
270
|
build 需要在 UI build 目錄或專案根目錄安裝含 `/entry` 的 `@synopackageland/sdk`(缺少時 `MOBILE_SDK_ENTRY_MISSING`),
|
|
271
|
-
|
|
271
|
+
且要用支援 `ctx.entryURL` 的 SDK(過舊時 `ENTRY_SDK_OUTDATED`,錯誤訊息會寫出最低版本)。`ctx.fullPage`、`ctx.appIcon`、`ctx.uiUpdate`、
|
|
272
272
|
SynoToken/session、`ctx.launchParams`/`onLaunch`、`entry` 權限照舊;分享與書籤用 `ctx.entryURL`(`ui.short_paths`
|
|
273
273
|
有指向 `app` 的路徑時是短網址,否則是 entry 頁網址),App 內的位置放在 `?link=`。宣告 `identity_gateway` 的 App
|
|
274
274
|
仍用 `type: "standalone"`(DSM 視窗要接續 OIDC 冷登入)。不需要 `pureEnv` 或 `allowAltPort`。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Mobile Apps
|
|
2
2
|
|
|
3
|
-
Files under ui/ (including mobile.json and entry.html) are public static files readable without sign-in; never put secrets there. Access control is the EntryGate/backend.
|
|
3
|
+
Files under ui/ (including mobile.json, launch.html and entry.html) are public static files readable without sign-in; never put secrets there. Access control is the EntryGate/backend.
|
|
4
4
|
|
|
5
5
|
Declare `mobile` in `dsm-package.yaml`. Both `admin-only` and `app-privilege`
|
|
6
6
|
Apps may register. DSM entry and backend permissions still apply to every request.
|
|
@@ -46,19 +46,31 @@ Capabilities are `download`, `open-external`, and `camera`. Intake accepts `url`
|
|
|
46
46
|
check. `status` is accepted for the later launcher-status protocol; v1 does not
|
|
47
47
|
invoke it. `min_shell` is a positive integer, default 1.
|
|
48
48
|
|
|
49
|
-
Build writes `ui/app/mobile.json`, mobile icons and, for SDK Apps, `entry.html`, `entry.json`
|
|
49
|
+
Build writes `ui/app/mobile.json`, mobile icons and, for SDK Apps, `launch.html`, `entry.html`, `entry.json`
|
|
50
50
|
and bundled `entry.js` into the SPK only. The generated DSM window loads
|
|
51
51
|
`entry-context.js` and passes its existing session, host and privileged adapters
|
|
52
|
-
to the same SDK context builder. `
|
|
53
|
-
every build
|
|
52
|
+
to the same SDK context builder. `launch.html` is the same fixed bytes in
|
|
53
|
+
every build, and the registration's `entry`: browsers keep DSM's package files
|
|
54
|
+
for years without asking, and older CLIs put the build in `entry.html`,
|
|
55
|
+
so a browser that opened it keeps that page after an upgrade. `entry.html`
|
|
56
|
+
stays, with the same fixed bytes, for older links; one immutable content hash appears in `entry.json` (the build and
|
|
54
57
|
the assets the page loads), `bootEntryPage.build`, registration, and every
|
|
55
58
|
generated entry script, stylesheet and icon URL. A `ui.launch: new-page` App
|
|
56
59
|
gets the same entry page without a mobile declaration. Module UI assets retain their immutable
|
|
57
60
|
snapshot directory. For a module UI, the generated `bootEntryPage.appBundle` is
|
|
58
61
|
the exact URL loaded by `mount`, including its build query; SDK boot preloads it
|
|
59
62
|
while token/identity requests run, and App execution still waits for verified
|
|
60
|
-
identity. Classic bundles retain their script carrier and package dataset
|
|
61
|
-
|
|
63
|
+
identity. Classic bundles retain their script carrier and package dataset; the
|
|
64
|
+
generated `bootEntryPage.appScript` preloads the same `app.js?v=` URL as a
|
|
65
|
+
script (`<link rel="preload" as="script">`), so the script element reuses the
|
|
66
|
+
download and still runs only after identity. A UI build may also write
|
|
67
|
+
`entry-preload.json` at the root of the UI directory: a JSON array of at most 16
|
|
68
|
+
`.js`/`.mjs` paths relative to it (for example `["chunks/main-1a2b.js"]`) that
|
|
69
|
+
the first screen imports. The entry passes them as `bootEntryPage.preload` for a
|
|
70
|
+
`modulepreload` during the same wait, at the URL the App resolves against its
|
|
71
|
+
own script (no `?v=`). A missing file, a path outside the UI directory or more
|
|
72
|
+
than 16 entries fails the build (`ENTRY_PRELOAD_INVALID`). A language chunk
|
|
73
|
+
depends on the verified locale; the App hints it when it mounts.
|
|
62
74
|
The SDK comes from the project: `@synopackageland/sdk` in the UI build
|
|
63
75
|
directory or the project root (`MOBILE_SDK_ENTRY_MISSING` otherwise);
|
|
64
76
|
`SYNOPKGLAND_ENTRY_SDK_DIR` may name an SDK package directory to use when the
|
|
@@ -51,11 +51,11 @@ Scaffold 明確寫入此選擇,plain/binary 使用 `new-page`,Vue UI SDK
|
|
|
51
51
|
預設的 `dsm-window`(省略 `ui.launch`)。原生 manifest 省略 `ui.launch` 時解析為 `dsm-window`,CLI 不猜測前端依賴。
|
|
52
52
|
|
|
53
53
|
`new-page` 讓主選單與套件中心以 DSM `type: "url"` launcher 在新分頁開 App 的 entry 頁
|
|
54
|
-
`/webman/3rdparty/<package>/app/
|
|
54
|
+
`/webman/3rdparty/<package>/app/launch.html`(SDK `bootEntryPage`,不載入 DSM 桌面);Portal alias 與
|
|
55
55
|
`/?launchApp=…` 連結由 DSM 轉到同一頁(DSM 會丟掉 query、把 launchParam 拆成單一字元,SDK 都會處理)。
|
|
56
|
-
entry 頁每次 build 都是相同的固定內容,從 `entry.json`(no-store)讀當前 build 的 `?v=`
|
|
56
|
+
entry 頁每次 build 都是相同的固定內容,從 `entry.json`(no-store)讀當前 build 的 `?v=` 資產,書籤不會停在舊版。較早 CLI 的 `entry.html` 內含 build,瀏覽器會把它當成多年有效的快取、升級後仍直接開舊版,所以入口改用從未有過舊內容的 `launch.html`;`entry.html` 保留相同的固定內容給舊連結。
|
|
57
57
|
build 需要在 UI build 目錄或專案根目錄安裝含 `/entry` 的 `@synopackageland/sdk`(缺少時 `MOBILE_SDK_ENTRY_MISSING`),
|
|
58
|
-
|
|
58
|
+
且要用支援 `ctx.entryURL` 的 SDK(過舊時 `ENTRY_SDK_OUTDATED`,錯誤訊息會寫出最低版本)。`ctx.fullPage`、`ctx.appIcon`、`ctx.uiUpdate`、
|
|
59
59
|
SynoToken/session、`ctx.launchParams`/`onLaunch`、`entry` 權限照舊;分享與書籤用 `ctx.entryURL`(`ui.short_paths`
|
|
60
60
|
有指向 `app` 的路徑時是短網址,否則是 entry 頁網址),App 內的位置放在 `?link=`。宣告 `identity_gateway` 的 App
|
|
61
61
|
仍用 `type: "standalone"`(DSM 視窗要接續 OIDC 冷登入)。不需要 `pureEnv` 或 `allowAltPort`。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Vue UI for DSM apps
|
|
2
2
|
|
|
3
|
-
Files under ui/ (including mobile.json and entry.html) are public static files readable without sign-in; never put secrets there. Access control is the EntryGate/backend.
|
|
3
|
+
Files under ui/ (including mobile.json, launch.html and entry.html) are public static files readable without sign-in; never put secrets there. Access control is the EntryGate/backend.
|
|
4
4
|
|
|
5
5
|
`build` minifies packaged JS/CSS and removes `.map` files and their JS/CSS comments.
|
|
6
6
|
`check` scans the current UI output; `check path/to/package.spk` scans the final
|
|
@@ -217,11 +217,11 @@ Scaffold 明確寫入此選擇,plain/binary 使用 `new-page`,Vue UI SDK
|
|
|
217
217
|
預設的 `dsm-window`(省略 `ui.launch`)。原生 manifest 省略 `ui.launch` 時解析為 `dsm-window`,CLI 不猜測前端依賴。
|
|
218
218
|
|
|
219
219
|
`new-page` 讓主選單與套件中心以 DSM `type: "url"` launcher 在新分頁開 App 的 entry 頁
|
|
220
|
-
`/webman/3rdparty/<package>/app/
|
|
220
|
+
`/webman/3rdparty/<package>/app/launch.html`(SDK `bootEntryPage`,不載入 DSM 桌面);Portal alias 與
|
|
221
221
|
`/?launchApp=…` 連結由 DSM 轉到同一頁(DSM 會丟掉 query、把 launchParam 拆成單一字元,SDK 都會處理)。
|
|
222
|
-
entry 頁每次 build 都是相同的固定內容,從 `entry.json`(no-store)讀當前 build 的 `?v=`
|
|
222
|
+
entry 頁每次 build 都是相同的固定內容,從 `entry.json`(no-store)讀當前 build 的 `?v=` 資產,書籤不會停在舊版。較早 CLI 的 `entry.html` 內含 build,瀏覽器會把它當成多年有效的快取、升級後仍直接開舊版,所以入口改用從未有過舊內容的 `launch.html`;`entry.html` 保留相同的固定內容給舊連結。
|
|
223
223
|
build 需要在 UI build 目錄或專案根目錄安裝含 `/entry` 的 `@synopackageland/sdk`(缺少時 `MOBILE_SDK_ENTRY_MISSING`),
|
|
224
|
-
|
|
224
|
+
且要用支援 `ctx.entryURL` 的 SDK(過舊時 `ENTRY_SDK_OUTDATED`,錯誤訊息會寫出最低版本)。`ctx.fullPage`、`ctx.appIcon`、`ctx.uiUpdate`、
|
|
225
225
|
SynoToken/session、`ctx.launchParams`/`onLaunch`、`entry` 權限照舊;分享與書籤用 `ctx.entryURL`(`ui.short_paths`
|
|
226
226
|
有指向 `app` 的路徑時是短網址,否則是 entry 頁網址),App 內的位置放在 `?link=`。宣告 `identity_gateway` 的 App
|
|
227
227
|
仍用 `type: "standalone"`(DSM 視窗要接續 OIDC 冷登入)。不需要 `pureEnv` 或 `allowAltPort`。
|
|
@@ -273,7 +273,7 @@ ui:
|
|
|
273
273
|
### Short paths
|
|
274
274
|
|
|
275
275
|
穩定網址仍然很長。要讓使用者直接輸入 `https://<nas>:5001/connect`,加 `ui.short_paths`:路徑對應到 `stable_pages` 的頁名。
|
|
276
|
-
值也可以是 `app`:轉到 App 的 entry 頁 `/webman/3rdparty/<package>/app/
|
|
276
|
+
值也可以是 `app`:轉到 App 的 entry 頁 `/webman/3rdparty/<package>/app/launch.html`(new-page 或 `mobile.entry: app` 的 App),`ctx.entryURL` 就用第一個這樣的短網址,App 自己加 `?link=`。
|
|
277
277
|
|
|
278
278
|
```yaml
|
|
279
279
|
os_min_ver: "7.2-64570"
|