@synopackageland/cli 0.7.3 → 0.9.0
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 +249 -0
- package/README.md +27 -5
- package/dist/add.js +4 -17
- package/dist/authorization-sdk.d.ts +0 -1
- package/dist/authorization-sdk.js +0 -1
- package/dist/build-spk/gateway.d.ts +2 -2
- package/dist/build-spk/gateway.js +4 -4
- package/dist/build-spk/generator.d.ts +1 -0
- package/dist/build-spk/generator.js +2 -2
- package/dist/build-spk/notices.js +12 -8
- package/dist/capability-overlays.d.ts +15 -0
- package/dist/capability-overlays.js +18 -0
- package/dist/cli-version.d.ts +2 -0
- package/dist/cli-version.js +3 -0
- package/dist/cli.js +110 -44
- package/dist/error-registry.js +18 -5
- package/dist/info.js +2 -1
- package/dist/init.js +52 -58
- package/dist/reproducible-config.d.ts +8 -0
- package/dist/reproducible-config.js +32 -0
- package/dist/reproducible.d.ts +38 -0
- package/dist/reproducible.js +121 -0
- package/dist/runtime/delegate-contract.d.ts +15 -0
- package/dist/runtime/delegate-contract.js +2 -0
- package/dist/runtime/executor-build.d.ts +15 -1
- package/dist/runtime/executor-build.js +42 -11
- package/dist/runtime/executor-digests.json +13 -0
- package/dist/runtime/executor-inspect.d.ts +1 -0
- package/dist/runtime/executor-inspect.js +5 -2
- package/dist/runtime/executor-policy.d.ts +3 -1
- package/dist/runtime/executor-policy.js +7 -2
- package/dist/runtime/executor-source.d.ts +21 -0
- package/dist/runtime/executor-source.js +35 -0
- package/dist/runtime/executor-tasks.d.ts +5 -2
- package/dist/runtime/executor-tasks.js +6 -4
- package/dist/runtime/sdk-source.d.ts +31 -0
- package/dist/runtime/sdk-source.js +92 -0
- package/dist/spk/check-info.d.ts +5 -0
- package/dist/spk/check-info.js +123 -0
- package/dist/spk/check-metadata.d.ts +7 -0
- package/dist/spk/check-metadata.js +113 -0
- package/dist/spk/check-payload.d.ts +2 -0
- package/dist/spk/check-payload.js +156 -0
- package/dist/spk/dsm-spec.d.ts +42 -0
- package/dist/spk/dsm-spec.js +86 -0
- package/dist/spk/findings.d.ts +13 -0
- package/dist/spk/findings.js +8 -0
- package/dist/spk/inspect.d.ts +18 -0
- package/dist/spk/inspect.js +62 -0
- package/dist/spk/rules.d.ts +265 -0
- package/dist/spk/rules.js +53 -0
- package/dist/spk/validate-spk.d.ts +13 -0
- package/dist/spk/validate-spk.js +107 -0
- package/dist/standalone/api-permissions.d.ts +4 -1
- package/dist/standalone/api-permissions.js +10 -18
- package/dist/standalone/arch-jobs.d.ts +11 -0
- package/dist/standalone/arch-jobs.js +54 -0
- package/dist/standalone/build.d.ts +12 -2
- package/dist/standalone/build.js +85 -35
- package/dist/standalone/daemon.d.ts +1 -1
- package/dist/standalone/daemon.js +4 -4
- package/dist/standalone/dsm-window.js +2 -2
- package/dist/standalone/inspect-spk.d.ts +1 -0
- package/dist/standalone/inspect-spk.js +1 -1
- package/dist/standalone/manifest.d.ts +5 -2
- package/dist/standalone/manifest.js +19 -4
- package/dist/standalone/native-layout.d.ts +3 -0
- package/dist/standalone/native-layout.js +94 -33
- package/dist/standalone/root-window.d.ts +1 -1
- package/dist/standalone/root-window.js +0 -1
- package/dist/standalone/sdk-check.d.ts +9 -0
- package/dist/standalone/sdk-check.js +43 -0
- package/dist/standalone/spk.js +1 -1
- package/dist/template-paths.d.ts +7 -2
- package/dist/template-paths.js +18 -6
- package/package.json +13 -3
- package/schema/synology-app.schema.json +9 -0
- package/dist/templates/_executor/README.md +0 -318
- package/dist/templates/_executor/anchor.go +0 -156
- package/dist/templates/_executor/anchor_test.go +0 -161
- package/dist/templates/_executor/apppriv_review_test.go +0 -28
- package/dist/templates/_executor/auth_presence_review_test.go +0 -38
- package/dist/templates/_executor/cancel_contract_test.go +0 -236
- package/dist/templates/_executor/cmd/lifecycle/main.go +0 -42
- package/dist/templates/_executor/cookie_review_test.go +0 -27
- package/dist/templates/_executor/copy.go +0 -64
- package/dist/templates/_executor/copy_test.go +0 -88
- package/dist/templates/_executor/digest_review_test.go +0 -120
- package/dist/templates/_executor/directories.go +0 -40
- package/dist/templates/_executor/dsm.go +0 -369
- package/dist/templates/_executor/dsm_test.go +0 -290
- package/dist/templates/_executor/executor.go +0 -735
- package/dist/templates/_executor/executor_test.go +0 -314
- package/dist/templates/_executor/go.mod +0 -5
- package/dist/templates/_executor/identity.go +0 -74
- package/dist/templates/_executor/identity_kernel_linux_test.go +0 -60
- package/dist/templates/_executor/identity_linux.go +0 -82
- package/dist/templates/_executor/identity_security_test.go +0 -43
- package/dist/templates/_executor/internal/lifecycle/lifecycle.go +0 -95
- package/dist/templates/_executor/internal/lifecycle/lifecycle_test.go +0 -232
- package/dist/templates/_executor/internal/taskscript/boot.sh +0 -31
- package/dist/templates/_executor/internal/taskscript/cmd/main.go +0 -19
- package/dist/templates/_executor/internal/taskscript/control.sh +0 -31
- package/dist/templates/_executor/internal/taskscript/tasks.go +0 -44
- package/dist/templates/_executor/json_review_test.go +0 -40
- package/dist/templates/_executor/lifecycle_test.go +0 -97
- package/dist/templates/_executor/link_linux.go +0 -28
- package/dist/templates/_executor/long_running_test.go +0 -530
- package/dist/templates/_executor/main.go +0 -576
- package/dist/templates/_executor/managed.go +0 -117
- package/dist/templates/_executor/managed_test.go +0 -137
- package/dist/templates/_executor/move_linux.go +0 -490
- package/dist/templates/_executor/move_linux_test.go +0 -460
- package/dist/templates/_executor/move_validation.go +0 -46
- package/dist/templates/_executor/move_validation_test.go +0 -187
- package/dist/templates/_executor/operations.go +0 -926
- package/dist/templates/_executor/path_test.go +0 -35
- package/dist/templates/_executor/pid.go +0 -37
- package/dist/templates/_executor/pid_test.go +0 -113
- package/dist/templates/_executor/platform_linux.go +0 -187
- package/dist/templates/_executor/platform_linux_test.go +0 -191
- package/dist/templates/_executor/platform_other.go +0 -76
- package/dist/templates/_executor/process.go +0 -142
- package/dist/templates/_executor/purge_log.go +0 -18
- package/dist/templates/_executor/records.go +0 -242
- package/dist/templates/_executor/scope_cancel_contract_test.go +0 -91
- package/dist/templates/_executor/scope_client.go +0 -37
- package/dist/templates/_executor/scope_contract.go +0 -12
- package/dist/templates/_executor/selected_scope.go +0 -146
- package/dist/templates/_executor/selected_scope_test.go +0 -186
- package/dist/templates/_executor/socket_linux_test.go +0 -46
- package/dist/templates/_executor/status_disabled_test.go +0 -33
- package/dist/templates/_executor/store.go +0 -91
- package/dist/templates/_executor/supervise.go +0 -109
- package/dist/templates/_executor/supervise_test.go +0 -130
- package/dist/templates/_executor/task_race_review_test.go +0 -47
- package/dist/templates/_executor/tasks.go +0 -320
- package/dist/templates/_executor/tasks_dsm71_test.go +0 -114
- package/dist/templates/_executor/tasks_review_test.go +0 -43
- package/dist/templates/_executor/tasks_test.go +0 -223
- package/dist/templates/_executor/testdata/evidence/cleanup.json +0 -24
- package/dist/templates/_executor/testdata/evidence/final-smoke.jsonl +0 -9
- package/dist/templates/_executor/testdata/evidence/kernel-acl.json +0 -6
- package/dist/templates/_executor/testdata/evidence/linux-tests.log +0 -123
- package/dist/templates/_executor/testdata/evidence/live.jsonl +0 -23
- package/dist/templates/_executor/testdata/evidence/storage.json +0 -90
- package/dist/templates/_executor/testdata/evidence/validation.json +0 -55
- package/dist/templates/_executor/testdata/live_probe.py +0 -98
- package/dist/templates/_executor/upgrade_watch_test.go +0 -244
- package/dist/templates/_executor/watch.go +0 -164
- package/dist/templates/_executor/watch_test.go +0 -291
- package/dist/templates/_executor/write_review_linux_test.go +0 -87
- package/dist/templates/_shared/AGENTS.md +0 -146
- package/dist/templates/_shared/CLAUDE.md +0 -1
- package/dist/templates/_shared/third-party-notices.mjs +0 -51
- package/dist/templates/binary/LICENSES/GO-LICENSE +0 -27
- package/dist/templates/binary/LICENSES/GO-PATENTS +0 -22
- package/dist/templates/binary/dsm-package.yaml +0 -46
- package/dist/templates/binary/example/main.go +0 -16
- package/dist/templates/binary/gitignore +0 -2
- package/dist/templates/binary/i18n/messages/de.json +0 -4
- package/dist/templates/binary/i18n/messages/en.json +0 -4
- package/dist/templates/binary/i18n/messages/es.json +0 -4
- package/dist/templates/binary/i18n/messages/fr.json +0 -4
- package/dist/templates/binary/i18n/messages/it.json +0 -4
- package/dist/templates/binary/i18n/messages/ja.json +0 -4
- package/dist/templates/binary/i18n/messages/ko.json +0 -4
- package/dist/templates/binary/i18n/messages/zh-CN.json +0 -4
- package/dist/templates/binary/i18n/messages/zh-TW.json +0 -4
- package/dist/templates/binary/ui/app.css +0 -4
- package/dist/templates/binary/ui/app.js +0 -32
- package/dist/templates/compose/compose.yaml +0 -8
- package/dist/templates/compose/synology-app.yaml +0 -16
- package/dist/templates/native-authorization/AuthorizationGate.vue +0 -91
- package/dist/templates/native-authorization/i18n/de.json +0 -37
- package/dist/templates/native-authorization/i18n/en.json +0 -37
- package/dist/templates/native-authorization/i18n/es.json +0 -37
- package/dist/templates/native-authorization/i18n/fr.json +0 -37
- package/dist/templates/native-authorization/i18n/index.ts +0 -15
- package/dist/templates/native-authorization/i18n/it.json +0 -37
- package/dist/templates/native-authorization/i18n/ja.json +0 -37
- package/dist/templates/native-authorization/i18n/ko.json +0 -37
- package/dist/templates/native-authorization/i18n/zh-CN.json +0 -37
- package/dist/templates/native-authorization/i18n/zh-TW.json +0 -37
- package/dist/templates/native-go/README.md +0 -459
- package/dist/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +0 -61
- package/dist/templates/native-go/backend/cmd/app/main.go +0 -95
- package/dist/templates/native-go/backend/cmd/background-worker/main.go +0 -38
- package/dist/templates/native-go/backend/go.mod +0 -9
- package/dist/templates/native-go/backend/go.sum +0 -4
- package/dist/templates/native-go/backend/internal/api/cgi_framing_test.go +0 -32
- package/dist/templates/native-go/backend/internal/api/cookie_review_test.go +0 -28
- package/dist/templates/native-go/backend/internal/api/deadline_test.go +0 -114
- package/dist/templates/native-go/backend/internal/api/dsm-session.go +0 -54
- package/dist/templates/native-go/backend/internal/api/dsm-session_test.go +0 -51
- package/dist/templates/native-go/backend/internal/api/entry_test.go +0 -47
- package/dist/templates/native-go/backend/internal/api/errors.go +0 -47
- package/dist/templates/native-go/backend/internal/api/permissions.go +0 -161
- package/dist/templates/native-go/backend/internal/api/permissions.json +0 -5
- package/dist/templates/native-go/backend/internal/api/permissions_test.go +0 -113
- package/dist/templates/native-go/backend/internal/api/policy_fixture_test.go +0 -8
- package/dist/templates/native-go/backend/internal/api/registry.go +0 -142
- package/dist/templates/native-go/backend/internal/api/registry_test.go +0 -344
- package/dist/templates/native-go/backend/internal/api/resource_limits_test.go +0 -87
- package/dist/templates/native-go/backend/internal/api/sdk-permissions.json +0 -59
- package/dist/templates/native-go/backend/internal/api/sdk_policy_test.go +0 -31
- package/dist/templates/native-go/backend/internal/api/server.go +0 -305
- package/dist/templates/native-go/backend/internal/api/testdata/permissions-cases.json +0 -172
- package/dist/templates/native-go/backend/internal/app/background.go +0 -249
- package/dist/templates/native-go/backend/internal/app/background_none.go +0 -8
- package/dist/templates/native-go/backend/internal/app/background_owner.go +0 -38
- package/dist/templates/native-go/backend/internal/app/background_owner_test.go +0 -163
- package/dist/templates/native-go/backend/internal/app/background_schedule.go +0 -69
- package/dist/templates/native-go/backend/internal/app/background_schedule_test.go +0 -62
- package/dist/templates/native-go/backend/internal/app/background_test.go +0 -320
- package/dist/templates/native-go/backend/internal/app/delegate_config.go +0 -57
- package/dist/templates/native-go/backend/internal/app/delegate_config_test.go +0 -28
- package/dist/templates/native-go/backend/internal/app/delegate_none.go +0 -5
- package/dist/templates/native-go/backend/internal/app/identity.go +0 -20
- package/dist/templates/native-go/backend/internal/app/identity_test.go +0 -15
- package/dist/templates/native-go/backend/internal/app/migrations.go +0 -41
- package/dist/templates/native-go/backend/internal/app/migrations_test.go +0 -41
- package/dist/templates/native-go/backend/internal/app/portal.go +0 -30
- package/dist/templates/native-go/backend/internal/app/portal_test.go +0 -55
- package/dist/templates/native-go/backend/internal/app/root_none.go +0 -9
- package/dist/templates/native-go/backend/internal/app/routes.go +0 -137
- package/dist/templates/native-go/backend/internal/app/routes_test.go +0 -165
- package/dist/templates/native-go/backend/internal/app/session_files.go +0 -9
- package/dist/templates/native-go/backend/internal/app/session_files_test.go +0 -14
- package/dist/templates/native-go/backend/internal/app/shared_folder.go +0 -144
- package/dist/templates/native-go/backend/internal/app/shared_folder_test.go +0 -158
- package/dist/templates/native-go/backend/internal/background/access.go +0 -57
- package/dist/templates/native-go/backend/internal/background/lock_test.go +0 -131
- package/dist/templates/native-go/backend/internal/background/owner_test.go +0 -118
- package/dist/templates/native-go/backend/internal/background/runner.go +0 -185
- package/dist/templates/native-go/backend/internal/background/runner_test.go +0 -209
- package/dist/templates/native-go/backend/internal/background/schedule.go +0 -336
- package/dist/templates/native-go/backend/internal/background/schedule_test.go +0 -368
- package/dist/templates/native-go/backend/internal/background/store.go +0 -825
- package/dist/templates/native-go/backend/internal/background/store_test.go +0 -365
- package/dist/templates/native-go/backend/internal/datamigrate/migrate.go +0 -191
- package/dist/templates/native-go/backend/internal/datamigrate/migrate_test.go +0 -177
- package/dist/templates/native-go/backend/internal/dsm/admin.go +0 -76
- package/dist/templates/native-go/backend/internal/dsm/admin_linux.go +0 -110
- package/dist/templates/native-go/backend/internal/dsm/admin_linux_test.go +0 -105
- package/dist/templates/native-go/backend/internal/dsm/admin_other.go +0 -15
- package/dist/templates/native-go/backend/internal/dsm/admin_test.go +0 -67
- package/dist/templates/native-go/backend/internal/dsm/apppriv.go +0 -30
- package/dist/templates/native-go/backend/internal/dsm/auth.go +0 -94
- package/dist/templates/native-go/backend/internal/dsm/auth_test.go +0 -159
- package/dist/templates/native-go/backend/internal/dsm/bridge_file.go +0 -75
- package/dist/templates/native-go/backend/internal/dsm/bridge_file_test.go +0 -57
- package/dist/templates/native-go/backend/internal/dsm/entry.go +0 -177
- package/dist/templates/native-go/backend/internal/dsm/entry_test.go +0 -315
- package/dist/templates/native-go/backend/internal/dsm/native/admin-aarch64.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/admin-armv7.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/admin-x86_64.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/admin_check.c +0 -28
- package/dist/templates/native-go/backend/internal/dsm/native/apppriv-aarch64.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/apppriv-armv7.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/apppriv-x86_64.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/apppriv_check.c +0 -33
- package/dist/templates/native-go/backend/internal/dsm/native/build.sh +0 -18
- package/dist/templates/native-go/backend/internal/dsm/native/licenses/GLIBC-NOTICES.txt +0 -400
- package/dist/templates/native-go/backend/internal/dsm/native/licenses/LGPL-2.1.txt +0 -501
- package/dist/templates/native-go/backend/internal/dsm/native/licenses/SOURCE.txt +0 -5
- package/dist/templates/native-go/backend/internal/dsm/native/licenses/ZIG-MIT.txt +0 -21
- package/dist/templates/native-go/backend/internal/dsm/native/provenance.json +0 -18
- package/dist/templates/native-go/backend/internal/filestation/browse_test.go +0 -67
- package/dist/templates/native-go/backend/internal/filestation/check_permission.go +0 -71
- package/dist/templates/native-go/backend/internal/filestation/check_permission_test.go +0 -77
- package/dist/templates/native-go/backend/internal/filestation/client.go +0 -337
- package/dist/templates/native-go/backend/internal/filestation/client_test.go +0 -155
- package/dist/templates/native-go/backend/internal/filestation/doc.go +0 -4
- package/dist/templates/native-go/backend/internal/filestation/download_dsm71_test.go +0 -82
- package/dist/templates/native-go/backend/internal/filestation/http.go +0 -70
- package/dist/templates/native-go/backend/internal/filestation/http_test.go +0 -188
- package/dist/templates/native-go/backend/internal/filestation/operations_test.go +0 -206
- package/dist/templates/native-go/backend/internal/filestation/read_file_test.go +0 -89
- package/dist/templates/native-go/backend/internal/filestation/sdk_policy_test.go +0 -39
- package/dist/templates/native-go/backend/internal/filestation/service.go +0 -254
- package/dist/templates/native-go/backend/internal/filestation/service_test.go +0 -74
- package/dist/templates/native-go/backend/internal/filestation/upload_stream.go +0 -76
- package/dist/templates/native-go/backend/internal/filestation/upload_stream_test.go +0 -77
- package/dist/templates/native-go/backend/internal/filestation/write.go +0 -32
- package/dist/templates/native-go/backend/internal/filestation/write_test.go +0 -124
- package/dist/templates/native-go/backend/internal/identity/README.md +0 -59
- package/dist/templates/native-go/backend/internal/identity/dsm.go +0 -115
- package/dist/templates/native-go/backend/internal/identity/http.go +0 -291
- package/dist/templates/native-go/backend/internal/identity/identity_test.go +0 -530
- package/dist/templates/native-go/backend/internal/identity/service.go +0 -159
- package/dist/templates/native-go/backend/internal/identity/store.go +0 -109
- package/dist/templates/native-go/backend/internal/jsonlimits/limits.go +0 -48
- package/dist/templates/native-go/backend/internal/jsonlimits/limits_test.go +0 -52
- package/dist/templates/native-go/backend/internal/portal/portal.go +0 -138
- package/dist/templates/native-go/backend/internal/portal/portal_test.go +0 -89
- package/dist/templates/native-go/dsm-package.yaml +0 -71
- package/dist/templates/native-go/gitignore +0 -1
- package/dist/templates/native-go/i18n/glossary.json +0 -663
- package/dist/templates/native-go/i18n/messages/de.json +0 -29
- package/dist/templates/native-go/i18n/messages/en.json +0 -29
- package/dist/templates/native-go/i18n/messages/es.json +0 -29
- package/dist/templates/native-go/i18n/messages/fr.json +0 -29
- package/dist/templates/native-go/i18n/messages/it.json +0 -29
- package/dist/templates/native-go/i18n/messages/ja.json +0 -29
- package/dist/templates/native-go/i18n/messages/ko.json +0 -29
- package/dist/templates/native-go/i18n/messages/zh-CN.json +0 -29
- package/dist/templates/native-go/i18n/messages/zh-TW.json +0 -29
- package/dist/templates/native-go/ui/app.css +0 -45
- package/dist/templates/native-go/ui/app.js +0 -111
- package/dist/templates/native-go-delegate/DELEGATE.md +0 -263
- package/dist/templates/native-go-delegate/backend/cmd/background-worker/main.go +0 -48
- package/dist/templates/native-go-delegate/backend/internal/app/delegate.go +0 -25
- package/dist/templates/native-go-delegate/backend/internal/app/delegate_on.go +0 -5
- package/dist/templates/native-go-delegate/backend/internal/app/delegate_routes_test.go +0 -31
- package/dist/templates/native-go-delegate/backend/internal/background/delegate_review_test.go +0 -174
- package/dist/templates/native-go-delegate/backend/internal/background/delegated.go +0 -277
- package/dist/templates/native-go-delegate/backend/internal/background/delegated_moves.go +0 -270
- package/dist/templates/native-go-delegate/backend/internal/background/delegated_test.go +0 -34
- package/dist/templates/native-go-delegate/backend/internal/delegate/admission_recovery_test.go +0 -410
- package/dist/templates/native-go-delegate/backend/internal/delegate/busy_review_test.go +0 -15
- package/dist/templates/native-go-delegate/backend/internal/delegate/cancel_contract_test.go +0 -95
- package/dist/templates/native-go-delegate/backend/internal/delegate/client.go +0 -151
- package/dist/templates/native-go-delegate/backend/internal/delegate/client_test.go +0 -214
- package/dist/templates/native-go-delegate/backend/internal/delegate/destination.go +0 -110
- package/dist/templates/native-go-delegate/backend/internal/delegate/destination_state.go +0 -117
- package/dist/templates/native-go-delegate/backend/internal/delegate/destination_state_test.go +0 -60
- package/dist/templates/native-go-delegate/backend/internal/delegate/destination_test.go +0 -116
- package/dist/templates/native-go-delegate/backend/internal/delegate/example.go +0 -81
- package/dist/templates/native-go-delegate/backend/internal/delegate/example_test.go +0 -91
- package/dist/templates/native-go-delegate/backend/internal/delegate/executor_contract_test.go +0 -511
- package/dist/templates/native-go-delegate/backend/internal/delegate/files.go +0 -132
- package/dist/templates/native-go-delegate/backend/internal/delegate/long_running_routes.go +0 -92
- package/dist/templates/native-go-delegate/backend/internal/delegate/long_running_routes_test.go +0 -99
- package/dist/templates/native-go-delegate/backend/internal/delegate/move.go +0 -348
- package/dist/templates/native-go-delegate/backend/internal/delegate/move_test.go +0 -351
- package/dist/templates/native-go-delegate/backend/internal/delegate/operations_list.go +0 -65
- package/dist/templates/native-go-delegate/backend/internal/delegate/operations_list_test.go +0 -114
- package/dist/templates/native-go-delegate/backend/internal/delegate/retry.go +0 -106
- package/dist/templates/native-go-delegate/backend/internal/delegate/retry_test.go +0 -143
- package/dist/templates/native-go-delegate/backend/internal/delegate/service.go +0 -364
- package/dist/templates/native-go-delegate/backend/internal/delegate/service_test.go +0 -318
- package/dist/templates/native-go-delegate/backend/internal/delegate/staging.go +0 -121
- package/dist/templates/native-go-delegate/backend/internal/delegate/status_disabled_test.go +0 -51
- package/dist/templates/native-go-delegate/backend/internal/delegate/testdata/executor_contract.txt +0 -112
- package/dist/templates/native-go-delegate/backend/internal/delegate/transient_contract_test.go +0 -137
- package/dist/templates/native-go-delegate/backend/internal/delegate/wait_cancel_test.go +0 -101
- package/dist/templates/native-go-delegate/backend/internal/delegate/worker.go +0 -225
- package/dist/templates/native-go-delegate/backend/internal/filestation/files.go +0 -43
- package/dist/templates/native-go-delegate/backend/internal/filestation/files_test.go +0 -59
- package/dist/templates/native-go-delegate/frontend/src/CapabilityPanels.vue +0 -37
- package/dist/templates/native-go-delegate/frontend/src/delegate/BackgroundSavePanel.vue +0 -113
- package/dist/templates/native-go-delegate/frontend/src/delegate/DelegatePanel.vue +0 -70
- package/dist/templates/native-go-delegate/frontend/src/delegate/copy.ts +0 -8
- package/dist/templates/native-go-delegate/frontend/src/delegate/i18n/waiting.json +0 -11
- package/dist/templates/native-go-delegate/frontend/test/background-save.test.ts +0 -121
- package/dist/templates/native-go-delegate/frontend/test/delegate.test.ts +0 -145
- package/dist/templates/native-go-delegate/frontend/test/scope-settings.test.ts +0 -49
- package/dist/templates/native-go-delegate/test-frontend.sh +0 -12
- package/dist/templates/native-go-delegate/test.sh +0 -18
- package/dist/templates/native-go-jobs/BACKGROUND.md +0 -108
- package/dist/templates/native-go-jobs/backend/internal/app/background_on.go +0 -7
- package/dist/templates/native-go-jobs/backend/internal/app/background_routes_test.go +0 -90
- package/dist/templates/native-go-jobs/frontend/src/background/BackgroundPanel.vue +0 -170
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/de.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/en.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/es.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/fr.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/it.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/ja.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/ko.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/zh-CN.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/zh-TW.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n.ts +0 -19
- package/dist/templates/native-go-jobs/frontend/src/background/picker-provider.ts +0 -12
- package/dist/templates/native-go-jobs/frontend/src/background/request-key.ts +0 -5
- package/dist/templates/native-go-jobs/frontend/test/background.test.ts +0 -205
- package/dist/templates/native-go-root-ops/backend/internal/app/executor.go +0 -140
- package/dist/templates/native-go-root-ops/backend/internal/app/executor_test.go +0 -117
- package/dist/templates/native-go-root-ops/root/whoami.sh +0 -3
- package/dist/templates/native-go-vue/README.md +0 -47
- package/dist/templates/native-go-vue/frontend/DESIGN.md +0 -61
- package/dist/templates/native-go-vue/frontend/package-lock.json +0 -2530
- package/dist/templates/native-go-vue/frontend/package.json +0 -6
- package/dist/templates/native-go-vue/frontend/src/App.vue +0 -96
- package/dist/templates/native-go-vue/frontend/src/CapabilityPanels.vue +0 -6
- package/dist/templates/native-go-vue/frontend/src/context.ts +0 -78
- package/dist/templates/native-go-vue/frontend/src/delegate/ExecutorSettings.vue +0 -70
- package/dist/templates/native-go-vue/frontend/src/delegate/catalogs.ts +0 -11
- package/dist/templates/native-go-vue/frontend/src/delegate/copy.test.ts +0 -12
- package/dist/templates/native-go-vue/frontend/src/delegate/copy.ts +0 -4
- package/dist/templates/native-go-vue/frontend/src/delegate/executor-settings.test.ts +0 -23
- package/dist/templates/native-go-vue/frontend/src/delegate/executor-setup.ts +0 -24
- package/dist/templates/native-go-vue/frontend/src/delegate/facade.test.ts +0 -100
- package/dist/templates/native-go-vue/frontend/src/delegate/facade.ts +0 -85
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/de.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/en.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/es.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/fr.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/it.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/ja.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/ko.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/de.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/en.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/es.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/fr.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/it.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/ja.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/ko.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/zh-CN.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/zh-TW.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/zh-CN.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/zh-TW.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/long-running.ts +0 -57
- package/dist/templates/native-go-vue/frontend/src/delegate/save-copy.test.ts +0 -12
- package/dist/templates/native-go-vue/frontend/src/delegate/save-copy.ts +0 -24
- package/dist/templates/native-go-vue/frontend/src/delegate/scoped-picker.test.ts +0 -12
- package/dist/templates/native-go-vue/frontend/src/delegate/scoped-picker.ts +0 -21
- package/dist/templates/native-go-vue/frontend/src/files/FileBrowser.vue +0 -131
- package/dist/templates/native-go-vue/frontend/src/files/FilesPage.vue +0 -35
- package/dist/templates/native-go-vue/frontend/src/files/files.test.ts +0 -100
- package/dist/templates/native-go-vue/frontend/src/files/provider.test.ts +0 -48
- package/dist/templates/native-go-vue/frontend/src/files/transfers.test.ts +0 -27
- package/dist/templates/native-go-vue/frontend/src/files/transfers.ts +0 -25
- package/dist/templates/native-go-vue/frontend/src/i18n/de.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/en.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/es.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/fr.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/it.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/ja.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/ko.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/zh-CN.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/zh-TW.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n.ts +0 -13
- package/dist/templates/native-go-vue/frontend/src/identity/DESIGN.md +0 -46
- package/dist/templates/native-go-vue/frontend/src/identity/LoginPage.vue +0 -78
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/de.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/en.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/es.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/fr.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/it.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/ja.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/ko.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/zh-CN.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/zh-TW.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n.ts +0 -14
- package/dist/templates/native-go-vue/frontend/src/identity/login.test.ts +0 -32
- package/dist/templates/native-go-vue/frontend/src/identity/session.test.ts +0 -33
- package/dist/templates/native-go-vue/frontend/src/identity/session.ts +0 -74
- package/dist/templates/native-go-vue/frontend/src/main.ts +0 -32
- package/dist/templates/native-go-vue/frontend/src/nas/NasPicker.vue +0 -42
- package/dist/templates/native-go-vue/frontend/src/nas/contract.ts +0 -12
- package/dist/templates/native-go-vue/frontend/src/nas/destination.test.ts +0 -48
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/de.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/en.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/es.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/fr.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/it.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/ja.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/ko.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/zh-CN.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/zh-TW.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n.ts +0 -2
- package/dist/templates/native-go-vue/frontend/src/nas/locale.ts +0 -24
- package/dist/templates/native-go-vue/frontend/src/nas/provider.ts +0 -50
- package/dist/templates/native-go-vue/frontend/src/nas/use-request.ts +0 -18
- package/dist/templates/native-go-vue/frontend/src/portal/PortalSettings.vue +0 -39
- package/dist/templates/native-go-vue/frontend/src/shell/AppShell.vue +0 -48
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/de.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/en.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/es.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/fr.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/it.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ja.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ko.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n.ts +0 -17
- package/dist/templates/native-go-vue/frontend/src/shell/pages.ts +0 -15
- package/dist/templates/native-go-vue/frontend/src/style.css +0 -27
- package/dist/templates/native-go-vue/frontend/test/apps.test.ts +0 -57
- package/dist/templates/native-go-vue/frontend/test/native-controls.test.ts +0 -27
- package/dist/templates/native-go-vue/frontend/test/portal-settings.test.ts +0 -71
- package/dist/templates/native-go-vue/frontend/test/shell-i18n.test.ts +0 -50
- package/dist/templates/native-go-vue/frontend/test/shell-ui.test.ts +0 -20
- package/dist/templates/native-go-vue/frontend/test/shell.test.ts +0 -30
- package/dist/templates/native-go-vue/frontend/tsconfig.json +0 -1
- package/dist/templates/native-go-vue/frontend/vite.config.ts +0 -10
- package/dist/templates/native-go-vue/gitignore +0 -2
- package/templates/_daemon/fixture_linux_test.go +0 -15
- package/templates/_daemon/fixture_other_test.go +0 -7
- package/templates/_daemon/go.mod +0 -5
- package/templates/_daemon/main.go +0 -611
- package/templates/_daemon/main_test.go +0 -315
- package/templates/_daemon/process_linux.go +0 -55
- package/templates/_daemon/process_linux_test.go +0 -161
- package/templates/_daemon/process_other.go +0 -14
- package/templates/_daemon/testdata/child.go +0 -44
- package/templates/_executor/README.md +0 -318
- package/templates/_executor/anchor.go +0 -156
- package/templates/_executor/anchor_test.go +0 -161
- package/templates/_executor/apppriv_review_test.go +0 -28
- package/templates/_executor/auth_presence_review_test.go +0 -38
- package/templates/_executor/cancel_contract_test.go +0 -236
- package/templates/_executor/cmd/lifecycle/main.go +0 -42
- package/templates/_executor/cookie_review_test.go +0 -27
- package/templates/_executor/copy.go +0 -64
- package/templates/_executor/copy_test.go +0 -88
- package/templates/_executor/digest_review_test.go +0 -120
- package/templates/_executor/directories.go +0 -40
- package/templates/_executor/dsm.go +0 -369
- package/templates/_executor/dsm_test.go +0 -290
- package/templates/_executor/executor.go +0 -735
- package/templates/_executor/executor_test.go +0 -314
- package/templates/_executor/go.mod +0 -5
- package/templates/_executor/identity.go +0 -74
- package/templates/_executor/identity_kernel_linux_test.go +0 -60
- package/templates/_executor/identity_linux.go +0 -82
- package/templates/_executor/identity_security_test.go +0 -43
- package/templates/_executor/internal/lifecycle/lifecycle.go +0 -95
- package/templates/_executor/internal/lifecycle/lifecycle_test.go +0 -232
- package/templates/_executor/internal/taskscript/boot.sh +0 -31
- package/templates/_executor/internal/taskscript/cmd/main.go +0 -19
- package/templates/_executor/internal/taskscript/control.sh +0 -31
- package/templates/_executor/internal/taskscript/tasks.go +0 -44
- package/templates/_executor/json_review_test.go +0 -40
- package/templates/_executor/lifecycle_test.go +0 -97
- package/templates/_executor/link_linux.go +0 -28
- package/templates/_executor/long_running_test.go +0 -530
- package/templates/_executor/main.go +0 -576
- package/templates/_executor/managed.go +0 -117
- package/templates/_executor/managed_test.go +0 -137
- package/templates/_executor/move_linux.go +0 -490
- package/templates/_executor/move_linux_test.go +0 -460
- package/templates/_executor/move_validation.go +0 -46
- package/templates/_executor/move_validation_test.go +0 -187
- package/templates/_executor/operations.go +0 -926
- package/templates/_executor/path_test.go +0 -35
- package/templates/_executor/pid.go +0 -37
- package/templates/_executor/pid_test.go +0 -113
- package/templates/_executor/platform_linux.go +0 -187
- package/templates/_executor/platform_linux_test.go +0 -191
- package/templates/_executor/platform_other.go +0 -76
- package/templates/_executor/process.go +0 -142
- package/templates/_executor/purge_log.go +0 -18
- package/templates/_executor/records.go +0 -242
- package/templates/_executor/scope_cancel_contract_test.go +0 -91
- package/templates/_executor/scope_client.go +0 -37
- package/templates/_executor/scope_contract.go +0 -12
- package/templates/_executor/selected_scope.go +0 -146
- package/templates/_executor/selected_scope_test.go +0 -186
- package/templates/_executor/socket_linux_test.go +0 -46
- package/templates/_executor/status_disabled_test.go +0 -33
- package/templates/_executor/store.go +0 -91
- package/templates/_executor/supervise.go +0 -109
- package/templates/_executor/supervise_test.go +0 -130
- package/templates/_executor/task_race_review_test.go +0 -47
- package/templates/_executor/tasks.go +0 -320
- package/templates/_executor/tasks_dsm71_test.go +0 -114
- package/templates/_executor/tasks_review_test.go +0 -43
- package/templates/_executor/tasks_test.go +0 -223
- package/templates/_executor/testdata/evidence/cleanup.json +0 -24
- package/templates/_executor/testdata/evidence/final-smoke.jsonl +0 -9
- package/templates/_executor/testdata/evidence/kernel-acl.json +0 -6
- package/templates/_executor/testdata/evidence/linux-tests.log +0 -123
- package/templates/_executor/testdata/evidence/live.jsonl +0 -23
- package/templates/_executor/testdata/evidence/storage.json +0 -90
- package/templates/_executor/testdata/evidence/validation.json +0 -55
- package/templates/_executor/testdata/live_probe.py +0 -98
- package/templates/_executor/upgrade_watch_test.go +0 -244
- package/templates/_executor/watch.go +0 -164
- package/templates/_executor/watch_test.go +0 -291
- package/templates/_executor/write_review_linux_test.go +0 -87
- package/templates/_gateway/auth.go +0 -101
- package/templates/_gateway/auth_test.go +0 -216
- package/templates/_gateway/cgi.go +0 -133
- package/templates/_gateway/cgi_test.go +0 -156
- package/templates/_gateway/csrf.go +0 -73
- package/templates/_gateway/csrf_test.go +0 -155
- package/templates/_gateway/directory.go +0 -108
- package/templates/_gateway/directory_test.go +0 -202
- package/templates/_gateway/gateway.go +0 -412
- package/templates/_gateway/gateway_test.go +0 -676
- package/templates/_gateway/go.mod +0 -5
- package/templates/_gateway/groups.go +0 -66
- package/templates/_gateway/main.go +0 -45
- package/templates/_shared/AGENTS.md +0 -146
- package/templates/_shared/CLAUDE.md +0 -1
- package/templates/_shared/GO-LICENSE +0 -27
- package/templates/_shared/GO-PATENTS +0 -22
- package/templates/_shared/LICENSES/TEMPLATE.txt +0 -21
- package/templates/_shared/third-party-notices.mjs +0 -51
- package/templates/binary/LICENSES/GO-LICENSE +0 -27
- package/templates/binary/LICENSES/GO-PATENTS +0 -22
- package/templates/binary/dsm-package.yaml +0 -46
- package/templates/binary/example/main.go +0 -16
- package/templates/binary/gitignore +0 -2
- package/templates/binary/i18n/messages/de.json +0 -4
- package/templates/binary/i18n/messages/en.json +0 -4
- package/templates/binary/i18n/messages/es.json +0 -4
- package/templates/binary/i18n/messages/fr.json +0 -4
- package/templates/binary/i18n/messages/it.json +0 -4
- package/templates/binary/i18n/messages/ja.json +0 -4
- package/templates/binary/i18n/messages/ko.json +0 -4
- package/templates/binary/i18n/messages/zh-CN.json +0 -4
- package/templates/binary/i18n/messages/zh-TW.json +0 -4
- package/templates/binary/ui/app.css +0 -4
- package/templates/binary/ui/app.js +0 -32
- package/templates/compose/compose.yaml +0 -8
- package/templates/compose/synology-app.yaml +0 -16
- package/templates/native-authorization/AuthorizationGate.vue +0 -91
- package/templates/native-authorization/i18n/de.json +0 -37
- package/templates/native-authorization/i18n/en.json +0 -37
- package/templates/native-authorization/i18n/es.json +0 -37
- package/templates/native-authorization/i18n/fr.json +0 -37
- package/templates/native-authorization/i18n/index.ts +0 -15
- package/templates/native-authorization/i18n/it.json +0 -37
- package/templates/native-authorization/i18n/ja.json +0 -37
- package/templates/native-authorization/i18n/ko.json +0 -37
- package/templates/native-authorization/i18n/zh-CN.json +0 -37
- package/templates/native-authorization/i18n/zh-TW.json +0 -37
- package/templates/native-go/README.md +0 -459
- package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +0 -61
- package/templates/native-go/backend/cmd/app/main.go +0 -95
- package/templates/native-go/backend/cmd/background-worker/main.go +0 -38
- package/templates/native-go/backend/go.mod +0 -9
- package/templates/native-go/backend/go.sum +0 -4
- package/templates/native-go/backend/internal/api/cgi_framing_test.go +0 -32
- package/templates/native-go/backend/internal/api/cookie_review_test.go +0 -28
- package/templates/native-go/backend/internal/api/deadline_test.go +0 -114
- package/templates/native-go/backend/internal/api/dsm-session.go +0 -54
- package/templates/native-go/backend/internal/api/dsm-session_test.go +0 -51
- package/templates/native-go/backend/internal/api/entry_test.go +0 -47
- package/templates/native-go/backend/internal/api/errors.go +0 -47
- package/templates/native-go/backend/internal/api/permissions.go +0 -161
- package/templates/native-go/backend/internal/api/permissions.json +0 -5
- package/templates/native-go/backend/internal/api/permissions_test.go +0 -113
- package/templates/native-go/backend/internal/api/policy_fixture_test.go +0 -8
- package/templates/native-go/backend/internal/api/registry.go +0 -142
- package/templates/native-go/backend/internal/api/registry_test.go +0 -344
- package/templates/native-go/backend/internal/api/resource_limits_test.go +0 -87
- package/templates/native-go/backend/internal/api/sdk-permissions.json +0 -59
- package/templates/native-go/backend/internal/api/sdk_policy_test.go +0 -31
- package/templates/native-go/backend/internal/api/server.go +0 -305
- package/templates/native-go/backend/internal/api/testdata/permissions-cases.json +0 -172
- package/templates/native-go/backend/internal/app/background.go +0 -249
- package/templates/native-go/backend/internal/app/background_none.go +0 -8
- package/templates/native-go/backend/internal/app/background_owner.go +0 -38
- package/templates/native-go/backend/internal/app/background_owner_test.go +0 -163
- package/templates/native-go/backend/internal/app/background_schedule.go +0 -69
- package/templates/native-go/backend/internal/app/background_schedule_test.go +0 -62
- package/templates/native-go/backend/internal/app/background_test.go +0 -320
- package/templates/native-go/backend/internal/app/delegate_config.go +0 -57
- package/templates/native-go/backend/internal/app/delegate_config_test.go +0 -28
- package/templates/native-go/backend/internal/app/delegate_none.go +0 -5
- package/templates/native-go/backend/internal/app/identity.go +0 -20
- package/templates/native-go/backend/internal/app/identity_test.go +0 -15
- package/templates/native-go/backend/internal/app/migrations.go +0 -41
- package/templates/native-go/backend/internal/app/migrations_test.go +0 -41
- package/templates/native-go/backend/internal/app/portal.go +0 -30
- package/templates/native-go/backend/internal/app/portal_test.go +0 -55
- package/templates/native-go/backend/internal/app/root_none.go +0 -9
- package/templates/native-go/backend/internal/app/routes.go +0 -137
- package/templates/native-go/backend/internal/app/routes_test.go +0 -165
- package/templates/native-go/backend/internal/app/session_files.go +0 -9
- package/templates/native-go/backend/internal/app/session_files_test.go +0 -14
- package/templates/native-go/backend/internal/app/shared_folder.go +0 -144
- package/templates/native-go/backend/internal/app/shared_folder_test.go +0 -158
- package/templates/native-go/backend/internal/background/access.go +0 -57
- package/templates/native-go/backend/internal/background/lock_test.go +0 -131
- package/templates/native-go/backend/internal/background/owner_test.go +0 -118
- package/templates/native-go/backend/internal/background/runner.go +0 -185
- package/templates/native-go/backend/internal/background/runner_test.go +0 -209
- package/templates/native-go/backend/internal/background/schedule.go +0 -336
- package/templates/native-go/backend/internal/background/schedule_test.go +0 -368
- package/templates/native-go/backend/internal/background/store.go +0 -825
- package/templates/native-go/backend/internal/background/store_test.go +0 -365
- package/templates/native-go/backend/internal/datamigrate/migrate.go +0 -191
- package/templates/native-go/backend/internal/datamigrate/migrate_test.go +0 -177
- package/templates/native-go/backend/internal/dsm/admin.go +0 -76
- package/templates/native-go/backend/internal/dsm/admin_linux.go +0 -110
- package/templates/native-go/backend/internal/dsm/admin_linux_test.go +0 -105
- package/templates/native-go/backend/internal/dsm/admin_other.go +0 -15
- package/templates/native-go/backend/internal/dsm/admin_test.go +0 -67
- package/templates/native-go/backend/internal/dsm/apppriv.go +0 -30
- package/templates/native-go/backend/internal/dsm/auth.go +0 -94
- package/templates/native-go/backend/internal/dsm/auth_test.go +0 -159
- package/templates/native-go/backend/internal/dsm/bridge_file.go +0 -75
- package/templates/native-go/backend/internal/dsm/bridge_file_test.go +0 -57
- package/templates/native-go/backend/internal/dsm/entry.go +0 -177
- package/templates/native-go/backend/internal/dsm/entry_test.go +0 -315
- package/templates/native-go/backend/internal/dsm/native/admin-aarch64.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/admin-armv7.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/admin-x86_64.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/admin_check.c +0 -28
- package/templates/native-go/backend/internal/dsm/native/apppriv-aarch64.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/apppriv-armv7.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/apppriv-x86_64.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/apppriv_check.c +0 -33
- package/templates/native-go/backend/internal/dsm/native/build.sh +0 -18
- package/templates/native-go/backend/internal/dsm/native/licenses/GLIBC-NOTICES.txt +0 -400
- package/templates/native-go/backend/internal/dsm/native/licenses/LGPL-2.1.txt +0 -501
- package/templates/native-go/backend/internal/dsm/native/licenses/SOURCE.txt +0 -5
- package/templates/native-go/backend/internal/dsm/native/licenses/ZIG-MIT.txt +0 -21
- package/templates/native-go/backend/internal/dsm/native/provenance.json +0 -18
- package/templates/native-go/backend/internal/filestation/browse_test.go +0 -67
- package/templates/native-go/backend/internal/filestation/check_permission.go +0 -71
- package/templates/native-go/backend/internal/filestation/check_permission_test.go +0 -77
- package/templates/native-go/backend/internal/filestation/client.go +0 -337
- package/templates/native-go/backend/internal/filestation/client_test.go +0 -155
- package/templates/native-go/backend/internal/filestation/doc.go +0 -4
- package/templates/native-go/backend/internal/filestation/download_dsm71_test.go +0 -82
- package/templates/native-go/backend/internal/filestation/http.go +0 -70
- package/templates/native-go/backend/internal/filestation/http_test.go +0 -188
- package/templates/native-go/backend/internal/filestation/operations_test.go +0 -206
- package/templates/native-go/backend/internal/filestation/read_file_test.go +0 -89
- package/templates/native-go/backend/internal/filestation/sdk_policy_test.go +0 -39
- package/templates/native-go/backend/internal/filestation/service.go +0 -254
- package/templates/native-go/backend/internal/filestation/service_test.go +0 -74
- package/templates/native-go/backend/internal/filestation/upload_stream.go +0 -76
- package/templates/native-go/backend/internal/filestation/upload_stream_test.go +0 -77
- package/templates/native-go/backend/internal/filestation/write.go +0 -32
- package/templates/native-go/backend/internal/filestation/write_test.go +0 -124
- package/templates/native-go/backend/internal/identity/README.md +0 -59
- package/templates/native-go/backend/internal/identity/dsm.go +0 -115
- package/templates/native-go/backend/internal/identity/http.go +0 -291
- package/templates/native-go/backend/internal/identity/identity_test.go +0 -530
- package/templates/native-go/backend/internal/identity/service.go +0 -159
- package/templates/native-go/backend/internal/identity/store.go +0 -109
- package/templates/native-go/backend/internal/jsonlimits/limits.go +0 -48
- package/templates/native-go/backend/internal/jsonlimits/limits_test.go +0 -52
- package/templates/native-go/backend/internal/portal/portal.go +0 -138
- package/templates/native-go/backend/internal/portal/portal_test.go +0 -89
- package/templates/native-go/dsm-package.yaml +0 -71
- package/templates/native-go/gitignore +0 -1
- package/templates/native-go/i18n/glossary.json +0 -663
- package/templates/native-go/i18n/messages/de.json +0 -29
- package/templates/native-go/i18n/messages/en.json +0 -29
- package/templates/native-go/i18n/messages/es.json +0 -29
- package/templates/native-go/i18n/messages/fr.json +0 -29
- package/templates/native-go/i18n/messages/it.json +0 -29
- package/templates/native-go/i18n/messages/ja.json +0 -29
- package/templates/native-go/i18n/messages/ko.json +0 -29
- package/templates/native-go/i18n/messages/zh-CN.json +0 -29
- package/templates/native-go/i18n/messages/zh-TW.json +0 -29
- package/templates/native-go/ui/app.css +0 -45
- package/templates/native-go/ui/app.js +0 -111
- package/templates/native-go-delegate/DELEGATE.md +0 -263
- package/templates/native-go-delegate/backend/cmd/background-worker/main.go +0 -48
- package/templates/native-go-delegate/backend/internal/app/delegate.go +0 -25
- package/templates/native-go-delegate/backend/internal/app/delegate_on.go +0 -5
- package/templates/native-go-delegate/backend/internal/app/delegate_routes_test.go +0 -31
- package/templates/native-go-delegate/backend/internal/background/delegate_review_test.go +0 -174
- package/templates/native-go-delegate/backend/internal/background/delegated.go +0 -277
- package/templates/native-go-delegate/backend/internal/background/delegated_moves.go +0 -270
- package/templates/native-go-delegate/backend/internal/background/delegated_test.go +0 -34
- package/templates/native-go-delegate/backend/internal/delegate/admission_recovery_test.go +0 -410
- package/templates/native-go-delegate/backend/internal/delegate/busy_review_test.go +0 -15
- package/templates/native-go-delegate/backend/internal/delegate/cancel_contract_test.go +0 -95
- package/templates/native-go-delegate/backend/internal/delegate/client.go +0 -151
- package/templates/native-go-delegate/backend/internal/delegate/client_test.go +0 -214
- package/templates/native-go-delegate/backend/internal/delegate/destination.go +0 -110
- package/templates/native-go-delegate/backend/internal/delegate/destination_state.go +0 -117
- package/templates/native-go-delegate/backend/internal/delegate/destination_state_test.go +0 -60
- package/templates/native-go-delegate/backend/internal/delegate/destination_test.go +0 -116
- package/templates/native-go-delegate/backend/internal/delegate/example.go +0 -81
- package/templates/native-go-delegate/backend/internal/delegate/example_test.go +0 -91
- package/templates/native-go-delegate/backend/internal/delegate/executor_contract_test.go +0 -511
- package/templates/native-go-delegate/backend/internal/delegate/files.go +0 -132
- package/templates/native-go-delegate/backend/internal/delegate/long_running_routes.go +0 -92
- package/templates/native-go-delegate/backend/internal/delegate/long_running_routes_test.go +0 -99
- package/templates/native-go-delegate/backend/internal/delegate/move.go +0 -348
- package/templates/native-go-delegate/backend/internal/delegate/move_test.go +0 -351
- package/templates/native-go-delegate/backend/internal/delegate/operations_list.go +0 -65
- package/templates/native-go-delegate/backend/internal/delegate/operations_list_test.go +0 -114
- package/templates/native-go-delegate/backend/internal/delegate/retry.go +0 -106
- package/templates/native-go-delegate/backend/internal/delegate/retry_test.go +0 -143
- package/templates/native-go-delegate/backend/internal/delegate/service.go +0 -364
- package/templates/native-go-delegate/backend/internal/delegate/service_test.go +0 -318
- package/templates/native-go-delegate/backend/internal/delegate/staging.go +0 -121
- package/templates/native-go-delegate/backend/internal/delegate/status_disabled_test.go +0 -51
- package/templates/native-go-delegate/backend/internal/delegate/testdata/executor_contract.txt +0 -112
- package/templates/native-go-delegate/backend/internal/delegate/transient_contract_test.go +0 -137
- package/templates/native-go-delegate/backend/internal/delegate/wait_cancel_test.go +0 -101
- package/templates/native-go-delegate/backend/internal/delegate/worker.go +0 -225
- package/templates/native-go-delegate/backend/internal/filestation/files.go +0 -43
- package/templates/native-go-delegate/backend/internal/filestation/files_test.go +0 -59
- package/templates/native-go-delegate/frontend/src/CapabilityPanels.vue +0 -37
- package/templates/native-go-delegate/frontend/src/delegate/BackgroundSavePanel.vue +0 -113
- package/templates/native-go-delegate/frontend/src/delegate/DelegatePanel.vue +0 -70
- package/templates/native-go-delegate/frontend/src/delegate/copy.ts +0 -8
- package/templates/native-go-delegate/frontend/src/delegate/i18n/waiting.json +0 -11
- package/templates/native-go-delegate/frontend/test/background-save.test.ts +0 -121
- package/templates/native-go-delegate/frontend/test/delegate.test.ts +0 -145
- package/templates/native-go-delegate/frontend/test/scope-settings.test.ts +0 -49
- package/templates/native-go-delegate/test-frontend.sh +0 -12
- package/templates/native-go-delegate/test.sh +0 -18
- package/templates/native-go-jobs/BACKGROUND.md +0 -108
- package/templates/native-go-jobs/backend/internal/app/background_on.go +0 -7
- package/templates/native-go-jobs/backend/internal/app/background_routes_test.go +0 -90
- package/templates/native-go-jobs/frontend/src/background/BackgroundPanel.vue +0 -170
- package/templates/native-go-jobs/frontend/src/background/i18n/de.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/en.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/es.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/fr.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/it.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/ja.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/ko.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/zh-CN.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/zh-TW.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n.ts +0 -19
- package/templates/native-go-jobs/frontend/src/background/picker-provider.ts +0 -12
- package/templates/native-go-jobs/frontend/src/background/request-key.ts +0 -5
- package/templates/native-go-jobs/frontend/test/background.test.ts +0 -205
- package/templates/native-go-root-ops/backend/internal/app/executor.go +0 -140
- package/templates/native-go-root-ops/backend/internal/app/executor_test.go +0 -117
- package/templates/native-go-root-ops/root/whoami.sh +0 -3
- package/templates/native-go-vue/README.md +0 -47
- package/templates/native-go-vue/frontend/DESIGN.md +0 -61
- package/templates/native-go-vue/frontend/package-lock.json +0 -2530
- package/templates/native-go-vue/frontend/package.json +0 -6
- package/templates/native-go-vue/frontend/src/App.vue +0 -96
- package/templates/native-go-vue/frontend/src/CapabilityPanels.vue +0 -6
- package/templates/native-go-vue/frontend/src/context.ts +0 -78
- package/templates/native-go-vue/frontend/src/delegate/ExecutorSettings.vue +0 -70
- package/templates/native-go-vue/frontend/src/delegate/catalogs.ts +0 -11
- package/templates/native-go-vue/frontend/src/delegate/copy.test.ts +0 -12
- package/templates/native-go-vue/frontend/src/delegate/copy.ts +0 -4
- package/templates/native-go-vue/frontend/src/delegate/executor-settings.test.ts +0 -23
- package/templates/native-go-vue/frontend/src/delegate/executor-setup.ts +0 -24
- package/templates/native-go-vue/frontend/src/delegate/facade.test.ts +0 -100
- package/templates/native-go-vue/frontend/src/delegate/facade.ts +0 -85
- package/templates/native-go-vue/frontend/src/delegate/i18n/de.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/en.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/es.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/fr.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/it.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/ja.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/ko.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/de.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/en.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/es.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/fr.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/it.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/ja.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/ko.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/zh-CN.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/zh-TW.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/zh-CN.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/zh-TW.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/long-running.ts +0 -57
- package/templates/native-go-vue/frontend/src/delegate/save-copy.test.ts +0 -12
- package/templates/native-go-vue/frontend/src/delegate/save-copy.ts +0 -24
- package/templates/native-go-vue/frontend/src/delegate/scoped-picker.test.ts +0 -12
- package/templates/native-go-vue/frontend/src/delegate/scoped-picker.ts +0 -21
- package/templates/native-go-vue/frontend/src/files/FileBrowser.vue +0 -131
- package/templates/native-go-vue/frontend/src/files/FilesPage.vue +0 -35
- package/templates/native-go-vue/frontend/src/files/files.test.ts +0 -100
- package/templates/native-go-vue/frontend/src/files/provider.test.ts +0 -48
- package/templates/native-go-vue/frontend/src/files/transfers.test.ts +0 -27
- package/templates/native-go-vue/frontend/src/files/transfers.ts +0 -25
- package/templates/native-go-vue/frontend/src/i18n/de.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/en.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/es.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/fr.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/it.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/ja.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/ko.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/zh-CN.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/zh-TW.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n.ts +0 -13
- package/templates/native-go-vue/frontend/src/identity/DESIGN.md +0 -46
- package/templates/native-go-vue/frontend/src/identity/LoginPage.vue +0 -78
- package/templates/native-go-vue/frontend/src/identity/i18n/de.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/en.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/es.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/fr.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/it.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/ja.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/ko.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/zh-CN.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/zh-TW.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n.ts +0 -14
- package/templates/native-go-vue/frontend/src/identity/login.test.ts +0 -32
- package/templates/native-go-vue/frontend/src/identity/session.test.ts +0 -33
- package/templates/native-go-vue/frontend/src/identity/session.ts +0 -74
- package/templates/native-go-vue/frontend/src/main.ts +0 -32
- package/templates/native-go-vue/frontend/src/nas/NasPicker.vue +0 -42
- package/templates/native-go-vue/frontend/src/nas/contract.ts +0 -12
- package/templates/native-go-vue/frontend/src/nas/destination.test.ts +0 -48
- package/templates/native-go-vue/frontend/src/nas/i18n/files/de.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/en.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/es.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/fr.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/it.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/ja.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/ko.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/zh-CN.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/zh-TW.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n.ts +0 -2
- package/templates/native-go-vue/frontend/src/nas/locale.ts +0 -24
- package/templates/native-go-vue/frontend/src/nas/provider.ts +0 -50
- package/templates/native-go-vue/frontend/src/nas/use-request.ts +0 -18
- package/templates/native-go-vue/frontend/src/portal/PortalSettings.vue +0 -39
- package/templates/native-go-vue/frontend/src/shell/AppShell.vue +0 -48
- package/templates/native-go-vue/frontend/src/shell/i18n/de.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/en.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/es.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/fr.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/it.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/ja.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/ko.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n.ts +0 -17
- package/templates/native-go-vue/frontend/src/shell/pages.ts +0 -15
- package/templates/native-go-vue/frontend/src/style.css +0 -27
- package/templates/native-go-vue/frontend/test/apps.test.ts +0 -57
- package/templates/native-go-vue/frontend/test/native-controls.test.ts +0 -27
- package/templates/native-go-vue/frontend/test/portal-settings.test.ts +0 -71
- package/templates/native-go-vue/frontend/test/shell-i18n.test.ts +0 -50
- package/templates/native-go-vue/frontend/test/shell-ui.test.ts +0 -20
- package/templates/native-go-vue/frontend/test/shell.test.ts +0 -30
- package/templates/native-go-vue/frontend/tsconfig.json +0 -1
- package/templates/native-go-vue/frontend/vite.config.ts +0 -10
- package/templates/native-go-vue/gitignore +0 -2
- /package/{dist/templates/_daemon → assets/go/daemon}/fixture_linux_test.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/fixture_other_test.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/go.mod +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/main.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/main_test.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/process_linux.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/process_linux_test.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/process_other.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/testdata/child.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/auth.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/auth_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/cgi.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/cgi_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/csrf.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/csrf_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/directory.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/directory_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/gateway.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/gateway_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/go.mod +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/groups.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/main.go +0 -0
- /package/{dist/templates/_shared → assets/licenses}/GO-LICENSE +0 -0
- /package/{dist/templates/_shared → assets/licenses}/GO-PATENTS +0 -0
- /package/{dist/templates/_shared/LICENSES → assets/licenses}/TEMPLATE.txt +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { ARCH_ELF_MACHINE, BOOLEAN_INFO_FIELDS, DSM7_MIN_VER, EXTRA_INFO_FIELDS, INFO_LANGUAGES, OPTIONAL_INFO_FIELDS, REQUIRED_INFO_FIELDS, } from "./dsm-spec.js";
|
|
4
|
+
const KNOWN_FIELDS = new Set([...REQUIRED_INFO_FIELDS, ...OPTIONAL_INFO_FIELDS, ...EXTRA_INFO_FIELDS]);
|
|
5
|
+
const BOOLEAN_FIELDS = new Set(BOOLEAN_INFO_FIELDS);
|
|
6
|
+
const LANGUAGES = new Set(INFO_LANGUAGES);
|
|
7
|
+
const MAX_VERSION_PART = 2 ** 31 - 1;
|
|
8
|
+
/** X.Y-B as the guide states, and X.Y.Z-B as DSM itself reports (7.2.1-69057). */
|
|
9
|
+
const OS_VER = /^(\d+)\.(\d+)(?:\.(\d+))?-(\d+)$/;
|
|
10
|
+
/** INFO lines are `key="value"` (or unquoted `key=value`); quotes may escape `\"` and `\\`. */
|
|
11
|
+
export function parseInfo(text, findings) {
|
|
12
|
+
const fields = new Map();
|
|
13
|
+
text.split(/\r?\n/).forEach((line, index) => {
|
|
14
|
+
if (/^\s*(#.*)?$/.test(line))
|
|
15
|
+
return;
|
|
16
|
+
const match = /^([A-Za-z0-9_]+)=(.*)$/.exec(line);
|
|
17
|
+
if (!match) {
|
|
18
|
+
findings?.add("SPK_INFO_LINE_INVALID", `INFO 第 ${index + 1} 行不是 key="value":${line.slice(0, 60)}`, "INFO");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const [, key, raw] = match;
|
|
22
|
+
let value = raw;
|
|
23
|
+
if (raw.startsWith('"')) {
|
|
24
|
+
const quoted = /^"((?:[^"\\]|\\.)*)"\s*$/.exec(raw);
|
|
25
|
+
if (!quoted) {
|
|
26
|
+
findings?.add("SPK_INFO_VALUE_UNTERMINATED", `INFO 第 ${index + 1} 行 ${key} 的引號沒有結束。`, "INFO");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
value = quoted[1].replace(/\\(.)/g, "$1");
|
|
30
|
+
}
|
|
31
|
+
if (fields.has(key))
|
|
32
|
+
findings?.add("SPK_INFO_FIELD_DUPLICATE", `INFO 重複設定 ${key};只有一個值會生效。`, "INFO");
|
|
33
|
+
fields.set(key, value);
|
|
34
|
+
});
|
|
35
|
+
return fields;
|
|
36
|
+
}
|
|
37
|
+
function compareOsVer(a, b) {
|
|
38
|
+
const parse = (value) => { const m = OS_VER.exec(value); return [Number(m[1]), Number(m[2]), Number(m[3] ?? 0), Number(m[4])]; };
|
|
39
|
+
const [x, y] = [parse(a), parse(b)];
|
|
40
|
+
for (let i = 0; i < 4; i++)
|
|
41
|
+
if (x[i] !== y[i])
|
|
42
|
+
return x[i] - y[i];
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
function checkVersion(version, findings) {
|
|
46
|
+
const parts = version.split(/[._-]/);
|
|
47
|
+
if (parts.some((part) => !/^\d+$/.test(part) || Number(part) > MAX_VERSION_PART)) {
|
|
48
|
+
findings.add("SPK_INFO_VERSION_INVALID", `INFO version「${version}」只能是以 .、-、_ 分隔的數字(每段 0–2147483647),例如 1.2.3-0001。`, "INFO");
|
|
49
|
+
}
|
|
50
|
+
else if (!version.includes("-")) {
|
|
51
|
+
findings.add("SPK_INFO_VERSION_NO_BUILD", `INFO version「${version}」沒有 -<build> 編號;指南格式為 [feature number]-[build number],例如 ${version}-0001。`, "INFO");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function checkArch(field, value, findings) {
|
|
55
|
+
const tokens = value.split(/\s+/).filter(Boolean);
|
|
56
|
+
for (const token of tokens.filter((t) => !ARCH_ELF_MACHINE.has(t))) {
|
|
57
|
+
findings.add("SPK_INFO_ARCH_UNKNOWN", `INFO ${field} 含有指南 Appendix A 與已知 DSM 7 平台都沒有的值「${token}」。`, "INFO");
|
|
58
|
+
}
|
|
59
|
+
if (field === "arch" && tokens.includes("noarch") && tokens.length > 1) {
|
|
60
|
+
findings.add("SPK_INFO_ARCH_NOARCH_MIXED", `INFO arch「${value}」同時有 noarch 與其他值;noarch 已代表所有平台。`, "INFO");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function checkTranslations(key, findings) {
|
|
64
|
+
const match = /^(displayname|description)_(.+)$/.exec(key);
|
|
65
|
+
if (!match)
|
|
66
|
+
return false;
|
|
67
|
+
if (!LANGUAGES.has(match[2])) {
|
|
68
|
+
findings.add("SPK_INFO_LANG_UNKNOWN", `INFO ${key} 的語言碼「${match[2]}」不在指南的清單(${INFO_LANGUAGES.join("、")})。`, "INFO");
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
/** Checks INFO fields; `payloadPath` is package.tgz on disk, for the checksum. */
|
|
73
|
+
export function checkInfoFields(fields, payloadPath, findings) {
|
|
74
|
+
for (const key of REQUIRED_INFO_FIELDS) {
|
|
75
|
+
if (!fields.get(key))
|
|
76
|
+
findings.add("SPK_INFO_FIELD_REQUIRED", `INFO 缺少必填欄位 ${key}。`, "INFO");
|
|
77
|
+
}
|
|
78
|
+
if (!fields.get("displayname")) {
|
|
79
|
+
findings.add("SPK_INFO_DISPLAYNAME_MISSING", "INFO 沒有 displayname;Package Center 會顯示 package 值。", "INFO");
|
|
80
|
+
}
|
|
81
|
+
const pkg = fields.get("package");
|
|
82
|
+
if (pkg && /[:/><|=]/.test(pkg)) {
|
|
83
|
+
findings.add("SPK_INFO_PACKAGE_INVALID", `INFO package「${pkg}」不能含有 : / > < | =。`, "INFO");
|
|
84
|
+
}
|
|
85
|
+
const version = fields.get("version");
|
|
86
|
+
if (version)
|
|
87
|
+
checkVersion(version, findings);
|
|
88
|
+
for (const key of ["os_min_ver", "os_max_ver"]) {
|
|
89
|
+
const value = fields.get(key);
|
|
90
|
+
if (!value)
|
|
91
|
+
continue;
|
|
92
|
+
if (!OS_VER.test(value)) {
|
|
93
|
+
findings.add("SPK_INFO_OS_VER_INVALID", `INFO ${key}「${value}」不是 <major>.<minor>-<build>(例如 7.0-40000)。`, "INFO");
|
|
94
|
+
}
|
|
95
|
+
else if (key === "os_min_ver" && compareOsVer(value, DSM7_MIN_VER) < 0) {
|
|
96
|
+
findings.add("SPK_INFO_OS_MIN_VER_LOW", `INFO os_min_ver「${value}」低於 ${DSM7_MIN_VER};DSM 7 套件應至少為 ${DSM7_MIN_VER}。`, "INFO");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
for (const key of ["arch", "exclude_arch"]) {
|
|
100
|
+
const value = fields.get(key);
|
|
101
|
+
if (value)
|
|
102
|
+
checkArch(key, value, findings);
|
|
103
|
+
}
|
|
104
|
+
for (const [key, value] of fields) {
|
|
105
|
+
if (BOOLEAN_FIELDS.has(key) && value !== "yes" && value !== "no") {
|
|
106
|
+
findings.add("SPK_INFO_BOOLEAN_INVALID", `INFO ${key}「${value}」只能是 "yes" 或 "no"。`, "INFO");
|
|
107
|
+
}
|
|
108
|
+
if (!checkTranslations(key, findings) && !KNOWN_FIELDS.has(key)) {
|
|
109
|
+
findings.add("SPK_INFO_FIELD_UNKNOWN", `INFO ${key} 不是指南列出的欄位;DSM 不會使用它。`, "INFO");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const adminport = fields.get("adminport");
|
|
113
|
+
if (adminport !== undefined && (!/^\d+$/.test(adminport) || Number(adminport) > 65536)) {
|
|
114
|
+
findings.add("SPK_INFO_ADMINPORT_INVALID", `INFO adminport「${adminport}」必須是 0–65536 的整數。`, "INFO");
|
|
115
|
+
}
|
|
116
|
+
const checksum = fields.get("checksum");
|
|
117
|
+
if (checksum && payloadPath) {
|
|
118
|
+
const actual = createHash("md5").update(readFileSync(payloadPath)).digest("hex");
|
|
119
|
+
if (checksum.toLowerCase() !== actual) {
|
|
120
|
+
findings.add("SPK_INFO_CHECKSUM_MISMATCH", `INFO checksum「${checksum}」不是 package.tgz 的 MD5(${actual})。`, "INFO");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Findings } from "./findings.js";
|
|
2
|
+
/** The outer SPK files by exact path, and each entry's mode. */
|
|
3
|
+
export interface OuterFiles {
|
|
4
|
+
files: Map<string, Buffer>;
|
|
5
|
+
modes: Map<string, number>;
|
|
6
|
+
}
|
|
7
|
+
export declare function checkMetadata(outer: OuterFiles, findings: Findings): void;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { CONF_ENTRIES, INFO_LANGUAGES, LIFECYCLE_SCRIPTS, MAX_LICENSE_BYTES, PACKAGE_ICONS, REPLACE_SCRIPTS, RESOURCE_WORKERS, } from "./dsm-spec.js";
|
|
2
|
+
const CONF = new Set(CONF_ENTRIES);
|
|
3
|
+
const WORKERS = new Set(RESOURCE_WORKERS);
|
|
4
|
+
const PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
5
|
+
const WIZARD_NAME = new RegExp(`^(install|upgrade|uninstall)_uifile(_(${INFO_LANGUAGES.join("|")}))?(\\.sh)?$`);
|
|
6
|
+
const RUN_AS = ["package", "root"];
|
|
7
|
+
const executable = (mode) => ((mode ?? 0) & 0o111) !== 0;
|
|
8
|
+
function isRecord(value) {
|
|
9
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10
|
+
}
|
|
11
|
+
function parseJson(text) {
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(text?.toString("utf8") ?? "");
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function checkScripts({ files, modes }, findings) {
|
|
20
|
+
for (const name of [...LIFECYCLE_SCRIPTS, ...REPLACE_SCRIPTS]) {
|
|
21
|
+
const path = `scripts/${name}`;
|
|
22
|
+
const body = files.get(path);
|
|
23
|
+
if (!body) {
|
|
24
|
+
if (name === "start-stop-status")
|
|
25
|
+
findings.add("SPK_SCRIPT_MISSING", `缺少 ${path};DSM 用它啟動、停止與查詢套件狀態。`, path);
|
|
26
|
+
else if (LIFECYCLE_SCRIPTS.includes(name))
|
|
27
|
+
findings.add("SPK_SCRIPT_HOOK_MISSING", `缺少 ${path};指南把它列為必備,沒有事要做時寫 #!/bin/sh 與 exit 0。`, path);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (!executable(modes.get(path)))
|
|
31
|
+
findings.add("SPK_SCRIPT_NOT_EXECUTABLE", `${path} 沒有執行權限(mode ${(modes.get(path) ?? 0).toString(8)});打包前 chmod 755。`, path);
|
|
32
|
+
const head = body.subarray(0, 4).toString("latin1");
|
|
33
|
+
if (!head.startsWith("#!") && head !== "\x7fELF")
|
|
34
|
+
findings.add("SPK_SCRIPT_NO_INTERPRETER", `${path} 開頭沒有 #!(例如 #!/bin/sh)。`, path);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function checkPrivilege(files, findings) {
|
|
38
|
+
const path = "conf/privilege";
|
|
39
|
+
if (!files.has(path)) {
|
|
40
|
+
findings.add("SPK_PRIVILEGE_MISSING", "缺少 conf/privilege;DSM 7 起每個套件都必須明確宣告執行身分。", path);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const privilege = parseJson(files.get(path));
|
|
44
|
+
const runAs = (value) => (isRecord(value) ? value["run-as"] : undefined);
|
|
45
|
+
const listed = isRecord(privilege)
|
|
46
|
+
? ["ctrl-script", "executable"].flatMap((key) => (Array.isArray(privilege[key]) ? privilege[key] : []).map(runAs))
|
|
47
|
+
: [];
|
|
48
|
+
const values = isRecord(privilege) ? [runAs(privilege.defaults), ...listed] : [];
|
|
49
|
+
if (!isRecord(privilege) || values.some((value) => typeof value !== "string" || !RUN_AS.includes(value))) {
|
|
50
|
+
findings.add("SPK_PRIVILEGE_INVALID", 'conf/privilege 必須是 JSON 物件,有 defaults.run-as,且每個 run-as 是 "package" 或 "root"。', path);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (values.includes("root"))
|
|
54
|
+
findings.add("SPK_PRIVILEGE_ROOT", "conf/privilege 要求以 root 執行;DSM 7 第三方套件應以 package 帳號執行。", path);
|
|
55
|
+
}
|
|
56
|
+
function checkConf({ files, modes }, findings) {
|
|
57
|
+
checkPrivilege(files, findings);
|
|
58
|
+
const resourcePath = "conf/resource";
|
|
59
|
+
if (files.has(resourcePath)) {
|
|
60
|
+
const resource = parseJson(files.get(resourcePath));
|
|
61
|
+
if (!isRecord(resource))
|
|
62
|
+
findings.add("SPK_RESOURCE_INVALID", "conf/resource 不是 JSON 物件。", resourcePath);
|
|
63
|
+
else
|
|
64
|
+
for (const id of Object.keys(resource).filter((key) => !WORKERS.has(key))) {
|
|
65
|
+
findings.add("SPK_RESOURCE_UNKNOWN", `conf/resource 的「${id}」不是指南列出的 resource worker。`, resourcePath);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const names = new Set([...modes.keys()].filter((path) => path.startsWith("conf/")).map((path) => path.split("/")[1]).filter(Boolean));
|
|
69
|
+
for (const name of [...names].filter((n) => !CONF.has(n)))
|
|
70
|
+
findings.add("SPK_CONF_UNKNOWN", `conf/${name} 不是 DSM 讀取的設定檔。`, `conf/${name}`);
|
|
71
|
+
}
|
|
72
|
+
function checkIcons(files, findings) {
|
|
73
|
+
for (const [name, size] of PACKAGE_ICONS) {
|
|
74
|
+
const png = files.get(name);
|
|
75
|
+
if (!png) {
|
|
76
|
+
findings.add("SPK_ICON_MISSING", `缺少 ${name}(${size}×${size} PNG)。`, name);
|
|
77
|
+
}
|
|
78
|
+
else if (png.length < 24 || !png.subarray(0, 8).equals(PNG_SIGNATURE) || png.toString("latin1", 12, 16) !== "IHDR") {
|
|
79
|
+
findings.add("SPK_ICON_INVALID", `${name} 不是 PNG。`, name);
|
|
80
|
+
}
|
|
81
|
+
else if (png.readUInt32BE(16) !== size || png.readUInt32BE(20) !== size) {
|
|
82
|
+
findings.add("SPK_ICON_SIZE", `${name} 是 ${png.readUInt32BE(16)}×${png.readUInt32BE(20)},指南要求 ${size}×${size}。`, name);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function checkWizards({ files, modes }, findings) {
|
|
87
|
+
for (const path of [...modes.keys()].filter((p) => p.startsWith("WIZARD_UIFILES/") && files.has(p))) {
|
|
88
|
+
const name = path.slice("WIZARD_UIFILES/".length);
|
|
89
|
+
if (!WIZARD_NAME.test(name)) {
|
|
90
|
+
findings.add("SPK_WIZARD_UNKNOWN", `${path} 不是 install/upgrade/uninstall_uifile[_<lang>][.sh];DSM 不會讀它。`, path);
|
|
91
|
+
}
|
|
92
|
+
else if (name.endsWith(".sh")) {
|
|
93
|
+
if (!executable(modes.get(path)))
|
|
94
|
+
findings.add("SPK_WIZARD_SCRIPT_NOT_EXECUTABLE", `${path} 沒有執行權限;DSM 執行它來產生精靈。`, path);
|
|
95
|
+
}
|
|
96
|
+
else if (!Array.isArray(parseJson(files.get(path)))) {
|
|
97
|
+
findings.add("SPK_WIZARD_INVALID", `${path} 不是 JSON 陣列(每個元素是一個精靈步驟)。`, path);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export function checkMetadata(outer, findings) {
|
|
102
|
+
checkScripts(outer, findings);
|
|
103
|
+
checkConf(outer, findings);
|
|
104
|
+
checkIcons(outer.files, findings);
|
|
105
|
+
checkWizards(outer, findings);
|
|
106
|
+
const license = outer.files.get("LICENSE");
|
|
107
|
+
if (license && license.length >= MAX_LICENSE_BYTES)
|
|
108
|
+
findings.add("SPK_LICENSE_TOO_LARGE", `LICENSE 有 ${license.length} bytes;指南要求小於 1 MB。`, "LICENSE");
|
|
109
|
+
const signature = outer.files.get("syno_signature.asc");
|
|
110
|
+
if (signature && !signature.toString("latin1").includes("-----BEGIN PGP SIGNATURE-----")) {
|
|
111
|
+
findings.add("SPK_SIGNATURE_INVALID", "syno_signature.asc 不是 ASCII-armored PGP 簽章。", "syno_signature.asc");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { openSync, readSync, closeSync } from "node:fs";
|
|
2
|
+
import { posix } from "node:path";
|
|
3
|
+
import * as tar from "tar";
|
|
4
|
+
import { ARCH_ELF_MACHINE } from "./dsm-spec.js";
|
|
5
|
+
const XZ_MAGIC = Buffer.from([0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00]);
|
|
6
|
+
const ELF_MAGIC = Buffer.from("\x7fELF", "latin1");
|
|
7
|
+
const MAX_TEXT = 1024 * 1024;
|
|
8
|
+
const HEAD_BYTES = 20;
|
|
9
|
+
/** `section:key`: a DSM string reference rather than literal text. */
|
|
10
|
+
const STRING_REF = /^([A-Za-z0-9_]+):([A-Za-z0-9_]+)$/;
|
|
11
|
+
const at = (path) => `package.tgz:${path}`;
|
|
12
|
+
function startsWith(file, magic) {
|
|
13
|
+
const fd = openSync(file, "r");
|
|
14
|
+
try {
|
|
15
|
+
const head = Buffer.alloc(magic.length);
|
|
16
|
+
return readSync(fd, head, 0, magic.length, 0) === magic.length && head.equals(magic);
|
|
17
|
+
}
|
|
18
|
+
finally {
|
|
19
|
+
closeSync(fd);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** `dsmuidir` is one path, or since DSM 7.0-40731 several `name:path` pairs. */
|
|
23
|
+
function uiDirs(dsmuidir) {
|
|
24
|
+
return (dsmuidir ?? "").split(/\s+/).filter(Boolean).map((item) => posix.normalize(item.slice(item.indexOf(":") + 1)).replace(/\/$/, ""));
|
|
25
|
+
}
|
|
26
|
+
/** Lists package.tgz without extracting it, keeping only file heads and the few texts the rules read. */
|
|
27
|
+
async function scanPayload(payloadPath, wanted, findings) {
|
|
28
|
+
const files = [];
|
|
29
|
+
let entries = 0;
|
|
30
|
+
try {
|
|
31
|
+
await tar.t({
|
|
32
|
+
file: payloadPath,
|
|
33
|
+
strict: true,
|
|
34
|
+
onReadEntry: (entry) => {
|
|
35
|
+
entries++;
|
|
36
|
+
const path = entry.path.replace(/^\.\//, "");
|
|
37
|
+
checkEntryPath(path, entry.type, entry.linkpath, findings);
|
|
38
|
+
if (entry.type !== "File")
|
|
39
|
+
return;
|
|
40
|
+
const file = { path, head: Buffer.alloc(0) };
|
|
41
|
+
const keep = wanted(path) && (entry.size ?? 0) <= MAX_TEXT;
|
|
42
|
+
const chunks = [];
|
|
43
|
+
entry.on("data", (chunk) => {
|
|
44
|
+
if (file.head.length < HEAD_BYTES)
|
|
45
|
+
file.head = Buffer.concat([file.head, chunk]).subarray(0, HEAD_BYTES);
|
|
46
|
+
if (keep)
|
|
47
|
+
chunks.push(chunk);
|
|
48
|
+
});
|
|
49
|
+
entry.on("end", () => { if (keep)
|
|
50
|
+
file.text = Buffer.concat(chunks).toString("utf8"); });
|
|
51
|
+
files.push(file);
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
entries = 0;
|
|
57
|
+
}
|
|
58
|
+
if (entries === 0) {
|
|
59
|
+
findings.add("SPK_PAYLOAD_UNREADABLE", "package.tgz 不是可讀的 tar、tar.gz 封存,或是空的。", "package.tgz");
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
return files;
|
|
63
|
+
}
|
|
64
|
+
function checkEntryPath(path, type, linkpath, findings) {
|
|
65
|
+
if (path.startsWith("/") || posix.normalize(path).split("/")[0] === "..") {
|
|
66
|
+
findings.add("SPK_PAYLOAD_PATH_UNSAFE", `${path} 會解開到套件目錄之外。`, at(path));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (type === "SymbolicLink" && linkpath) {
|
|
70
|
+
if (linkpath.startsWith("/")) {
|
|
71
|
+
findings.add("SPK_PAYLOAD_LINK_ABSOLUTE", `${path} 是指向 ${linkpath} 的絕對路徑 symlink;目標由 NAS 決定,不在套件內。`, at(path));
|
|
72
|
+
}
|
|
73
|
+
else if (posix.normalize(posix.join(posix.dirname(path), linkpath)).split("/")[0] === "..") {
|
|
74
|
+
findings.add("SPK_PAYLOAD_LINK_ESCAPE", `${path} 的 symlink 目標 ${linkpath} 跳出套件目錄。`, at(path));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (type === "Link" && linkpath && (linkpath.startsWith("/") || posix.normalize(linkpath).split("/")[0] === "..")) {
|
|
78
|
+
findings.add("SPK_PAYLOAD_LINK_ESCAPE", `${path} 的 hard link 目標 ${linkpath} 不在套件內。`, at(path));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** Sections the package defines itself in its `texts/<lang>/strings` files. */
|
|
82
|
+
function ownSections(files) {
|
|
83
|
+
const sections = new Set();
|
|
84
|
+
for (const file of files) {
|
|
85
|
+
if (!/(^|\/)texts\/[^/]+\/strings$/.test(file.path) || file.text === undefined)
|
|
86
|
+
continue;
|
|
87
|
+
for (const match of file.text.matchAll(/^\s*\[([^\]]+)\]\s*$/gm))
|
|
88
|
+
sections.add(match[1]);
|
|
89
|
+
}
|
|
90
|
+
return sections;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* DSM resolves a `section:key` title only from the strings of an entry that
|
|
94
|
+
* declares `texts`; without it the menu shows the raw key. DSM's own
|
|
95
|
+
* sections need no `texts`, so only the package's own sections are errors.
|
|
96
|
+
*/
|
|
97
|
+
function checkUiConfig(file, sections, findings) {
|
|
98
|
+
let config;
|
|
99
|
+
try {
|
|
100
|
+
config = JSON.parse(file.text ?? "");
|
|
101
|
+
}
|
|
102
|
+
catch { /* reported below */ }
|
|
103
|
+
if (typeof config !== "object" || config === null || Array.isArray(config)) {
|
|
104
|
+
findings.add("SPK_UI_CONFIG_INVALID", `${file.path} 不是 JSON 物件。`, at(file.path));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
for (const group of Object.values(config)) {
|
|
108
|
+
if (typeof group !== "object" || group === null)
|
|
109
|
+
continue;
|
|
110
|
+
for (const [id, entry] of Object.entries(group)) {
|
|
111
|
+
if (typeof entry !== "object" || entry === null || "texts" in entry)
|
|
112
|
+
continue;
|
|
113
|
+
for (const field of ["title", "desc"]) {
|
|
114
|
+
const value = entry[field];
|
|
115
|
+
const ref = typeof value === "string" ? STRING_REF.exec(value) : null;
|
|
116
|
+
if (!ref)
|
|
117
|
+
continue;
|
|
118
|
+
const own = ref[1] === "synopkgland" || sections.has(ref[1]);
|
|
119
|
+
findings.add(own ? "SPK_UI_TEXTS_MISSING" : "SPK_UI_TEXTS_UNDECLARED", `${file.path} 的 ${id}.${field}「${value}」是字串參照,但這個 entry 沒有宣告 "texts";${own ? "DSM 會直接顯示這個 key" : "除非是 DSM 內建的 section,否則 DSM 會直接顯示這個 key"}。`, at(file.path));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/** ELF files must run on the platforms INFO arch names; a noarch package carries none. */
|
|
125
|
+
function checkElf(files, arch, findings) {
|
|
126
|
+
const tokens = (arch ?? "").split(/\s+/).filter(Boolean);
|
|
127
|
+
const noarch = tokens.length === 1 && tokens[0] === "noarch";
|
|
128
|
+
const machines = new Set(tokens.map((token) => ARCH_ELF_MACHINE.get(token)));
|
|
129
|
+
const checkable = !noarch && tokens.length > 0 && tokens.every((token) => ARCH_ELF_MACHINE.get(token) !== undefined);
|
|
130
|
+
for (const file of files) {
|
|
131
|
+
if (file.head.length < HEAD_BYTES || !file.head.subarray(0, 4).equals(ELF_MAGIC))
|
|
132
|
+
continue;
|
|
133
|
+
const machine = file.head[5] === 2 ? file.head.readUInt16BE(18) : file.head.readUInt16LE(18);
|
|
134
|
+
if (noarch) {
|
|
135
|
+
findings.add("SPK_NOARCH_ELF", `${file.path} 是 ELF 執行檔,但 INFO arch 是 noarch;noarch 套件只能有腳本,否則在其他 CPU 的 NAS 上無法執行。`, at(file.path));
|
|
136
|
+
}
|
|
137
|
+
else if (checkable && !machines.has(machine)) {
|
|
138
|
+
findings.add("SPK_ELF_ARCH_MISMATCH", `${file.path} 的 ELF machine 是 ${machine},與 INFO arch「${arch}」的 CPU 不符。`, at(file.path));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export async function checkPayload(payloadPath, info, findings) {
|
|
143
|
+
if (startsWith(payloadPath, XZ_MAGIC)) {
|
|
144
|
+
findings.add("SPK_PAYLOAD_XZ", "package.tgz 是 xz 壓縮(Synology toolkit 的格式);inspect 讀不了 xz,沒有檢查 payload 內容。", "package.tgz");
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const dirs = uiDirs(info.dsmuidir);
|
|
148
|
+
const configs = new Set(dirs.map((dir) => posix.join(dir, "config")));
|
|
149
|
+
const files = await scanPayload(payloadPath, (path) => configs.has(path) || (/\/texts\/[^/]+\/strings$/.test(path) && dirs.some((dir) => path.startsWith(`${dir}/`))), findings);
|
|
150
|
+
if (!files)
|
|
151
|
+
return;
|
|
152
|
+
const sections = ownSections(files);
|
|
153
|
+
for (const file of files.filter((f) => configs.has(f.path)))
|
|
154
|
+
checkUiConfig(file, sections, findings);
|
|
155
|
+
checkElf(files, info.arch, findings);
|
|
156
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The parts of the Synology DSM 7 Developer Guide that `inspect` checks
|
|
3
|
+
* against, transcribed from the guide's INFO, Package Structure and
|
|
4
|
+
* Appendix A pages.
|
|
5
|
+
*/
|
|
6
|
+
/** INFO Necessary Fields. */
|
|
7
|
+
export declare const REQUIRED_INFO_FIELDS: readonly ["package", "version", "os_min_ver", "description", "arch", "maintainer"];
|
|
8
|
+
/** INFO Optional Fields, without the `displayname_<lang>` and `description_<lang>` families. */
|
|
9
|
+
export declare const OPTIONAL_INFO_FIELDS: readonly ["displayname", "maintainer_url", "distributor", "distributor_url", "support_url", "support_center", "model", "exclude_arch", "checksum", "adminport", "adminurl", "adminprotocol", "dsmuidir", "dsmappname", "dsmapppage", "dsmapplaunchname", "checkport", "startable", "ctl_stop", "ctl_uninstall", "precheckstartstop", "helpurl", "beta", "report_url", "install_reboot", "install_dep_packages", "install_conflict_packages", "install_break_packages", "install_replace_packages", "install_dep_services", "start_dep_services", "extractsize", "support_conf_folder", "install_type", "silent_install", "silent_upgrade", "silent_uninstall", "auto_upgrade_from", "offline_install", "thirdparty", "os_max_ver", "support_move", "exclude_model", "use_deprecated_replace_mechanism", "install_on_cold_storage"];
|
|
10
|
+
/**
|
|
11
|
+
* Fields outside the guide's list that are still expected: `changelog` is
|
|
12
|
+
* shown by Package Center and used by first-party packages; the others are
|
|
13
|
+
* written by this SDK and ignored by DSM.
|
|
14
|
+
*/
|
|
15
|
+
export declare const EXTRA_INFO_FIELDS: readonly ["changelog", "synopkgland_executor_sha256", "spk_land_metadata"];
|
|
16
|
+
/** Optional fields whose value is "yes" or "no". */
|
|
17
|
+
export declare const BOOLEAN_INFO_FIELDS: readonly ["support_center", "checkport", "startable", "ctl_stop", "ctl_uninstall", "precheckstartstop", "beta", "install_reboot", "support_conf_folder", "silent_install", "silent_upgrade", "silent_uninstall", "offline_install", "thirdparty", "support_move", "use_deprecated_replace_mechanism", "install_on_cold_storage"];
|
|
18
|
+
/** Language codes of `displayname_<lang>` and `description_<lang>`. */
|
|
19
|
+
export declare const INFO_LANGUAGES: readonly ["enu", "cht", "chs", "krn", "ger", "fre", "ita", "spn", "jpn", "dan", "nor", "sve", "nld", "rus", "plk", "ptb", "ptg", "hun", "trk", "csy"];
|
|
20
|
+
/** After DSM 7.0, os_min_ver "should be at least 7.0-40000". */
|
|
21
|
+
export declare const DSM7_MIN_VER = "7.0-40000";
|
|
22
|
+
export declare const ARCH_ELF_MACHINE: ReadonlyMap<string, number | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Top-level SPK entries of the Package Structure page, plus metadata this SDK
|
|
25
|
+
* adds; container SPKs also carry a top-level copy of conf/privilege.
|
|
26
|
+
*/
|
|
27
|
+
export declare const KNOWN_TOP_LEVEL: readonly ["INFO", "package.tgz", "scripts", "conf", "WIZARD_UIFILES", "LICENSE", "PACKAGE_ICON.PNG", "PACKAGE_ICON_256.PNG", "syno_signature.asc", "sdk-package.json", "native-layout.json", "privilege"];
|
|
28
|
+
/** scripts/ of the Package Structure page; DSM needs start-stop-status to start, stop and poll a package. */
|
|
29
|
+
export declare const LIFECYCLE_SCRIPTS: readonly ["preinst", "postinst", "preuninst", "postuninst", "preupgrade", "postupgrade", "start-stop-status"];
|
|
30
|
+
/** Optional scripts, run only with install_replace_packages. */
|
|
31
|
+
export declare const REPLACE_SCRIPTS: readonly ["prereplace", "postreplace"];
|
|
32
|
+
/** conf/ entries: the conf page's files, and the systemd unit folder of the systemd-user-unit worker. */
|
|
33
|
+
export declare const CONF_ENTRIES: readonly ["privilege", "resource", "PKG_DEPS", "PKG_CONX", "systemd"];
|
|
34
|
+
/**
|
|
35
|
+
* Resource ids of the guide's Available Workers pages; `systemd-unit` is not
|
|
36
|
+
* documented there but is used by packages that install on DSM 7.
|
|
37
|
+
*/
|
|
38
|
+
export declare const RESOURCE_WORKERS: readonly ["port-config", "usr-local-linker", "data-share", "systemd-user-unit", "systemd-unit", "web-config", "webservice", "docker-project", "docker", "apache22", "indexdb", "mariadb10", "php", "syslog-config", "sysnotify"];
|
|
39
|
+
/** PACKAGE_ICON.PNG is 64×64 on DSM 7; PACKAGE_ICON_256.PNG is 256×256. */
|
|
40
|
+
export declare const PACKAGE_ICONS: readonly [readonly ["PACKAGE_ICON.PNG", 64], readonly ["PACKAGE_ICON_256.PNG", 256]];
|
|
41
|
+
/** LICENSE "must be less than 1 MB". */
|
|
42
|
+
export declare const MAX_LICENSE_BYTES: number;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import DSM_PLATFORMS from "../build-spk/dsm-platforms.json" with { type: "json" };
|
|
2
|
+
/**
|
|
3
|
+
* The parts of the Synology DSM 7 Developer Guide that `inspect` checks
|
|
4
|
+
* against, transcribed from the guide's INFO, Package Structure and
|
|
5
|
+
* Appendix A pages.
|
|
6
|
+
*/
|
|
7
|
+
/** INFO Necessary Fields. */
|
|
8
|
+
export const REQUIRED_INFO_FIELDS = ["package", "version", "os_min_ver", "description", "arch", "maintainer"];
|
|
9
|
+
/** INFO Optional Fields, without the `displayname_<lang>` and `description_<lang>` families. */
|
|
10
|
+
export const OPTIONAL_INFO_FIELDS = [
|
|
11
|
+
"displayname", "maintainer_url", "distributor", "distributor_url", "support_url", "support_center", "model",
|
|
12
|
+
"exclude_arch", "checksum", "adminport", "adminurl", "adminprotocol", "dsmuidir", "dsmappname", "dsmapppage",
|
|
13
|
+
"dsmapplaunchname", "checkport", "startable", "ctl_stop", "ctl_uninstall", "precheckstartstop", "helpurl", "beta",
|
|
14
|
+
"report_url", "install_reboot", "install_dep_packages", "install_conflict_packages", "install_break_packages",
|
|
15
|
+
"install_replace_packages", "install_dep_services", "start_dep_services", "extractsize", "support_conf_folder",
|
|
16
|
+
"install_type", "silent_install", "silent_upgrade", "silent_uninstall", "auto_upgrade_from", "offline_install",
|
|
17
|
+
"thirdparty", "os_max_ver", "support_move", "exclude_model", "use_deprecated_replace_mechanism",
|
|
18
|
+
"install_on_cold_storage",
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* Fields outside the guide's list that are still expected: `changelog` is
|
|
22
|
+
* shown by Package Center and used by first-party packages; the others are
|
|
23
|
+
* written by this SDK and ignored by DSM.
|
|
24
|
+
*/
|
|
25
|
+
export const EXTRA_INFO_FIELDS = ["changelog", "synopkgland_executor_sha256", "spk_land_metadata"];
|
|
26
|
+
/** Optional fields whose value is "yes" or "no". */
|
|
27
|
+
export const BOOLEAN_INFO_FIELDS = [
|
|
28
|
+
"support_center", "checkport", "startable", "ctl_stop", "ctl_uninstall", "precheckstartstop", "beta",
|
|
29
|
+
"install_reboot", "support_conf_folder", "silent_install", "silent_upgrade", "silent_uninstall", "offline_install",
|
|
30
|
+
"thirdparty", "support_move", "use_deprecated_replace_mechanism", "install_on_cold_storage",
|
|
31
|
+
];
|
|
32
|
+
/** Language codes of `displayname_<lang>` and `description_<lang>`. */
|
|
33
|
+
export const INFO_LANGUAGES = [
|
|
34
|
+
"enu", "cht", "chs", "krn", "ger", "fre", "ita", "spn", "jpn", "dan", "nor", "sve", "nld", "rus", "plk", "ptb",
|
|
35
|
+
"ptg", "hun", "trk", "csy",
|
|
36
|
+
];
|
|
37
|
+
/** After DSM 7.0, os_min_ver "should be at least 7.0-40000". */
|
|
38
|
+
export const DSM7_MIN_VER = "7.0-40000";
|
|
39
|
+
/**
|
|
40
|
+
* Appendix A arch families and platforms, with the ELF e_machine their
|
|
41
|
+
* binaries use, plus DSM 7 platforms newer than the appendix (from
|
|
42
|
+
* dsm-platforms.json, shared with package-source).
|
|
43
|
+
*/
|
|
44
|
+
const EM_386 = 3, EM_ARM = 40, EM_X86_64 = 62, EM_AARCH64 = 183;
|
|
45
|
+
const APPENDIX_ARCHES = {
|
|
46
|
+
noarch: undefined, x86_64: EM_X86_64, i686: EM_386, armv7: EM_ARM, armv5: EM_ARM, armv8: EM_AARCH64,
|
|
47
|
+
evansport: EM_386, "628x": EM_ARM,
|
|
48
|
+
alpine: EM_ARM, alpine4k: EM_ARM, armada370: EM_ARM, armada375: EM_ARM, armada38x: EM_ARM, armadaxp: EM_ARM,
|
|
49
|
+
comcerto2k: EM_ARM, monaco: EM_ARM,
|
|
50
|
+
armada37xx: EM_AARCH64, rtd1296: EM_AARCH64, rtd1619: EM_AARCH64, rtd1619b: EM_AARCH64,
|
|
51
|
+
apollolake: EM_X86_64, avoton: EM_X86_64, braswell: EM_X86_64, broadwell: EM_X86_64, broadwellnk: EM_X86_64,
|
|
52
|
+
broadwellntb: EM_X86_64, broadwellntbap: EM_X86_64, bromolow: EM_X86_64, cedarview: EM_X86_64,
|
|
53
|
+
coffeelake: EM_X86_64, denverton: EM_X86_64, geminilake: EM_X86_64, grantley: EM_X86_64, kvmx64: EM_X86_64,
|
|
54
|
+
purley: EM_X86_64, skylaked: EM_X86_64, v1000: EM_X86_64,
|
|
55
|
+
};
|
|
56
|
+
const FAMILY_MACHINE = { x86_64: EM_X86_64, aarch64: EM_AARCH64, armv7: EM_ARM };
|
|
57
|
+
export const ARCH_ELF_MACHINE = new Map([
|
|
58
|
+
...Object.entries(APPENDIX_ARCHES),
|
|
59
|
+
...Object.entries(DSM_PLATFORMS).flatMap(([family, { members, platformOnly }]) => [...members, ...platformOnly].map((platform) => [platform, FAMILY_MACHINE[family]])),
|
|
60
|
+
]);
|
|
61
|
+
/**
|
|
62
|
+
* Top-level SPK entries of the Package Structure page, plus metadata this SDK
|
|
63
|
+
* adds; container SPKs also carry a top-level copy of conf/privilege.
|
|
64
|
+
*/
|
|
65
|
+
export const KNOWN_TOP_LEVEL = [
|
|
66
|
+
"INFO", "package.tgz", "scripts", "conf", "WIZARD_UIFILES", "LICENSE", "PACKAGE_ICON.PNG", "PACKAGE_ICON_256.PNG",
|
|
67
|
+
"syno_signature.asc", "sdk-package.json", "native-layout.json", "privilege",
|
|
68
|
+
];
|
|
69
|
+
/** scripts/ of the Package Structure page; DSM needs start-stop-status to start, stop and poll a package. */
|
|
70
|
+
export const LIFECYCLE_SCRIPTS = ["preinst", "postinst", "preuninst", "postuninst", "preupgrade", "postupgrade", "start-stop-status"];
|
|
71
|
+
/** Optional scripts, run only with install_replace_packages. */
|
|
72
|
+
export const REPLACE_SCRIPTS = ["prereplace", "postreplace"];
|
|
73
|
+
/** conf/ entries: the conf page's files, and the systemd unit folder of the systemd-user-unit worker. */
|
|
74
|
+
export const CONF_ENTRIES = ["privilege", "resource", "PKG_DEPS", "PKG_CONX", "systemd"];
|
|
75
|
+
/**
|
|
76
|
+
* Resource ids of the guide's Available Workers pages; `systemd-unit` is not
|
|
77
|
+
* documented there but is used by packages that install on DSM 7.
|
|
78
|
+
*/
|
|
79
|
+
export const RESOURCE_WORKERS = [
|
|
80
|
+
"port-config", "usr-local-linker", "data-share", "systemd-user-unit", "systemd-unit", "web-config", "webservice",
|
|
81
|
+
"docker-project", "docker", "apache22", "indexdb", "mariadb10", "php", "syslog-config", "sysnotify",
|
|
82
|
+
];
|
|
83
|
+
/** PACKAGE_ICON.PNG is 64×64 on DSM 7; PACKAGE_ICON_256.PNG is 256×256. */
|
|
84
|
+
export const PACKAGE_ICONS = [["PACKAGE_ICON.PNG", 64], ["PACKAGE_ICON_256.PNG", 256]];
|
|
85
|
+
/** LICENSE "must be less than 1 MB". */
|
|
86
|
+
export const MAX_LICENSE_BYTES = 1024 * 1024;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SpkRuleCode, type SpkRuleSeverity } from "./rules.js";
|
|
2
|
+
export interface SpkFinding {
|
|
3
|
+
code: SpkRuleCode;
|
|
4
|
+
severity: SpkRuleSeverity;
|
|
5
|
+
/** The SPK entry the finding is about, when there is one. */
|
|
6
|
+
path?: string;
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
/** Collects findings; each code's severity comes from its rule. */
|
|
10
|
+
export declare class Findings {
|
|
11
|
+
readonly list: SpkFinding[];
|
|
12
|
+
add(code: SpkRuleCode, message: string, path?: string): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SPK_RULES } from "./rules.js";
|
|
2
|
+
/** Collects findings; each code's severity comes from its rule. */
|
|
3
|
+
export class Findings {
|
|
4
|
+
list = [];
|
|
5
|
+
add(code, message, path) {
|
|
6
|
+
this.list.push({ code, severity: SPK_RULES[code].severity, ...(path ? { path } : {}), message });
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SpkInspection } from "../standalone/inspect-spk.js";
|
|
2
|
+
import { type SpkFinding } from "./validate-spk.js";
|
|
3
|
+
export interface SpkReport extends SpkInspection {
|
|
4
|
+
/** Built by synopkgland, so its build contract (`findings`) was checked too. */
|
|
5
|
+
synopkgland: boolean;
|
|
6
|
+
/** The DSM 7 package format rules, checked on every SPK. */
|
|
7
|
+
dsm: {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
errors: SpkFinding[];
|
|
10
|
+
warnings: SpkFinding[];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Checks any SPK against the DSM 7 package format. An SPK that carries a
|
|
15
|
+
* synopkgland build marker is also checked against the build contract;
|
|
16
|
+
* others are never held to it.
|
|
17
|
+
*/
|
|
18
|
+
export declare function inspectAnySpk(spkPath: string): Promise<SpkReport>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createWriteStream, mkdtempSync, rmSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { finished } from "node:stream/promises";
|
|
5
|
+
import * as tar from "tar";
|
|
6
|
+
import { inspectSpk, listPayload } from "../standalone/inspect-spk.js";
|
|
7
|
+
import { validateSpk } from "./validate-spk.js";
|
|
8
|
+
/** Top-level files the native-go/binary and native layout builds write; no DSM file has these names. */
|
|
9
|
+
const BUILD_MARKERS = ["sdk-package.json", "native-layout.json"];
|
|
10
|
+
/** A container build ships its manifest in the payload. */
|
|
11
|
+
const CONTAINER_MARKER = "synology-app.yaml";
|
|
12
|
+
/**
|
|
13
|
+
* Checks any SPK against the DSM 7 package format. An SPK that carries a
|
|
14
|
+
* synopkgland build marker is also checked against the build contract;
|
|
15
|
+
* others are never held to it.
|
|
16
|
+
*/
|
|
17
|
+
export async function inspectAnySpk(spkPath) {
|
|
18
|
+
const validation = await validateSpk(spkPath);
|
|
19
|
+
const dsm = { ok: validation.ok, errors: validation.errors, warnings: validation.warnings };
|
|
20
|
+
const facts = await readFacts(spkPath);
|
|
21
|
+
if (BUILD_MARKERS.some((name) => facts.top.has(name)) || facts.payload.some((entry) => entry.path === CONTAINER_MARKER)) {
|
|
22
|
+
return { ...(await inspectSpk(spkPath)), synopkgland: true, dsm };
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
...(validation.package ? { package: validation.package } : {}),
|
|
26
|
+
...(validation.version ? { version: validation.version } : {}),
|
|
27
|
+
...(validation.arch ? { arch: validation.arch } : {}),
|
|
28
|
+
signed: facts.top.has("syno_signature.asc"),
|
|
29
|
+
payload: facts.payload,
|
|
30
|
+
findings: [],
|
|
31
|
+
capabilities: [],
|
|
32
|
+
synopkgland: false,
|
|
33
|
+
dsm,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** Top-level names and the payload listing; an unreadable archive yields none, which the DSM rules already report. */
|
|
37
|
+
async function readFacts(spkPath) {
|
|
38
|
+
const facts = { top: new Set(), payload: [] };
|
|
39
|
+
const dir = mkdtempSync(join(tmpdir(), "syno-inspect-facts-"));
|
|
40
|
+
try {
|
|
41
|
+
const writes = [];
|
|
42
|
+
await tar.t({
|
|
43
|
+
file: spkPath,
|
|
44
|
+
onReadEntry: (entry) => {
|
|
45
|
+
const path = entry.path.replace(/^\.\//, "");
|
|
46
|
+
facts.top.add(path.split("/")[0]);
|
|
47
|
+
if (path === "package.tgz" && entry.type === "File")
|
|
48
|
+
writes.push(finished(entry.pipe(createWriteStream(join(dir, "package.tgz")))));
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
await Promise.all(writes);
|
|
52
|
+
if (writes.length)
|
|
53
|
+
facts.payload = await listPayload(join(dir, "package.tgz"), []);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Not a readable tar or tar.gz.
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
rmSync(dir, { recursive: true, force: true });
|
|
60
|
+
}
|
|
61
|
+
return facts;
|
|
62
|
+
}
|