@synopackageland/cli 0.4.1 → 0.5.3
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/README.md +7 -3
- package/dist/authorization-sdk.d.ts +5 -0
- package/dist/authorization-sdk.js +5 -0
- package/dist/build-spk/delete-app-data.d.ts +27 -7
- package/dist/build-spk/delete-app-data.js +35 -34
- package/dist/build-spk/dsm-arch.d.ts +6 -1
- package/dist/build-spk/dsm-arch.js +25 -1
- package/dist/build-spk/dsm-version.d.ts +14 -0
- package/dist/build-spk/dsm-version.js +47 -0
- package/dist/build-spk/gateway.d.ts +31 -0
- package/dist/build-spk/gateway.js +55 -0
- package/dist/build-spk/generator.d.ts +5 -0
- package/dist/build-spk/generator.js +103 -107
- package/dist/build-spk/install-wizard.d.ts +20 -0
- package/dist/build-spk/install-wizard.js +76 -0
- package/dist/build-spk/native-lifecycle.d.ts +5 -0
- package/dist/build-spk/native-lifecycle.js +12 -2
- package/dist/build-spk/resource-worker.d.ts +9 -4
- package/dist/build-spk/resource-worker.js +15 -6
- package/dist/build-spk/share-combobox.d.ts +3 -0
- package/dist/build-spk/share-combobox.js +27 -0
- package/dist/build-spk/uninstall-wizard.d.ts +14 -0
- package/dist/build-spk/uninstall-wizard.js +33 -0
- package/dist/build-spk/wizard-i18n.d.ts +18 -0
- package/dist/build-spk/wizard-i18n.js +38 -0
- package/dist/build-spk/wizard-messages.d.ts +388 -0
- package/dist/build-spk/wizard-messages.js +387 -0
- package/dist/cli.js +132 -32
- package/dist/compose/analyze.d.ts +20 -0
- package/dist/compose/analyze.js +75 -11
- package/dist/contract/validate.js +33 -1
- package/dist/contract/web-launch.d.ts +22 -0
- package/dist/contract/web-launch.js +37 -0
- package/dist/deploy/deploy.d.ts +3 -0
- package/dist/deploy/deploy.js +11 -2
- package/dist/error-registry.js +62 -3
- package/dist/host/dsm-port-profile.d.ts +1 -1
- package/dist/host/dsm-port-profile.js +1 -1
- package/dist/host/open-url.d.ts +2 -0
- package/dist/host/open-url.js +4 -1
- package/dist/images/pin.d.ts +52 -0
- package/dist/images/pin.js +249 -0
- package/dist/init.d.ts +27 -3
- package/dist/init.js +126 -16
- package/dist/inspect.d.ts +3 -0
- package/dist/inspect.js +15 -3
- package/dist/standalone/authorization-window.d.ts +2 -0
- package/dist/standalone/authorization-window.js +28 -0
- package/dist/standalone/authorization.d.ts +48 -0
- package/dist/standalone/authorization.js +116 -0
- package/dist/standalone/background.d.ts +21 -0
- package/dist/standalone/background.js +52 -0
- package/dist/standalone/binary.d.ts +1 -0
- package/dist/standalone/binary.js +1 -1
- package/dist/standalone/build.d.ts +2 -0
- package/dist/standalone/build.js +54 -10
- package/dist/standalone/dsm-window.js +10 -3
- package/dist/standalone/helper-inventory.d.ts +15 -0
- package/dist/standalone/helper-inventory.js +9 -0
- package/dist/standalone/helper.d.ts +1 -0
- package/dist/standalone/helper.js +29 -11
- package/dist/standalone/host-adapter.d.ts +1 -1
- package/dist/standalone/host-adapter.js +33 -15
- package/dist/standalone/host-file-navigation.d.ts +7 -0
- package/dist/standalone/host-file-navigation.js +172 -0
- package/dist/standalone/inspect-helper.js +21 -6
- package/dist/standalone/inspect-spk.d.ts +1 -1
- package/dist/standalone/inspect-spk.js +211 -7
- package/dist/standalone/job-diagnostics.d.ts +1 -0
- package/dist/standalone/job-diagnostics.js +49 -0
- package/dist/standalone/lifecycle-helper.d.ts +1 -1
- package/dist/standalone/lifecycle-helper.js +2 -2
- package/dist/standalone/lifecycle.d.ts +1 -1
- package/dist/standalone/lifecycle.js +14 -4
- package/dist/standalone/manifest.d.ts +15 -2
- package/dist/standalone/manifest.js +37 -6
- package/dist/standalone/native-layout.d.ts +74 -0
- package/dist/standalone/native-layout.js +318 -0
- package/dist/standalone/resource.d.ts +11 -0
- package/dist/standalone/resource.js +13 -0
- package/dist/standalone/root-ops.d.ts +2 -0
- package/dist/standalone/root-ops.js +10 -0
- package/dist/standalone/root-window.d.ts +3 -1
- package/dist/standalone/root-window.js +156 -38
- package/dist/standalone/shared-folder.d.ts +39 -0
- package/dist/standalone/shared-folder.js +141 -0
- package/dist/standalone/spk.d.ts +4 -0
- package/dist/standalone/spk.js +47 -3
- package/dist/standalone/worker-contract-json.d.ts +8 -0
- package/dist/standalone/worker-contract-json.js +141 -0
- package/dist/standalone/worker-contract.d.ts +189 -0
- package/dist/standalone/worker-contract.js +175 -0
- package/dist/standalone/worker-registry.d.ts +40 -0
- package/dist/standalone/worker-registry.js +167 -0
- package/dist/templates/_authorization/main.go +104 -0
- package/dist/templates/_authorization/main_test.go +35 -0
- package/dist/templates/_daemon/go.mod +2 -0
- package/dist/templates/_gateway/auth.go +101 -0
- package/dist/templates/_gateway/auth_test.go +216 -0
- package/dist/templates/_gateway/cgi.go +133 -0
- package/dist/templates/_gateway/cgi_test.go +156 -0
- package/dist/templates/_gateway/csrf.go +73 -0
- package/dist/templates/_gateway/csrf_test.go +155 -0
- package/dist/templates/_gateway/directory.go +108 -0
- package/dist/templates/_gateway/directory_test.go +202 -0
- package/dist/templates/_gateway/gateway.go +412 -0
- package/dist/templates/_gateway/gateway_test.go +676 -0
- package/dist/templates/_gateway/go.mod +3 -0
- package/dist/templates/_gateway/groups.go +66 -0
- package/dist/templates/_gateway/main.go +45 -0
- package/dist/templates/binary/synology-app.yaml +1 -1
- package/dist/templates/compose-import/compose.yaml +1 -1
- package/dist/templates/compose-import/synology-app.yaml +1 -1
- package/dist/templates/hello-files/compose.yaml +1 -1
- package/dist/templates/hello-files/synology-app.yaml +1 -1
- package/dist/templates/native-go/README.md +118 -5
- package/dist/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +3 -1
- package/dist/templates/native-go/backend/cmd/app/main.go +25 -6
- package/dist/templates/native-go/backend/cmd/app/sdk_main.go +62 -0
- package/dist/templates/native-go/backend/cmd/background-worker/main.go +38 -0
- package/dist/templates/native-go/backend/cmd/helper/main.go +27 -1
- package/dist/templates/native-go/backend/cmd/helper/sdk_registry.go +19 -0
- package/dist/templates/native-go/backend/go.mod +5 -3
- package/dist/templates/native-go/backend/go.sum +4 -4
- package/dist/templates/native-go/backend/internal/api/registry.go +17 -6
- package/dist/templates/native-go/backend/internal/api/server.go +7 -1
- package/dist/templates/native-go/backend/internal/app/authorization_none.go +5 -0
- package/dist/templates/native-go/backend/internal/app/background.go +270 -0
- package/dist/templates/native-go/backend/internal/app/background_none.go +8 -0
- package/dist/templates/native-go/backend/internal/app/background_owner.go +59 -0
- package/dist/templates/native-go/backend/internal/app/background_owner_test.go +145 -0
- package/dist/templates/native-go/backend/internal/app/background_schedule.go +74 -0
- package/dist/templates/native-go/backend/internal/app/background_schedule_test.go +62 -0
- package/dist/templates/native-go/backend/internal/app/background_test.go +346 -0
- package/dist/templates/native-go/backend/internal/app/integration_state.go +16 -0
- package/dist/templates/native-go/backend/internal/app/migrations.go +41 -0
- package/dist/templates/native-go/backend/internal/app/migrations_test.go +41 -0
- package/dist/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +8 -0
- package/dist/templates/native-go/backend/internal/app/routes.go +22 -5
- package/dist/templates/native-go/backend/internal/app/routes_test.go +20 -3
- package/dist/templates/native-go/backend/internal/app/sdk_jobs.go +70 -0
- package/dist/templates/native-go/backend/internal/app/sdk_jobs_test.go +116 -0
- package/dist/templates/native-go/backend/internal/app/sdk_routes.go +177 -0
- package/dist/templates/native-go/backend/internal/app/session_files.go +15 -0
- package/dist/templates/native-go/backend/internal/app/session_files_test.go +26 -0
- package/dist/templates/native-go/backend/internal/app/shared_folder.go +144 -0
- package/dist/templates/native-go/backend/internal/app/shared_folder_test.go +158 -0
- package/dist/templates/native-go/backend/internal/background/access.go +57 -0
- package/dist/templates/native-go/backend/internal/background/owner_test.go +126 -0
- package/dist/templates/native-go/backend/internal/background/runner.go +185 -0
- package/dist/templates/native-go/backend/internal/background/runner_test.go +209 -0
- package/dist/templates/native-go/backend/internal/background/schedule.go +300 -0
- package/dist/templates/native-go/backend/internal/background/schedule_test.go +335 -0
- package/dist/templates/native-go/backend/internal/background/store.go +807 -0
- package/dist/templates/native-go/backend/internal/background/store_test.go +407 -0
- package/dist/templates/native-go/backend/internal/datamigrate/migrate.go +191 -0
- package/dist/templates/native-go/backend/internal/datamigrate/migrate_test.go +177 -0
- package/dist/templates/native-go/backend/internal/filestation/browse_test.go +67 -0
- package/dist/templates/native-go/backend/internal/filestation/client.go +251 -0
- package/dist/templates/native-go/backend/internal/filestation/client_test.go +155 -0
- package/dist/templates/native-go/backend/internal/filestation/doc.go +4 -0
- package/dist/templates/native-go/backend/internal/filestation/read_file_test.go +90 -0
- package/dist/templates/native-go/backend/internal/filestation/repository.go +207 -0
- package/dist/templates/native-go/backend/internal/filestation/repository_test.go +104 -0
- package/dist/templates/native-go/backend/internal/filestation/sdk_session.go +241 -0
- package/dist/templates/native-go/backend/internal/filestation/sdk_session_test.go +183 -0
- package/dist/templates/native-go/backend/internal/filestation/service.go +254 -0
- package/dist/templates/native-go/backend/internal/filestation/service_test.go +94 -0
- package/dist/templates/native-go/backend/internal/filestation/session_semantics_test.go +383 -0
- package/dist/templates/native-go/backend/internal/filestation/write.go +72 -0
- package/dist/templates/native-go/backend/internal/filestation/write_test.go +123 -0
- package/dist/templates/native-go/backend/internal/helper/background_proof.go +163 -0
- package/dist/templates/native-go/backend/internal/helper/background_proof_contract.go +46 -0
- package/dist/templates/native-go/backend/internal/helper/background_proof_test.go +161 -0
- package/dist/templates/native-go/backend/internal/helper/data_contract.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/data_protocol.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/data_protocol_test.go +1 -1
- package/dist/templates/native-go/backend/internal/helper/grant_authority.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/grant_authority_test.go +1 -1
- package/dist/templates/native-go/backend/internal/helper/grant_repository_linux.go +2 -1
- package/dist/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +4 -3
- package/dist/templates/native-go/backend/internal/helper/grant_snapshot.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/bindings.go +48 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/contract_test.go +436 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/decode.go +185 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/digest.go +55 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/registry.go +85 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/registry_test.go +73 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/result.go +53 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/stub.go +8 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/testdata/input-digests.json +127 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/types.go +234 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/types_test.go +29 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/validate.go +462 -0
- package/dist/templates/native-go/backend/internal/helper/legacy_authority_schema_linux_test.go +34 -0
- package/dist/templates/native-go/backend/internal/helper/legacy_authority_schema_test.go +6 -0
- package/dist/templates/native-go/backend/internal/helper/management.go +86 -0
- package/dist/templates/native-go/backend/internal/helper/observation.go +42 -2
- package/dist/templates/native-go/backend/internal/helper/observation_health_test.go +13 -1
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic.go +56 -10
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +6 -0
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_writer.go +40 -0
- package/dist/templates/native-go/backend/internal/helper/process_linux.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/purge.go +115 -0
- package/dist/templates/native-go/backend/internal/helper/purge_test.go +59 -0
- package/dist/templates/native-go/backend/internal/helper/query_deadline_linux_test.go +115 -0
- package/dist/templates/native-go/backend/internal/helper/query_pending_diagnostic_test.go +254 -0
- package/dist/templates/native-go/backend/internal/helper/relaxed_invalidation.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/revoke.go +109 -0
- package/dist/templates/native-go/backend/internal/helper/revoke_test.go +121 -0
- package/dist/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +23 -4
- package/dist/templates/native-go/backend/internal/helper/sdk_assembly_linux.go +51 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_attach.go +83 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_attach_contract.go +32 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_attach_test.go +184 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_authority_schema_test.go +6 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_authority.go +832 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_authority_test.go +714 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_invalidation.go +218 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_lease.go +218 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_snapshot.go +110 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_store_linux_test.go +261 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_store_test.go +58 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_bindings.go +60 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_data_contract.go +251 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_data_protocol.go +424 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_dispatch_absence_test.go +51 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_display.go +488 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_display_contract.go +121 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_display_test.go +459 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_grant_authority.go +559 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_grant_repository_linux.go +417 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_grant_snapshot.go +94 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_history.go +80 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_history_test.go +76 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job.go +697 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_child_linux.go +309 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_contract.go +122 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_linux_test.go +159 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_process_linux.go +327 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_test.go +501 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_vm_linux_test.go +343 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal.go +77 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal_linux.go +244 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal_linux_test.go +295 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal_test.go +71 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_picker_test.go +50 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_process_linux.go +184 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_public_vm_linux_test.go +129 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_relaxed_invalidation.go +242 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_rpc.go +299 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_rpc_contract.go +70 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_rpc_test.go +135 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_server_linux.go +161 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session.go +677 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session_contract.go +72 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session_fence_test.go +215 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session_test.go +475 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_supervisor_frame.go +78 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_supervisor_linux.go +414 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_transport.go +79 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_transport_linux.go +82 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_transport_test.go +64 -0
- package/dist/templates/native-go/backend/internal/helper/server_linux.go +14 -2
- package/dist/templates/native-go/backend/internal/helper/stale_management_linux_test.go +126 -0
- package/dist/templates/native-go/backend/internal/helper/stale_management_test.go +122 -0
- package/dist/templates/native-go/backend/internal/helper/startup_diagnostic.go +68 -0
- package/dist/templates/native-go/backend/internal/helper/startup_diagnostic_linux_test.go +126 -0
- package/dist/templates/native-go/backend/internal/helper/startup_diagnostic_test.go +117 -0
- package/dist/templates/native-go/backend/internal/helper/status.go +22 -13
- package/dist/templates/native-go/backend/internal/helper/status_test.go +45 -0
- package/dist/templates/native-go/backend/internal/helper/supervision.go +1 -1
- package/dist/templates/native-go/backend/internal/helper/supervisor_frame.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_linux.go +6 -2
- package/dist/templates/native-go/backend/internal/helper/unit_connection_test.go +22 -4
- package/dist/templates/native-go/backend/internal/helper/unit_linux.go +7 -3
- package/dist/templates/native-go/backend/internal/helper/unit_query_linux.go +5 -1
- package/dist/templates/native-go/backend/internal/helper/write_files_linux.go +7 -4
- package/dist/templates/native-go/backend/internal/helper/write_files_linux_test.go +26 -0
- package/dist/templates/native-go/dsm-package.yaml +2 -2
- package/dist/templates/native-go-authorization/backend/internal/app/authorization.go +298 -0
- package/dist/templates/native-go-authorization/backend/internal/app/authorization_test.go +96 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/AuthorizationGate.vue +89 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/de.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/en.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/es.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/fr.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/index.ts +15 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/it.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/ja.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/ko.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/zh-CN.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/zh-TW.json +36 -0
- package/dist/templates/native-go-authorization/frontend/test/authorization-preview.html +14 -0
- package/dist/templates/native-go-authorization/frontend/test/authorization.test.ts +59 -0
- package/dist/templates/native-go-background/BACKGROUND.md +111 -0
- package/dist/templates/native-go-background/backend/internal/app/background_on.go +7 -0
- package/dist/templates/native-go-background/backend/internal/app/background_routes_test.go +32 -0
- package/dist/templates/native-go-background/frontend/src/background/BackgroundPanel.vue +178 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/de.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/en.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/es.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/fr.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/it.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/ja.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/ko.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/zh-CN.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/zh-TW.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n.ts +19 -0
- package/dist/templates/native-go-background/frontend/src/background/picker-provider.ts +13 -0
- package/dist/templates/native-go-background/frontend/test/background.test.ts +179 -0
- package/dist/templates/native-go-integration/backend/internal/app/personal.go +2 -2
- package/dist/templates/native-go-integration/backend/internal/app/personal_test.go +37 -0
- package/dist/templates/native-go-vue/README.md +38 -7
- package/dist/templates/native-go-vue/frontend/DESIGN.md +15 -3
- package/dist/templates/native-go-vue/frontend/README-JOBS.md +75 -0
- package/dist/templates/native-go-vue/frontend/README-M2.md +64 -0
- package/dist/templates/native-go-vue/frontend/package-lock.json +5 -4
- package/dist/templates/native-go-vue/frontend/package.json +1 -1
- package/dist/templates/native-go-vue/frontend/src/App.vue +39 -11
- package/dist/templates/native-go-vue/frontend/src/M2App.vue +57 -0
- package/dist/templates/native-go-vue/frontend/src/SDKApp.vue +203 -0
- package/dist/templates/native-go-vue/frontend/src/context.ts +3 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/InteractiveJobForm.vue +70 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/JobsAdminPanel.vue +33 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/JobsPanel.vue +135 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/connected-provider.ts +179 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/de.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/en.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/es.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/fr.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/it.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/ja.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/ko.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/zh-CN.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/zh-TW.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n.ts +15 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/mock-provider.ts +67 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/provider.ts +60 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/validate.ts +44 -0
- package/dist/templates/native-go-vue/frontend/src/m2-main.ts +21 -0
- package/dist/templates/native-go-vue/frontend/src/m2-style.css +7 -0
- package/dist/templates/native-go-vue/frontend/src/nas/M2Files.vue +94 -0
- package/dist/templates/native-go-vue/frontend/src/nas/M2PathPicker.vue +70 -0
- package/dist/templates/native-go-vue/frontend/src/nas/M2Settings.vue +69 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/de.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/en.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/es.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/fr.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/it.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/ja.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/ko.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-CN.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-TW.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/m2-contract.ts +33 -0
- package/dist/templates/native-go-vue/frontend/src/nas/m2-i18n.ts +24 -0
- package/dist/templates/native-go-vue/frontend/src/nas/m2-provider.ts +104 -0
- package/dist/templates/native-go-vue/frontend/src/nas/use-m2-request.ts +18 -0
- package/dist/templates/native-go-vue/frontend/src/sdk-main.ts +39 -0
- package/dist/templates/native-go-vue/frontend/src/shell/AppShell.vue +48 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/de.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/en.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/es.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/fr.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/it.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ja.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ko.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n.ts +17 -0
- package/dist/templates/native-go-vue/frontend/src/shell/pages.ts +34 -0
- package/dist/templates/native-go-vue/frontend/src/style.css +2 -6
- package/dist/templates/native-go-vue/frontend/test/apps.test.ts +21 -0
- package/dist/templates/native-go-vue/frontend/test/jobs-connected.test.ts +163 -0
- package/dist/templates/native-go-vue/frontend/test/jobs-preview.html +22 -0
- package/dist/templates/native-go-vue/frontend/test/jobs.test.ts +176 -0
- package/dist/templates/native-go-vue/frontend/test/m2-preview.html +27 -0
- package/dist/templates/native-go-vue/frontend/test/m2-provider.test.ts +87 -0
- package/dist/templates/native-go-vue/frontend/test/m2-ui.test.ts +209 -0
- package/dist/templates/native-go-vue/frontend/test/native-controls.test.ts +27 -0
- package/dist/templates/native-go-vue/frontend/test/picker-wire.test.ts +110 -0
- package/dist/templates/native-go-vue/frontend/test/shell-preview.html +19 -0
- package/dist/templates/native-go-vue/frontend/test/shell-sdk.test.ts +73 -0
- package/dist/templates/native-go-vue/frontend/test/shell-ui.test.ts +114 -0
- package/dist/templates/native-go-vue/frontend/test/shell.test.ts +45 -0
- package/dist/templates/native-go-vue/frontend/vite.config.ts +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/validate.js +6 -3
- package/package.json +5 -2
- package/schema/synology-app.schema.json +19 -0
- package/skills/reference/create.md +6 -2
- package/templates/_authorization/main.go +104 -0
- package/templates/_authorization/main_test.go +35 -0
- package/templates/_daemon/go.mod +2 -0
- package/templates/_gateway/auth.go +101 -0
- package/templates/_gateway/auth_test.go +216 -0
- package/templates/_gateway/cgi.go +133 -0
- package/templates/_gateway/cgi_test.go +156 -0
- package/templates/_gateway/csrf.go +73 -0
- package/templates/_gateway/csrf_test.go +155 -0
- package/templates/_gateway/directory.go +108 -0
- package/templates/_gateway/directory_test.go +202 -0
- package/templates/_gateway/gateway.go +412 -0
- package/templates/_gateway/gateway_test.go +676 -0
- package/templates/_gateway/go.mod +3 -0
- package/templates/_gateway/groups.go +66 -0
- package/templates/_gateway/main.go +45 -0
- package/templates/binary/synology-app.yaml +1 -1
- package/templates/compose-import/compose.yaml +1 -1
- package/templates/compose-import/synology-app.yaml +1 -1
- package/templates/hello-files/compose.yaml +1 -1
- package/templates/hello-files/synology-app.yaml +1 -1
- package/templates/native-go/README.md +118 -5
- package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +3 -1
- package/templates/native-go/backend/cmd/app/main.go +25 -6
- package/templates/native-go/backend/cmd/app/sdk_main.go +62 -0
- package/templates/native-go/backend/cmd/background-worker/main.go +38 -0
- package/templates/native-go/backend/cmd/helper/main.go +27 -1
- package/templates/native-go/backend/cmd/helper/sdk_registry.go +19 -0
- package/templates/native-go/backend/go.mod +5 -3
- package/templates/native-go/backend/go.sum +4 -4
- package/templates/native-go/backend/internal/api/registry.go +17 -6
- package/templates/native-go/backend/internal/api/server.go +7 -1
- package/templates/native-go/backend/internal/app/authorization_none.go +5 -0
- package/templates/native-go/backend/internal/app/background.go +270 -0
- package/templates/native-go/backend/internal/app/background_none.go +8 -0
- package/templates/native-go/backend/internal/app/background_owner.go +59 -0
- package/templates/native-go/backend/internal/app/background_owner_test.go +145 -0
- package/templates/native-go/backend/internal/app/background_schedule.go +74 -0
- package/templates/native-go/backend/internal/app/background_schedule_test.go +62 -0
- package/templates/native-go/backend/internal/app/background_test.go +346 -0
- package/templates/native-go/backend/internal/app/integration_state.go +16 -0
- package/templates/native-go/backend/internal/app/migrations.go +41 -0
- package/templates/native-go/backend/internal/app/migrations_test.go +41 -0
- package/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +8 -0
- package/templates/native-go/backend/internal/app/routes.go +22 -5
- package/templates/native-go/backend/internal/app/routes_test.go +20 -3
- package/templates/native-go/backend/internal/app/sdk_jobs.go +70 -0
- package/templates/native-go/backend/internal/app/sdk_jobs_test.go +116 -0
- package/templates/native-go/backend/internal/app/sdk_routes.go +177 -0
- package/templates/native-go/backend/internal/app/session_files.go +15 -0
- package/templates/native-go/backend/internal/app/session_files_test.go +26 -0
- package/templates/native-go/backend/internal/app/shared_folder.go +144 -0
- package/templates/native-go/backend/internal/app/shared_folder_test.go +158 -0
- package/templates/native-go/backend/internal/background/access.go +57 -0
- package/templates/native-go/backend/internal/background/owner_test.go +126 -0
- package/templates/native-go/backend/internal/background/runner.go +185 -0
- package/templates/native-go/backend/internal/background/runner_test.go +209 -0
- package/templates/native-go/backend/internal/background/schedule.go +300 -0
- package/templates/native-go/backend/internal/background/schedule_test.go +335 -0
- package/templates/native-go/backend/internal/background/store.go +807 -0
- package/templates/native-go/backend/internal/background/store_test.go +407 -0
- package/templates/native-go/backend/internal/datamigrate/migrate.go +191 -0
- package/templates/native-go/backend/internal/datamigrate/migrate_test.go +177 -0
- package/templates/native-go/backend/internal/filestation/browse_test.go +67 -0
- package/templates/native-go/backend/internal/filestation/client.go +251 -0
- package/templates/native-go/backend/internal/filestation/client_test.go +155 -0
- package/templates/native-go/backend/internal/filestation/doc.go +4 -0
- package/templates/native-go/backend/internal/filestation/read_file_test.go +90 -0
- package/templates/native-go/backend/internal/filestation/repository.go +207 -0
- package/templates/native-go/backend/internal/filestation/repository_test.go +104 -0
- package/templates/native-go/backend/internal/filestation/sdk_session.go +241 -0
- package/templates/native-go/backend/internal/filestation/sdk_session_test.go +183 -0
- package/templates/native-go/backend/internal/filestation/service.go +254 -0
- package/templates/native-go/backend/internal/filestation/service_test.go +94 -0
- package/templates/native-go/backend/internal/filestation/session_semantics_test.go +383 -0
- package/templates/native-go/backend/internal/filestation/write.go +72 -0
- package/templates/native-go/backend/internal/filestation/write_test.go +123 -0
- package/templates/native-go/backend/internal/helper/background_proof.go +163 -0
- package/templates/native-go/backend/internal/helper/background_proof_contract.go +46 -0
- package/templates/native-go/backend/internal/helper/background_proof_test.go +161 -0
- package/templates/native-go/backend/internal/helper/data_contract.go +3 -0
- package/templates/native-go/backend/internal/helper/data_protocol.go +3 -0
- package/templates/native-go/backend/internal/helper/data_protocol_test.go +1 -1
- package/templates/native-go/backend/internal/helper/grant_authority.go +3 -0
- package/templates/native-go/backend/internal/helper/grant_authority_test.go +1 -1
- package/templates/native-go/backend/internal/helper/grant_repository_linux.go +2 -1
- package/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +4 -3
- package/templates/native-go/backend/internal/helper/grant_snapshot.go +3 -0
- package/templates/native-go/backend/internal/helper/jobcontract/bindings.go +48 -0
- package/templates/native-go/backend/internal/helper/jobcontract/contract_test.go +436 -0
- package/templates/native-go/backend/internal/helper/jobcontract/decode.go +185 -0
- package/templates/native-go/backend/internal/helper/jobcontract/digest.go +55 -0
- package/templates/native-go/backend/internal/helper/jobcontract/registry.go +85 -0
- package/templates/native-go/backend/internal/helper/jobcontract/registry_test.go +73 -0
- package/templates/native-go/backend/internal/helper/jobcontract/result.go +53 -0
- package/templates/native-go/backend/internal/helper/jobcontract/stub.go +8 -0
- package/templates/native-go/backend/internal/helper/jobcontract/testdata/input-digests.json +127 -0
- package/templates/native-go/backend/internal/helper/jobcontract/types.go +234 -0
- package/templates/native-go/backend/internal/helper/jobcontract/types_test.go +29 -0
- package/templates/native-go/backend/internal/helper/jobcontract/validate.go +462 -0
- package/templates/native-go/backend/internal/helper/legacy_authority_schema_linux_test.go +34 -0
- package/templates/native-go/backend/internal/helper/legacy_authority_schema_test.go +6 -0
- package/templates/native-go/backend/internal/helper/management.go +86 -0
- package/templates/native-go/backend/internal/helper/observation.go +42 -2
- package/templates/native-go/backend/internal/helper/observation_health_test.go +13 -1
- package/templates/native-go/backend/internal/helper/observer_diagnostic.go +56 -10
- package/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +6 -0
- package/templates/native-go/backend/internal/helper/observer_diagnostic_writer.go +40 -0
- package/templates/native-go/backend/internal/helper/process_linux.go +3 -0
- package/templates/native-go/backend/internal/helper/purge.go +115 -0
- package/templates/native-go/backend/internal/helper/purge_test.go +59 -0
- package/templates/native-go/backend/internal/helper/query_deadline_linux_test.go +115 -0
- package/templates/native-go/backend/internal/helper/query_pending_diagnostic_test.go +254 -0
- package/templates/native-go/backend/internal/helper/relaxed_invalidation.go +3 -0
- package/templates/native-go/backend/internal/helper/revoke.go +109 -0
- package/templates/native-go/backend/internal/helper/revoke_test.go +121 -0
- package/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +23 -4
- package/templates/native-go/backend/internal/helper/sdk_assembly_linux.go +51 -0
- package/templates/native-go/backend/internal/helper/sdk_attach.go +83 -0
- package/templates/native-go/backend/internal/helper/sdk_attach_contract.go +32 -0
- package/templates/native-go/backend/internal/helper/sdk_attach_test.go +184 -0
- package/templates/native-go/backend/internal/helper/sdk_authority_schema_test.go +6 -0
- package/templates/native-go/backend/internal/helper/sdk_background_authority.go +832 -0
- package/templates/native-go/backend/internal/helper/sdk_background_authority_test.go +714 -0
- package/templates/native-go/backend/internal/helper/sdk_background_invalidation.go +218 -0
- package/templates/native-go/backend/internal/helper/sdk_background_lease.go +218 -0
- package/templates/native-go/backend/internal/helper/sdk_background_snapshot.go +110 -0
- package/templates/native-go/backend/internal/helper/sdk_background_store_linux_test.go +261 -0
- package/templates/native-go/backend/internal/helper/sdk_background_store_test.go +58 -0
- package/templates/native-go/backend/internal/helper/sdk_bindings.go +60 -0
- package/templates/native-go/backend/internal/helper/sdk_data_contract.go +251 -0
- package/templates/native-go/backend/internal/helper/sdk_data_protocol.go +424 -0
- package/templates/native-go/backend/internal/helper/sdk_dispatch_absence_test.go +51 -0
- package/templates/native-go/backend/internal/helper/sdk_display.go +488 -0
- package/templates/native-go/backend/internal/helper/sdk_display_contract.go +121 -0
- package/templates/native-go/backend/internal/helper/sdk_display_test.go +459 -0
- package/templates/native-go/backend/internal/helper/sdk_grant_authority.go +559 -0
- package/templates/native-go/backend/internal/helper/sdk_grant_repository_linux.go +417 -0
- package/templates/native-go/backend/internal/helper/sdk_grant_snapshot.go +94 -0
- package/templates/native-go/backend/internal/helper/sdk_history.go +80 -0
- package/templates/native-go/backend/internal/helper/sdk_history_test.go +76 -0
- package/templates/native-go/backend/internal/helper/sdk_job.go +697 -0
- package/templates/native-go/backend/internal/helper/sdk_job_child_linux.go +309 -0
- package/templates/native-go/backend/internal/helper/sdk_job_contract.go +122 -0
- package/templates/native-go/backend/internal/helper/sdk_job_linux_test.go +159 -0
- package/templates/native-go/backend/internal/helper/sdk_job_process_linux.go +327 -0
- package/templates/native-go/backend/internal/helper/sdk_job_test.go +501 -0
- package/templates/native-go/backend/internal/helper/sdk_job_vm_linux_test.go +343 -0
- package/templates/native-go/backend/internal/helper/sdk_journal.go +77 -0
- package/templates/native-go/backend/internal/helper/sdk_journal_linux.go +244 -0
- package/templates/native-go/backend/internal/helper/sdk_journal_linux_test.go +295 -0
- package/templates/native-go/backend/internal/helper/sdk_journal_test.go +71 -0
- package/templates/native-go/backend/internal/helper/sdk_picker_test.go +50 -0
- package/templates/native-go/backend/internal/helper/sdk_process_linux.go +184 -0
- package/templates/native-go/backend/internal/helper/sdk_public_vm_linux_test.go +129 -0
- package/templates/native-go/backend/internal/helper/sdk_relaxed_invalidation.go +242 -0
- package/templates/native-go/backend/internal/helper/sdk_rpc.go +299 -0
- package/templates/native-go/backend/internal/helper/sdk_rpc_contract.go +70 -0
- package/templates/native-go/backend/internal/helper/sdk_rpc_test.go +135 -0
- package/templates/native-go/backend/internal/helper/sdk_server_linux.go +161 -0
- package/templates/native-go/backend/internal/helper/sdk_session.go +677 -0
- package/templates/native-go/backend/internal/helper/sdk_session_contract.go +72 -0
- package/templates/native-go/backend/internal/helper/sdk_session_fence_test.go +215 -0
- package/templates/native-go/backend/internal/helper/sdk_session_test.go +475 -0
- package/templates/native-go/backend/internal/helper/sdk_supervisor_frame.go +78 -0
- package/templates/native-go/backend/internal/helper/sdk_supervisor_linux.go +414 -0
- package/templates/native-go/backend/internal/helper/sdk_transport.go +79 -0
- package/templates/native-go/backend/internal/helper/sdk_transport_linux.go +82 -0
- package/templates/native-go/backend/internal/helper/sdk_transport_test.go +64 -0
- package/templates/native-go/backend/internal/helper/server_linux.go +14 -2
- package/templates/native-go/backend/internal/helper/stale_management_linux_test.go +126 -0
- package/templates/native-go/backend/internal/helper/stale_management_test.go +122 -0
- package/templates/native-go/backend/internal/helper/startup_diagnostic.go +68 -0
- package/templates/native-go/backend/internal/helper/startup_diagnostic_linux_test.go +126 -0
- package/templates/native-go/backend/internal/helper/startup_diagnostic_test.go +117 -0
- package/templates/native-go/backend/internal/helper/status.go +22 -13
- package/templates/native-go/backend/internal/helper/status_test.go +45 -0
- package/templates/native-go/backend/internal/helper/supervision.go +1 -1
- package/templates/native-go/backend/internal/helper/supervisor_frame.go +3 -0
- package/templates/native-go/backend/internal/helper/supervisor_linux.go +6 -2
- package/templates/native-go/backend/internal/helper/unit_connection_test.go +22 -4
- package/templates/native-go/backend/internal/helper/unit_linux.go +7 -3
- package/templates/native-go/backend/internal/helper/unit_query_linux.go +5 -1
- package/templates/native-go/backend/internal/helper/write_files_linux.go +7 -4
- package/templates/native-go/backend/internal/helper/write_files_linux_test.go +26 -0
- package/templates/native-go/dsm-package.yaml +2 -2
- package/templates/native-go-authorization/backend/internal/app/authorization.go +298 -0
- package/templates/native-go-authorization/backend/internal/app/authorization_test.go +96 -0
- package/templates/native-go-authorization/frontend/src/authorization/AuthorizationGate.vue +89 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/de.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/en.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/es.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/fr.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/index.ts +15 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/it.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/ja.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/ko.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/zh-CN.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/zh-TW.json +36 -0
- package/templates/native-go-authorization/frontend/test/authorization-preview.html +14 -0
- package/templates/native-go-authorization/frontend/test/authorization.test.ts +59 -0
- package/templates/native-go-background/BACKGROUND.md +111 -0
- package/templates/native-go-background/backend/internal/app/background_on.go +7 -0
- package/templates/native-go-background/backend/internal/app/background_routes_test.go +32 -0
- package/templates/native-go-background/frontend/src/background/BackgroundPanel.vue +178 -0
- package/templates/native-go-background/frontend/src/background/i18n/de.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/en.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/es.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/fr.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/it.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/ja.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/ko.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/zh-CN.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/zh-TW.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n.ts +19 -0
- package/templates/native-go-background/frontend/src/background/picker-provider.ts +13 -0
- package/templates/native-go-background/frontend/test/background.test.ts +179 -0
- package/templates/native-go-integration/backend/internal/app/personal.go +2 -2
- package/templates/native-go-integration/backend/internal/app/personal_test.go +37 -0
- package/templates/native-go-vue/README.md +38 -7
- package/templates/native-go-vue/frontend/DESIGN.md +15 -3
- package/templates/native-go-vue/frontend/README-JOBS.md +75 -0
- package/templates/native-go-vue/frontend/README-M2.md +64 -0
- package/templates/native-go-vue/frontend/package-lock.json +5 -4
- package/templates/native-go-vue/frontend/package.json +1 -1
- package/templates/native-go-vue/frontend/src/App.vue +39 -11
- package/templates/native-go-vue/frontend/src/M2App.vue +57 -0
- package/templates/native-go-vue/frontend/src/SDKApp.vue +203 -0
- package/templates/native-go-vue/frontend/src/context.ts +3 -0
- package/templates/native-go-vue/frontend/src/jobs/InteractiveJobForm.vue +70 -0
- package/templates/native-go-vue/frontend/src/jobs/JobsAdminPanel.vue +33 -0
- package/templates/native-go-vue/frontend/src/jobs/JobsPanel.vue +135 -0
- package/templates/native-go-vue/frontend/src/jobs/connected-provider.ts +179 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/de.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/en.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/es.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/fr.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/it.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/ja.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/ko.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/zh-CN.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/zh-TW.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n.ts +15 -0
- package/templates/native-go-vue/frontend/src/jobs/mock-provider.ts +67 -0
- package/templates/native-go-vue/frontend/src/jobs/provider.ts +60 -0
- package/templates/native-go-vue/frontend/src/jobs/validate.ts +44 -0
- package/templates/native-go-vue/frontend/src/m2-main.ts +21 -0
- package/templates/native-go-vue/frontend/src/m2-style.css +7 -0
- package/templates/native-go-vue/frontend/src/nas/M2Files.vue +94 -0
- package/templates/native-go-vue/frontend/src/nas/M2PathPicker.vue +70 -0
- package/templates/native-go-vue/frontend/src/nas/M2Settings.vue +69 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/de.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/en.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/es.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/fr.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/it.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/ja.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/ko.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-CN.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-TW.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/m2-contract.ts +33 -0
- package/templates/native-go-vue/frontend/src/nas/m2-i18n.ts +24 -0
- package/templates/native-go-vue/frontend/src/nas/m2-provider.ts +104 -0
- package/templates/native-go-vue/frontend/src/nas/use-m2-request.ts +18 -0
- package/templates/native-go-vue/frontend/src/sdk-main.ts +39 -0
- package/templates/native-go-vue/frontend/src/shell/AppShell.vue +48 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/de.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/en.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/es.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/fr.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/it.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/ja.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/ko.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n.ts +17 -0
- package/templates/native-go-vue/frontend/src/shell/pages.ts +34 -0
- package/templates/native-go-vue/frontend/src/style.css +2 -6
- package/templates/native-go-vue/frontend/test/apps.test.ts +21 -0
- package/templates/native-go-vue/frontend/test/jobs-connected.test.ts +163 -0
- package/templates/native-go-vue/frontend/test/jobs-preview.html +22 -0
- package/templates/native-go-vue/frontend/test/jobs.test.ts +176 -0
- package/templates/native-go-vue/frontend/test/m2-preview.html +27 -0
- package/templates/native-go-vue/frontend/test/m2-provider.test.ts +87 -0
- package/templates/native-go-vue/frontend/test/m2-ui.test.ts +209 -0
- package/templates/native-go-vue/frontend/test/native-controls.test.ts +27 -0
- package/templates/native-go-vue/frontend/test/picker-wire.test.ts +110 -0
- package/templates/native-go-vue/frontend/test/shell-preview.html +19 -0
- package/templates/native-go-vue/frontend/test/shell-sdk.test.ts +73 -0
- package/templates/native-go-vue/frontend/test/shell-ui.test.ts +114 -0
- package/templates/native-go-vue/frontend/test/shell.test.ts +45 -0
- package/templates/native-go-vue/frontend/vite.config.ts +2 -2
- package/dist/templates/hello-web/compose.yaml +0 -21
- package/dist/templates/hello-web/html/app.js +0 -1
- package/dist/templates/hello-web/html/index.html +0 -13
- package/dist/templates/hello-web/synology-app.yaml +0 -13
- package/dist/templates/hello-web-page/compose.yaml +0 -21
- package/dist/templates/hello-web-page/html/app.js +0 -1
- package/dist/templates/hello-web-page/html/index.html +0 -13
- package/dist/templates/hello-web-page/synology-app.yaml +0 -13
- package/templates/hello-web/compose.yaml +0 -21
- package/templates/hello-web/html/app.js +0 -1
- package/templates/hello-web/html/index.html +0 -13
- package/templates/hello-web/synology-app.yaml +0 -13
- package/templates/hello-web-page/compose.yaml +0 -21
- package/templates/hello-web-page/html/app.js +0 -1
- package/templates/hello-web-page/html/index.html +0 -13
- package/templates/hello-web-page/synology-app.yaml +0 -13
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/** Shared virtual-path validation and File Station request shaping. */
|
|
2
|
+
export const HOST_FILE_NAVIGATION_RUNTIME = `
|
|
3
|
+
function requestHostFileNavigation(launch, path, isDirectory) {
|
|
4
|
+
if (typeof path !== "string" || path.length > 4096 || path.charAt(0) !== "/" ||
|
|
5
|
+
/[\\x00-\\x1f\\x7f\\\\]/.test(path)) return { status: "invalid-input" };
|
|
6
|
+
var parts = path.split("/");
|
|
7
|
+
if (/^volume[0-9]+$/i.test(parts[1]) || parts.slice(1).some(function (part) {
|
|
8
|
+
return !part || part === "." || part === "..";
|
|
9
|
+
})) return { status: "invalid-input" };
|
|
10
|
+
var result = launch("SYNO.SDS.App.FileStation3.Instance", isDirectory ? { opendir: path } : { openfile: path });
|
|
11
|
+
if (result.status !== "requested") return result;
|
|
12
|
+
return { status: "requested", action: isDirectory ? "locate-folder" : "highlight-file" };
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
// Engineering bounds, not DSM/File Station latency proof.
|
|
16
|
+
export const REVEAL_RECOVERY_TIMEOUT_MS = 5000;
|
|
17
|
+
export const REVEAL_RECOVERY_POLL_MS = 100;
|
|
18
|
+
export const REVEAL_RECOVERY_QUIET_MS = 300;
|
|
19
|
+
/** Best-effort recovery for File Station 1.4.x private structures. */
|
|
20
|
+
export const HOST_FILE_REVEAL_RUNTIME = `
|
|
21
|
+
var REVEAL_RECOVERY_TIMEOUT_MS = ${REVEAL_RECOVERY_TIMEOUT_MS};
|
|
22
|
+
var REVEAL_RECOVERY_POLL_MS = ${REVEAL_RECOVERY_POLL_MS};
|
|
23
|
+
var REVEAL_RECOVERY_QUIET_MS = ${REVEAL_RECOVERY_QUIET_MS};
|
|
24
|
+
var hostFileRevealOwners = null, hostFileRevealSequence = 0;
|
|
25
|
+
try { if (typeof WeakMap === "function") hostFileRevealOwners = new WeakMap(); } catch (error) {}
|
|
26
|
+
function createHostFileRevealRecovery(path, canAct) {
|
|
27
|
+
var active = true, accepted = false, win = null, dom = null, tuple = null;
|
|
28
|
+
var poll = null, deadline = null, removers = [], reached = false, pending = 0;
|
|
29
|
+
var previous = null, quietSince = null, expires = 0, order = ++hostFileRevealSequence;
|
|
30
|
+
var parent = path.slice(0, path.lastIndexOf("/"));
|
|
31
|
+
function cancel() {
|
|
32
|
+
if (!active) return;
|
|
33
|
+
active = false;
|
|
34
|
+
try { if (poll !== null) clearTimeout(poll); } catch (error) {}
|
|
35
|
+
try { if (deadline !== null) clearTimeout(deadline); } catch (error) {}
|
|
36
|
+
poll = deadline = null;
|
|
37
|
+
removers.splice(0).forEach(function (remove) { try { remove(); } catch (error) {} });
|
|
38
|
+
try {
|
|
39
|
+
if (win && hostFileRevealOwners.get(win).order === order) {
|
|
40
|
+
// Preserve ordering for a late older callback, without retaining its closures.
|
|
41
|
+
hostFileRevealOwners.set(win, { order: order, cancel: null });
|
|
42
|
+
}
|
|
43
|
+
} catch (error) {}
|
|
44
|
+
win = dom = tuple = previous = null;
|
|
45
|
+
}
|
|
46
|
+
function requireMethods(target, names) {
|
|
47
|
+
if (!target || names.some(function (name) { return typeof target[name] !== "function"; })) throw new Error("unsupported receiver");
|
|
48
|
+
}
|
|
49
|
+
function guard(fn) {
|
|
50
|
+
return function () {
|
|
51
|
+
if (!active) return;
|
|
52
|
+
try { fn.apply(null, arguments); } catch (error) { cancel(); }
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function listen(target, event, fn) {
|
|
56
|
+
requireMethods(target, ["on", "un"]);
|
|
57
|
+
var handler = guard(fn), remove = target.un;
|
|
58
|
+
removers.push(function () { remove.call(target, event, handler, target); });
|
|
59
|
+
target.on(event, handler, target);
|
|
60
|
+
}
|
|
61
|
+
function resetQuiet() { previous = null; quietSince = null; }
|
|
62
|
+
function inspect() {
|
|
63
|
+
requireMethods(win, ["getPanelInstance", "getEl", "on", "un"]);
|
|
64
|
+
if (win.isDestroyed || win.destroyed || !canAct()) { cancel(); return null; }
|
|
65
|
+
var element = win.getEl(), nextDom = element && element.dom;
|
|
66
|
+
if (!nextDom) { if (dom) cancel(); return null; }
|
|
67
|
+
requireMethods(nextDom, ["addEventListener", "removeEventListener"]);
|
|
68
|
+
if (dom && nextDom !== dom) { cancel(); return null; }
|
|
69
|
+
if (!dom) {
|
|
70
|
+
dom = nextDom;
|
|
71
|
+
["pointerdown", "mousedown", "touchstart", "keydown", "wheel", "click", "input"].forEach(function (event) {
|
|
72
|
+
var remove = dom.removeEventListener, handler = guard(cancel), target = dom;
|
|
73
|
+
removers.push(function () { remove.call(target, event, handler, true); });
|
|
74
|
+
dom.addEventListener(event, handler, true);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
var panel = win.getPanelInstance();
|
|
78
|
+
if (!panel) { if (tuple) cancel(); return null; }
|
|
79
|
+
requireMethods(panel, ["getCurrentDir", "on", "un"]);
|
|
80
|
+
var view = panel.activeView, store = panel.activeDS;
|
|
81
|
+
requireMethods(view, ["getStore", "getSelectionModel", "scrollToItem"]);
|
|
82
|
+
requireMethods(store, ["on", "un", "indexOfId", "getAt", "getCount"]);
|
|
83
|
+
var model = view.getSelectionModel();
|
|
84
|
+
requireMethods(model, ["on", "un", "getSelections", "selectRow"]);
|
|
85
|
+
if (view.getStore() !== store || panel.isDestroyed || store.isDestroyed || model.isDestroyed) { cancel(); return null; }
|
|
86
|
+
if (tuple && (tuple.panel !== panel || tuple.view !== view || tuple.store !== store || tuple.model !== model)) { cancel(); return null; }
|
|
87
|
+
if (!tuple) {
|
|
88
|
+
tuple = { panel: panel, view: view, store: store, model: model };
|
|
89
|
+
listen(panel, "destroy", cancel);
|
|
90
|
+
listen(panel, "onNodeClick", function (node) {
|
|
91
|
+
if (!node || !node.attributes || (reached && node.attributes.path !== parent)) cancel();
|
|
92
|
+
});
|
|
93
|
+
listen(store, "beforeload", function () {
|
|
94
|
+
pending++; resetQuiet(); inspect();
|
|
95
|
+
});
|
|
96
|
+
listen(store, "load", function () {
|
|
97
|
+
if (pending > 0) pending--;
|
|
98
|
+
resetQuiet(); check();
|
|
99
|
+
});
|
|
100
|
+
["exception", "loadexception", "destroy"].forEach(function (event) { listen(store, event, cancel); });
|
|
101
|
+
listen(model, "selectionchange", function () { resetQuiet(); check(); });
|
|
102
|
+
}
|
|
103
|
+
var dir = panel.getCurrentDir(), params = store.baseParams;
|
|
104
|
+
// New File Station panels expose their APIs before the first directory is set.
|
|
105
|
+
// Keep the bound receiver guards and original deadline while startup finishes.
|
|
106
|
+
if (!reached && dir === undefined && (!params || params.folder_path === undefined)) return null;
|
|
107
|
+
if (!params || typeof params.folder_path !== "string") throw new Error("unsupported store path");
|
|
108
|
+
// Native reconfigure/selection events can precede the store's path assignment.
|
|
109
|
+
if (dir === parent && params.folder_path === parent) reached = true;
|
|
110
|
+
if (reached && (dir !== parent || params.folder_path !== parent)) { cancel(); return null; }
|
|
111
|
+
var selections = model.getSelections();
|
|
112
|
+
if (!Array.isArray(selections)) throw new Error("unsupported selection");
|
|
113
|
+
if (selections.some(function (record) { return !record || record.id !== path; })) { cancel(); return null; }
|
|
114
|
+
var index = store.indexOfId(path), count = store.getCount();
|
|
115
|
+
if (!Number.isInteger(index) || index < -1 || !Number.isInteger(count) || count < 0) throw new Error("unsupported store index");
|
|
116
|
+
var record = index >= 0 ? store.getAt(index) : null;
|
|
117
|
+
if (index >= 0 && (!record || record.id !== path || index >= count)) throw new Error("inconsistent store");
|
|
118
|
+
return { dir: dir, folder: params.folder_path, count: count, index: index, record: record, selected: selections.length > 0 };
|
|
119
|
+
}
|
|
120
|
+
function check() {
|
|
121
|
+
if (!active) return;
|
|
122
|
+
if (Date.now() >= expires || !canAct()) { cancel(); return; }
|
|
123
|
+
if (!win) return;
|
|
124
|
+
var state = inspect();
|
|
125
|
+
if (!active || !state) return;
|
|
126
|
+
if (pending || state.dir !== parent || state.folder !== parent || state.index < 0) { resetQuiet(); return; }
|
|
127
|
+
if (!previous || Object.keys(state).some(function (key) { return state[key] !== previous[key]; })) {
|
|
128
|
+
previous = state; quietSince = Date.now();
|
|
129
|
+
}
|
|
130
|
+
if (Date.now() - quietSince < REVEAL_RECOVERY_QUIET_MS) return;
|
|
131
|
+
var target = tuple, receiverWindow = win;
|
|
132
|
+
cancel(); // Release every observer before the one permitted selection mutation.
|
|
133
|
+
if (state.selected || !canAct()) return;
|
|
134
|
+
target.model.selectRow(state.index);
|
|
135
|
+
if (canAct() && !receiverWindow.isDestroyed && receiverWindow.getPanelInstance() === target.panel &&
|
|
136
|
+
target.panel.activeView === target.view && target.panel.activeDS === target.store &&
|
|
137
|
+
target.view.getSelectionModel() === target.model) target.view.scrollToItem(state.index);
|
|
138
|
+
}
|
|
139
|
+
function tick() {
|
|
140
|
+
poll = null;
|
|
141
|
+
try {
|
|
142
|
+
check();
|
|
143
|
+
if (active) poll = setTimeout(tick, REVEAL_RECOVERY_POLL_MS);
|
|
144
|
+
} catch (error) { cancel(); }
|
|
145
|
+
}
|
|
146
|
+
function receive(instance) {
|
|
147
|
+
if (!active || accepted) return;
|
|
148
|
+
accepted = true;
|
|
149
|
+
try {
|
|
150
|
+
if (Date.now() >= expires || !canAct()) { cancel(); return; }
|
|
151
|
+
win = instance && instance.window;
|
|
152
|
+
requireMethods(win, ["getPanelInstance", "getEl", "on", "un"]);
|
|
153
|
+
var owner = hostFileRevealOwners.get(win);
|
|
154
|
+
if (owner && owner.order > order) { cancel(); return; }
|
|
155
|
+
if (owner && owner.cancel) owner.cancel();
|
|
156
|
+
hostFileRevealOwners.set(win, { order: order, cancel: cancel });
|
|
157
|
+
["beforeclose", "close", "beforedestroy", "destroy", "hide"].forEach(function (event) { listen(win, event, cancel); });
|
|
158
|
+
check();
|
|
159
|
+
} catch (error) { cancel(); }
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
if (!parent || !hostFileRevealOwners || typeof setTimeout !== "function" || typeof clearTimeout !== "function" || typeof Date.now !== "function") {
|
|
163
|
+
cancel();
|
|
164
|
+
} else {
|
|
165
|
+
expires = Date.now() + REVEAL_RECOVERY_TIMEOUT_MS;
|
|
166
|
+
deadline = setTimeout(cancel, REVEAL_RECOVERY_TIMEOUT_MS);
|
|
167
|
+
poll = setTimeout(tick, REVEAL_RECOVERY_POLL_MS);
|
|
168
|
+
}
|
|
169
|
+
} catch (error) { cancel(); }
|
|
170
|
+
return { receive: receive, cancel: cancel };
|
|
171
|
+
}
|
|
172
|
+
`;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { bootstrapOps } from "./authorization.js";
|
|
1
2
|
import { readFileSync } from "node:fs";
|
|
2
3
|
import { join } from "node:path";
|
|
3
4
|
import * as tar from "tar";
|
|
@@ -6,6 +7,7 @@ import { helperOps } from "./helper.js";
|
|
|
6
7
|
import { sha256 } from "./helper-inventory.js";
|
|
7
8
|
import { renderStandaloneScript } from "./lifecycle.js";
|
|
8
9
|
import { rootTasks } from "./root-window.js";
|
|
10
|
+
import { decodeSDKRegistry } from "./worker-registry.js";
|
|
9
11
|
/** Artifact consistency only; bytes, approval and health never certify NAS access. */
|
|
10
12
|
export async function inspectHelper(dir, info, findings, daemon = false) {
|
|
11
13
|
const files = new Map();
|
|
@@ -17,7 +19,7 @@ export async function inspectHelper(dir, info, findings, daemon = false) {
|
|
|
17
19
|
// Enumerate candidates to reject extras; only the INFO-derived exact path is read.
|
|
18
20
|
if (/^ui\/window-[^/]*\.js$/.test(path))
|
|
19
21
|
windows.push(path);
|
|
20
|
-
if (entry.type !== "File" || !(path.startsWith("integration/workers/") || ["integration/helper", "integration/inventory.json", "integration/workers.json", "ui/cgi/api.cgi", windowPath].includes(path)))
|
|
22
|
+
if (entry.type !== "File" || !(path.startsWith("integration/workers/") || ["authorization/manifest.json", "integration/helper", "integration/inventory.json", "integration/workers.json", "ui/cgi/api.cgi", windowPath].includes(path)))
|
|
21
23
|
return;
|
|
22
24
|
const limit = ["integration/helper", "ui/cgi/api.cgi"].includes(path) ? 64 * 1024 * 1024 : 1024 * 1024;
|
|
23
25
|
if (files.has(path) || entry.size > limit) {
|
|
@@ -51,13 +53,17 @@ export async function inspectHelper(dir, info, findings, daemon = false) {
|
|
|
51
53
|
!bytes("ui/cgi/api.cgi").includes(Buffer.from(raw)))
|
|
52
54
|
throw new Error("payload/compiled inventory mismatch");
|
|
53
55
|
const workers = bytes("integration/workers.json");
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
+
const rawRegistry = JSON.parse(workers.toString("utf8"));
|
|
57
|
+
const sdkRegistry = !Array.isArray(rawRegistry);
|
|
58
|
+
const registry = sdkRegistry ? decodeSDKRegistry(workers).inert : rawRegistry;
|
|
59
|
+
if (sdkRegistry && (i.protocol !== 2 || i.dataAccess !== "relaxed" || !helper.includes(workers)))
|
|
60
|
+
throw new Error("compiled SDK registry mismatch");
|
|
61
|
+
if (!Array.isArray(registry) || registry.length > 16 || sha256(workers) !== i.registryDigest || (!sdkRegistry && JSON.stringify(registry) !== workers.toString("utf8")))
|
|
56
62
|
throw new Error("invalid registry");
|
|
57
63
|
let previous = "", total = 0;
|
|
58
64
|
for (const worker of registry) {
|
|
59
65
|
if (!worker || Object.keys(worker).sort().join(",") !== "digest,id" || typeof worker.id !== "string" ||
|
|
60
|
-
!/^[a-z][a-z0-9_]{0,31}$/.test(worker.id) || (previous && previous.localeCompare(worker.id, "en") >= 0) ||
|
|
66
|
+
!/^[a-z][a-z0-9_]{0,31}$/.test(worker.id) || (previous && (sdkRegistry ? previous >= worker.id : previous.localeCompare(worker.id, "en") >= 0)) ||
|
|
61
67
|
!/^[a-f0-9]{64}$/.test(worker.digest))
|
|
62
68
|
throw new Error("invalid worker");
|
|
63
69
|
const content = bytes(`integration/workers/${worker.id}`);
|
|
@@ -68,9 +74,18 @@ export async function inspectHelper(dir, info, findings, daemon = false) {
|
|
|
68
74
|
}
|
|
69
75
|
if ([...files.keys()].filter(p => p.startsWith("integration/workers/")).length !== registry.length)
|
|
70
76
|
throw new Error("unregistered worker");
|
|
71
|
-
const manifest = { package: i.package, spkVersion: i.version, integration: { protocol: i.protocol, workers: {} } };
|
|
77
|
+
const manifest = { package: i.package, spkVersion: i.version, privilege: "root", integration: { protocol: i.protocol, workers: {} } };
|
|
72
78
|
const tasks = JSON.parse(/\.rootTasks = (\[[^\n]+\]);/.exec(bytes(windowPath).toString("utf8"))?.[1] ?? "null");
|
|
73
|
-
const
|
|
79
|
+
const originalOps = helperOps(manifest, i);
|
|
80
|
+
let expected = rootTasks({ ...manifest, rootOps: originalOps });
|
|
81
|
+
// Existing CLI 0.5 archives have inline hash-pinned helper tasks. New
|
|
82
|
+
// bootstrap archives carry an additional independently inspected inventory.
|
|
83
|
+
if (files.has("authorization/manifest.json")) {
|
|
84
|
+
const plan = JSON.parse(bytes("authorization/manifest.json").toString("utf8"));
|
|
85
|
+
if (JSON.stringify(plan.inventory.operations.filter((op) => op.name.startsWith("helper_"))) !== JSON.stringify(originalOps))
|
|
86
|
+
throw new Error("bootstrap helper binding mismatch");
|
|
87
|
+
expected = rootTasks({ ...manifest, rootOps: bootstrapOps({ ...manifest, rootOps: originalOps }, plan.bootstrapSha256) });
|
|
88
|
+
}
|
|
74
89
|
if (!Array.isArray(tasks) || JSON.stringify(tasks.filter(t => t.op?.startsWith("helper_"))) !== JSON.stringify(expected))
|
|
75
90
|
throw new Error("approved task mismatch");
|
|
76
91
|
// Daemon lifecycle is verified separately with the complete daemon config.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IntegrationInspection } from "./inspect-helper.js";
|
|
2
|
-
export type SpkKind = "native-go" | "binary" | "container";
|
|
2
|
+
export type SpkKind = "native-go" | "binary" | "container" | "native-layout";
|
|
3
3
|
export interface SpkInspection {
|
|
4
4
|
kind?: SpkKind;
|
|
5
5
|
package?: string;
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { inspectAuthorization } from "./authorization.js";
|
|
2
|
+
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync } from "node:fs";
|
|
2
3
|
import { tmpdir } from "node:os";
|
|
3
4
|
import { join } from "node:path";
|
|
4
5
|
import * as tar from "tar";
|
|
6
|
+
import { familyOfArchToken, NATIVE_ARCH_FAMILIES } from "../build-spk/dsm-arch.js";
|
|
7
|
+
import { CONTAINER_MIN_DSM, isDsmAtLeast } from "../build-spk/dsm-version.js";
|
|
8
|
+
import { ELF_MACHINE } from "./binary.js";
|
|
5
9
|
import { CGI_PAYLOAD_PATH } from "./dsm-window.js";
|
|
6
10
|
import { daemonConfig, readDaemon } from "./daemon.js";
|
|
11
|
+
import { BACKGROUND_UNIT_DIR, BACKGROUND_WORKER_PAYLOAD, backgroundUnitName, renderBackgroundControl, renderBackgroundUnit } from "./background.js";
|
|
12
|
+
import { renderStandaloneResource } from "./resource.js";
|
|
13
|
+
import { recoverSharedFolder, renderSharedFolderUpgradeWizardFiles, sharedFolderInstallSteps, SHARED_FOLDER_MARKER } from "./shared-folder.js";
|
|
14
|
+
import { renderInstallWizardFiles, renderNativeInstallWizard } from "../build-spk/install-wizard.js";
|
|
7
15
|
import { renderStandaloneScript } from "./lifecycle.js";
|
|
16
|
+
import { listPortExposures, loadCompose } from "../compose/analyze.js";
|
|
8
17
|
import { inspectHelper } from "./inspect-helper.js";
|
|
18
|
+
import { inspectNativeLayout } from "./native-layout.js";
|
|
9
19
|
const ROOT_SCRIPT_HINTS = [/\bsudo\b/, /\bchown\s+(-\w+\s+)*root\b/, /chmod\s+[ugo]*\+s\b/, /chmod\s+[2467][0-7]{3}\b/];
|
|
10
20
|
/** Reads an SPK without installing it and reports how it would run on DSM. */
|
|
11
21
|
export async function inspectStandaloneSpk(spkPath) {
|
|
@@ -17,26 +27,67 @@ export async function inspectSpk(spkPath, expectedKind) {
|
|
|
17
27
|
try {
|
|
18
28
|
await tar.x({ file: spkPath, cwd: dir });
|
|
19
29
|
const findings = [];
|
|
30
|
+
if (!expectedKind && existsSync(join(dir, "native-layout.json"))) {
|
|
31
|
+
const findings = [];
|
|
32
|
+
const info = Object.fromEntries(readFileSync(join(dir, "INFO"), "utf8").split("\n").flatMap(line => {
|
|
33
|
+
const m = line.match(/^([a-z_]+)="([^"\r\n]*)"$/);
|
|
34
|
+
return m ? [[m[1], m[2]]] : [];
|
|
35
|
+
}));
|
|
36
|
+
const payload = await listPayload(join(dir, "package.tgz"), findings);
|
|
37
|
+
const target = join(dir, "layout-inspection");
|
|
38
|
+
mkdirSync(target);
|
|
39
|
+
await tar.x({ file: join(dir, "package.tgz"), cwd: target });
|
|
40
|
+
findings.push(...inspectNativeLayout(dir, target, info));
|
|
41
|
+
for (const key of ["package", "version", "arch", "os_min_ver", "checksum"])
|
|
42
|
+
if (!info[key])
|
|
43
|
+
findings.push(`Missing INFO ${key}`);
|
|
44
|
+
return { kind: "native-layout", package: info.package, version: info.version, arch: info.arch, signed: existsSync(join(dir, "syno_signature.asc")), payload, findings };
|
|
45
|
+
}
|
|
20
46
|
const payload = await listPayload(join(dir, "package.tgz"), findings);
|
|
21
47
|
const paths = new Set(payload.map(entry => entry.path));
|
|
22
48
|
const kind = expectedKind ?? (paths.has(CGI_PAYLOAD_PATH) ? "native-go"
|
|
23
49
|
: paths.has("native.yaml") ? "binary" : paths.has("compose.yaml") ? "container" : "native-go");
|
|
24
|
-
const
|
|
50
|
+
const helperPayload = ["integration/helper", "integration/inventory.json", "integration/workers.json"].every(path => paths.has(path));
|
|
51
|
+
const identityPayload = [CGI_PAYLOAD_PATH, "integration/identity/app.mjs"].every(path => paths.has(path)) && (helperPayload || !paths.has("integration/helper"));
|
|
25
52
|
const info = readInfo(join(dir, "INFO"), findings, kind, identityPayload);
|
|
26
53
|
if (kind === "native-go" && paths.has("integration/helper") && info.precheckstartstop !== "yes") {
|
|
27
54
|
findings.push('integration INFO 必須明確設定 precheckstartstop="yes",否則 DSM 不執行 prestop');
|
|
28
55
|
}
|
|
29
|
-
|
|
56
|
+
await checkArch(dir, info, kind, paths.has(CGI_PAYLOAD_PATH), findings);
|
|
57
|
+
const background = kind === "native-go" && paths.has(BACKGROUND_WORKER_PAYLOAD);
|
|
58
|
+
const sharedFolder = kind === "native-go" ? recoverSharedFolder(readOptional(join(dir, "scripts/postinst"))) : undefined;
|
|
59
|
+
checkConf(dir, findings, kind, background, sharedFolder, info.package);
|
|
30
60
|
checkScripts(dir, findings);
|
|
61
|
+
if (kind === "native-go")
|
|
62
|
+
checkSharedFolder(dir, findings, info.package, sharedFolder);
|
|
63
|
+
checkUninstall(dir, findings);
|
|
64
|
+
if (kind === "container")
|
|
65
|
+
await checkContainerExposure(dir, join(dir, "package.tgz"), findings);
|
|
66
|
+
if (background)
|
|
67
|
+
checkBackground(dir, info, payload, findings);
|
|
31
68
|
if (kind === "native-go")
|
|
32
69
|
await checkDaemon(dir, info, paths, payload, findings);
|
|
33
70
|
let integration;
|
|
34
|
-
|
|
71
|
+
const integrationPaths = [...paths].filter(path => path.startsWith("integration/"));
|
|
72
|
+
if (integrationPaths.length > 0 && paths.has("integration/helper")) {
|
|
35
73
|
if (kind !== "native-go" || payload.find(p => p.path === "integration/helper")?.mode !== "0755")
|
|
36
74
|
findings.push("integration 必須有 native-go executable helper");
|
|
37
75
|
else if (!findings.length)
|
|
38
76
|
integration = await inspectHelper(dir, info, findings, paths.has("daemon/config.json"));
|
|
39
77
|
}
|
|
78
|
+
else if (integrationPaths.some(path => path !== "integration/identity/app.mjs")) {
|
|
79
|
+
findings.push("integration 沒有 helper 時只可附 integration/identity/app.mjs");
|
|
80
|
+
}
|
|
81
|
+
if (info.sdk_root_authorization === "2" || [...paths].some(path => path.startsWith("authorization/"))) {
|
|
82
|
+
if (info.sdk_root_authorization !== "2")
|
|
83
|
+
findings.push("root authorization INFO marker missing");
|
|
84
|
+
const authDir = join(dir, "authorization-inspection");
|
|
85
|
+
mkdirSync(authDir);
|
|
86
|
+
await tar.x({ file: join(dir, "package.tgz"), cwd: authDir });
|
|
87
|
+
findings.push(...inspectAuthorization(authDir, info.package, info.version));
|
|
88
|
+
if (payload.find(p => p.path === "authorization/bootstrap")?.mode !== "0755")
|
|
89
|
+
findings.push("authorization bootstrap must be executable");
|
|
90
|
+
}
|
|
40
91
|
const cgiEntry = payload.find((entry) => entry.path === CGI_PAYLOAD_PATH);
|
|
41
92
|
if (kind === "native-go" && !cgiEntry) {
|
|
42
93
|
findings.push(`payload 沒有 ${CGI_PAYLOAD_PATH}`);
|
|
@@ -60,6 +111,39 @@ export async function inspectSpk(spkPath, expectedKind) {
|
|
|
60
111
|
rmSync(dir, { recursive: true, force: true });
|
|
61
112
|
}
|
|
62
113
|
}
|
|
114
|
+
const OS_MIN_VER = /^7\.\d+(\.\d+)?-\d+$/;
|
|
115
|
+
/** INFO os_min_ver and arch must be values DSM accepts, and arch must match the shipped CGI. */
|
|
116
|
+
async function checkArch(dir, info, kind, hasCgi, findings) {
|
|
117
|
+
if (info.os_min_ver && !OS_MIN_VER.test(info.os_min_ver)) {
|
|
118
|
+
findings.push(`INFO os_min_ver「${info.os_min_ver}」不是 DSM 7 的 <版本>-<build>(例如 7.1-42661)`);
|
|
119
|
+
}
|
|
120
|
+
else if (kind === "container" && info.os_min_ver && !isDsmAtLeast(info.os_min_ver, CONTAINER_MIN_DSM)) {
|
|
121
|
+
findings.push(`INFO os_min_ver「${info.os_min_ver}」低於容器 App 需要的 DSM ${CONTAINER_MIN_DSM};docker-project/Container Manager 從 DSM 7.2.1 才有,在更早的 DSM 會安裝但無法啟動`);
|
|
122
|
+
}
|
|
123
|
+
const tokens = (info.arch ?? "").split(" ").filter(Boolean);
|
|
124
|
+
if (tokens.length === 0 || tokens.includes("noarch"))
|
|
125
|
+
return;
|
|
126
|
+
for (const token of tokens.filter(token => !familyOfArchToken(token))) {
|
|
127
|
+
findings.push(`INFO arch 含未知的 platform「${token}」`);
|
|
128
|
+
}
|
|
129
|
+
const families = new Set(tokens.map(familyOfArchToken).filter(family => family !== undefined));
|
|
130
|
+
if (families.size > 1) {
|
|
131
|
+
findings.push(`INFO arch 混用多個架構(${[...families].join("、")});一個 SPK 只含一種架構的 binary`);
|
|
132
|
+
}
|
|
133
|
+
if (kind !== "native-go" || !hasCgi || families.size !== 1)
|
|
134
|
+
return;
|
|
135
|
+
const [declared] = families;
|
|
136
|
+
const cgi = join(dir, "cgi-inspection");
|
|
137
|
+
mkdirSync(cgi);
|
|
138
|
+
// Only the header is read; the CGI is never run.
|
|
139
|
+
await tar.x({ file: join(dir, "package.tgz"), cwd: cgi, filter: path => path.replace(/^\.\//, "") === CGI_PAYLOAD_PATH });
|
|
140
|
+
const header = readFileSync(join(cgi, CGI_PAYLOAD_PATH)).subarray(0, 20);
|
|
141
|
+
const machine = header.length === 20 && header.toString("latin1", 0, 4) === "\x7fELF" ? header.readUInt16LE(18) : undefined;
|
|
142
|
+
const actual = NATIVE_ARCH_FAMILIES.find(family => ELF_MACHINE[family] === machine);
|
|
143
|
+
if (actual && actual !== declared) {
|
|
144
|
+
findings.push(`INFO arch 宣告 ${declared},但 ${CGI_PAYLOAD_PATH} 是 ${actual} 的執行檔`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
63
147
|
async function checkDaemon(dir, info, paths, payload, findings) {
|
|
64
148
|
if (![...paths].some(path => path.startsWith("daemon/")))
|
|
65
149
|
return;
|
|
@@ -81,7 +165,7 @@ async function checkDaemon(dir, info, paths, payload, findings) {
|
|
|
81
165
|
throw new Error("invalid config");
|
|
82
166
|
if (payload.find(p => p.path === `daemon/payload/${daemon.exec}`)?.mode !== "0755")
|
|
83
167
|
throw new Error("missing executable");
|
|
84
|
-
const manifest = { package: info.package, daemon, ...(paths.has("integration/helper") ? { integration: {} } : {}) };
|
|
168
|
+
const manifest = { package: info.package, daemon, ...(paths.has("integration/helper") ? { integration: {}, privilege: "root" } : {}) };
|
|
85
169
|
if (readFileSync(join(unpacked, "daemon/config.json"), "utf8") !== daemonConfig(manifest))
|
|
86
170
|
throw new Error("non-canonical daemon config");
|
|
87
171
|
for (const hook of ["start-stop-status", "preupgrade", "preuninst"]) {
|
|
@@ -121,11 +205,34 @@ function readInfo(path, findings, kind, identityPayload) {
|
|
|
121
205
|
}
|
|
122
206
|
return info;
|
|
123
207
|
}
|
|
124
|
-
|
|
208
|
+
/** A container App must not be reachable without DSM sign-in: loopback ports only, no anonymous portal. */
|
|
209
|
+
async function checkContainerExposure(dir, packageTgz, findings) {
|
|
210
|
+
const extracted = join(dir, "payload");
|
|
211
|
+
mkdirSync(extracted);
|
|
212
|
+
await tar.x({ file: packageTgz, cwd: extracted, filter: path => path.replace(/^\.\//, "") === "compose.yaml" });
|
|
213
|
+
const compose = loadCompose(join(extracted, "compose.yaml"))?.compose;
|
|
214
|
+
for (const exposure of compose ? listPortExposures(compose).filter(e => !e.loopbackOnly) : []) {
|
|
215
|
+
findings.push(`CONTAINER_PORT_EXPOSED ${exposure.service}: ${exposure.entry} 綁在所有網路介面,可不經 DSM 驗證直接連線;請改綁 127.0.0.1`);
|
|
216
|
+
}
|
|
217
|
+
try {
|
|
218
|
+
if (JSON.parse(readFileSync(join(dir, "conf", "resource"), "utf8")).webservice) {
|
|
219
|
+
findings.push("CONTAINER_ANONYMOUS_PORTAL conf/resource 註冊了 Web Station portal,任何人不需登入 DSM 即可開啟(integration.web.access: public)");
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
catch { /* checkConf already reports an unreadable conf/resource */ }
|
|
223
|
+
}
|
|
224
|
+
function readOptional(path) {
|
|
225
|
+
return existsSync(path) ? readFileSync(path, "utf8") : undefined;
|
|
226
|
+
}
|
|
227
|
+
function checkConf(dir, findings, kind, background, sharedFolder, pkg) {
|
|
125
228
|
const confDir = join(dir, "conf");
|
|
126
229
|
const entries = existsSync(confDir) ? readdirSync(confDir) : [];
|
|
230
|
+
const nativeResource = kind === "native-go" ? renderStandaloneResource({ package: pkg ?? "", ...(background ? { background: { worker: "sha256-v1" } } : {}), ...(sharedFolder ? { sharedFolder } : {}) }) : undefined;
|
|
231
|
+
if (nativeResource !== undefined && readOptional(join(confDir, "resource")) !== nativeResource) {
|
|
232
|
+
findings.push(`conf/resource 必須是 ${nativeResource}(只有官方 data-share 與 systemd-user-unit,且與 install.sharedFolder 宣告一致)`);
|
|
233
|
+
}
|
|
127
234
|
for (const name of entries) {
|
|
128
|
-
if (name !== "privilege" && !(kind === "container" && name === "resource")) {
|
|
235
|
+
if (name !== "privilege" && !(kind === "container" && name === "resource") && !(nativeResource !== undefined && name === "resource") && !(background && name === "systemd")) {
|
|
129
236
|
findings.push(`conf/${name} 會向 DSM 註冊額外資源;Standalone Package 不產生它`);
|
|
130
237
|
}
|
|
131
238
|
}
|
|
@@ -165,6 +272,57 @@ function checkConf(dir, findings, kind) {
|
|
|
165
272
|
}
|
|
166
273
|
}
|
|
167
274
|
}
|
|
275
|
+
/** The opt-in package user unit must be exactly what the generator writes. */
|
|
276
|
+
function checkBackground(dir, info, payload, findings) {
|
|
277
|
+
const pkg = info.package;
|
|
278
|
+
if (!pkg)
|
|
279
|
+
return;
|
|
280
|
+
const read = (path) => existsSync(join(dir, path)) ? readFileSync(join(dir, path), "utf8") : undefined;
|
|
281
|
+
if (payload.find(p => p.path === BACKGROUND_WORKER_PAYLOAD)?.mode !== "0755")
|
|
282
|
+
findings.push(`${BACKGROUND_WORKER_PAYLOAD} 缺少或非 executable`);
|
|
283
|
+
const units = existsSync(join(dir, BACKGROUND_UNIT_DIR)) ? readdirSync(join(dir, BACKGROUND_UNIT_DIR)) : [];
|
|
284
|
+
const unit = backgroundUnitName(pkg);
|
|
285
|
+
if (units.length !== 1 || units[0] !== unit || read(`${BACKGROUND_UNIT_DIR}/${unit}`) !== renderBackgroundUnit(pkg)) {
|
|
286
|
+
findings.push(`${BACKGROUND_UNIT_DIR} 必須只有固定的 ${unit}(套件帳號執行,無 User=、無 root)`);
|
|
287
|
+
}
|
|
288
|
+
if (read("scripts/start-stop-status") !== renderBackgroundControl(pkg))
|
|
289
|
+
findings.push("background scripts/start-stop-status 與固定 synosystemctl lifecycle 不符");
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* `install.sharedFolder` is recovered from the postinst marker. The install
|
|
293
|
+
* and upgrade wizards must then be exactly what the generator writes for that
|
|
294
|
+
* declaration (without one, any present file must be the default native
|
|
295
|
+
* install wizard), and no other install/upgrade wizard file may exist.
|
|
296
|
+
*/
|
|
297
|
+
function checkSharedFolder(dir, findings, pkg, folder) {
|
|
298
|
+
const wizardDir = join(dir, "WIZARD_UIFILES");
|
|
299
|
+
const present = (existsSync(wizardDir) ? readdirSync(wizardDir) : []).filter(name => /^(install|upgrade)_uifile(_|\.|$)/.test(name)).sort();
|
|
300
|
+
const postinst = readOptional(join(dir, "scripts/postinst"));
|
|
301
|
+
if (!folder && postinst?.includes(SHARED_FOLDER_MARKER))
|
|
302
|
+
findings.push("scripts/postinst 的 install.sharedFolder 宣告無效");
|
|
303
|
+
if (!pkg)
|
|
304
|
+
return;
|
|
305
|
+
const wizards = expectedWizardFiles(pkg, folder);
|
|
306
|
+
const source = folder ? "install.sharedFolder 宣告" : "native-go 預設安裝精靈";
|
|
307
|
+
// The default native wizard is optional; a declared shared folder needs all of its files.
|
|
308
|
+
for (const name of folder ? Object.keys(wizards) : present.filter(n => n in wizards)) {
|
|
309
|
+
if (readOptional(join(wizardDir, name)) !== wizards[name])
|
|
310
|
+
findings.push(`WIZARD_UIFILES/${name} 與${source}不符`);
|
|
311
|
+
}
|
|
312
|
+
for (const name of present.filter(n => !(n in wizards)))
|
|
313
|
+
findings.push(`WIZARD_UIFILES/${name} 不是${source}產生的精靈檔`);
|
|
314
|
+
if (!folder)
|
|
315
|
+
return;
|
|
316
|
+
for (const hook of ["postinst", "postupgrade"]) {
|
|
317
|
+
if (readOptional(join(dir, "scripts", hook)) !== renderStandaloneScript(hook, { package: pkg, sharedFolder: folder })) {
|
|
318
|
+
findings.push(`scripts/${hook} 與 install.sharedFolder 宣告的固定腳本不符`);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function expectedWizardFiles(pkg, folder) {
|
|
323
|
+
const install = renderInstallWizardFiles(pkg, folder ? sharedFolderInstallSteps(pkg, folder) : renderNativeInstallWizard);
|
|
324
|
+
return { ...install.static, ...install.dynamic, ...(folder ? renderSharedFolderUpgradeWizardFiles(pkg, folder) : {}) };
|
|
325
|
+
}
|
|
168
326
|
function checkScripts(dir, findings) {
|
|
169
327
|
const scriptsDir = join(dir, "scripts");
|
|
170
328
|
if (!existsSync(join(scriptsDir, "start-stop-status"))) {
|
|
@@ -177,6 +335,52 @@ function checkScripts(dir, findings) {
|
|
|
177
335
|
}
|
|
178
336
|
}
|
|
179
337
|
}
|
|
338
|
+
const DATA_KEYS = ["pkgwizard_remove_additional", "delete_app_data"];
|
|
339
|
+
const DELETE_COMMAND = /\brm\s+-[a-zA-Z]*[rR]|\bfind\b[^\n]*(-delete|-exec\s+rm)/;
|
|
340
|
+
const UPGRADE_GUARD = /SYNOPKG_PKG_STATUS[^\n]*!=\s*"?UPGRADE"?/;
|
|
341
|
+
function uninstallBoxes(file) {
|
|
342
|
+
try {
|
|
343
|
+
const steps = JSON.parse(readFileSync(file, "utf8"));
|
|
344
|
+
return steps.flatMap(step => step.items ?? []).flatMap(item => item.subitems ?? []).filter(box => DATA_KEYS.includes(box.key));
|
|
345
|
+
}
|
|
346
|
+
catch {
|
|
347
|
+
return [];
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Deleting app data on uninstall is only safe when it is opt-in, skipped on
|
|
352
|
+
* upgrade (DSM replays postuninst for the old version) and confined to this
|
|
353
|
+
* package's own `/volumeN/@app*` directories; the wizard and the script must
|
|
354
|
+
* agree on the box that asks for it.
|
|
355
|
+
*/
|
|
356
|
+
function checkUninstall(dir, findings) {
|
|
357
|
+
const script = join(dir, "scripts", "postuninst");
|
|
358
|
+
if (!existsSync(script))
|
|
359
|
+
return;
|
|
360
|
+
const body = readFileSync(script, "utf8");
|
|
361
|
+
const wizardDir = join(dir, "WIZARD_UIFILES");
|
|
362
|
+
const wizards = existsSync(wizardDir) ? readdirSync(wizardDir).filter(name => name === "uninstall_uifile" || name.startsWith("uninstall_uifile_")).sort() : [];
|
|
363
|
+
const boxes = wizards.flatMap(name => uninstallBoxes(join(wizardDir, name)).map(box => ({ ...box, name })));
|
|
364
|
+
const deletes = DELETE_COMMAND.test(body);
|
|
365
|
+
if (deletes) {
|
|
366
|
+
if (!UPGRADE_GUARD.test(body))
|
|
367
|
+
findings.push('UNINSTALL_NO_UPGRADE_GUARD scripts/postuninst 刪除資料但沒有 [ "$SYNOPKG_PKG_STATUS" != UPGRADE ] 防護,升級時會誤刪');
|
|
368
|
+
if (!/is_package_area\(\)\s*\{/.test(body) || !/if ! is_package_area "\$real"/.test(body))
|
|
369
|
+
findings.push("UNINSTALL_UNSAFE_DELETE scripts/postuninst 刪除的路徑沒有驗證落在 /volumeN/@appdata|@apphome|@appstore/<package>;變數為空或指向別處時會刪錯資料");
|
|
370
|
+
for (const line of body.split("\n").filter(l => DELETE_COMMAND.test(l))) {
|
|
371
|
+
for (const path of line.match(/\/volume\w*\/(?!@app(data|home|store)\/)[^\s"'$;]*/g) ?? [])
|
|
372
|
+
findings.push(`UNINSTALL_UNSAFE_DELETE scripts/postuninst 刪除 ${path},不在套件自己的 @app* 目錄內`);
|
|
373
|
+
}
|
|
374
|
+
if (!boxes.some(box => box.name === "uninstall_uifile"))
|
|
375
|
+
findings.push("UNINSTALL_WIZARD_MISSING postuninst 會刪除資料,但 WIZARD_UIFILES/uninstall_uifile 沒有 pkgwizard_remove_additional 勾選框,使用者無法選擇");
|
|
376
|
+
}
|
|
377
|
+
for (const box of boxes) {
|
|
378
|
+
if (box.defaultValue !== false)
|
|
379
|
+
findings.push(`UNINSTALL_WIZARD_DEFAULT_CHECKED WIZARD_UIFILES/${box.name} 的 ${box.key} 預設必須不勾(保留資料)`);
|
|
380
|
+
if (!body.includes(box.key))
|
|
381
|
+
findings.push(`UNINSTALL_WIZARD_NOT_HONOURED WIZARD_UIFILES/${box.name} 提供 ${box.key} 勾選框,但 scripts/postuninst 沒有讀它`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
180
384
|
async function listPayload(packageTgz, findings) {
|
|
181
385
|
if (!existsSync(packageTgz)) {
|
|
182
386
|
findings.push("缺少 package.tgz");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatJobDiagnostic(raw: string | Uint8Array): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { strictJSON } from './worker-contract-json.js';
|
|
2
|
+
const WORKER_SAFE_REASONS = ['invalid-request', 'incompatible', 'unsupported', 'replay', 'stale', 'expired', 'denied', 'unavailable', 'suspended', 'revoked', 'fenced', 'busy', 'limit-exceeded', 'canceled', 'timeout', 'partial', 'commit-uncertain', 'cleanup-required', 'internal'];
|
|
3
|
+
// S5 formatter only: no command registration, network, SSH or raw-log reader.
|
|
4
|
+
// Reject the whole projection on schema/serializer failure; never echo input.
|
|
5
|
+
export function formatJobDiagnostic(raw) {
|
|
6
|
+
try {
|
|
7
|
+
const record = (value, required, optional = []) => {
|
|
8
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
9
|
+
throw 0;
|
|
10
|
+
const o = value;
|
|
11
|
+
if (required.some(k => !Object.hasOwn(o, k)) || Object.keys(o).some(k => !required.includes(k) && !optional.includes(k)))
|
|
12
|
+
throw 0;
|
|
13
|
+
return o;
|
|
14
|
+
};
|
|
15
|
+
const d = record(strictJSON(raw, 32768), ['diagnosticSchema', 'availability', 'jobs', 'total', 'truncated']);
|
|
16
|
+
if (d.diagnosticSchema !== 1 || d.availability !== 'unavailable' || !Array.isArray(d.jobs) || d.jobs.length > 10 || !Number.isSafeInteger(d.total) || d.total < d.jobs.length || d.total > 256 || typeof d.truncated !== 'boolean' || d.truncated !== (d.total > d.jobs.length))
|
|
17
|
+
throw 0;
|
|
18
|
+
const aliases = new Set();
|
|
19
|
+
const jobs = d.jobs.map(value => {
|
|
20
|
+
const j = record(value, ['alias', 'state', 'cancelRequested', 'drained', 'effectsUnknown'], ['safeReason']);
|
|
21
|
+
if (typeof j.alias !== 'string' || !/^[a-f0-9]{64}$/.test(j.alias) || !['pending', 'running', 'cancel-requested', 'draining', 'succeeded', 'failed', 'canceled', 'interrupted', 'cleanup-required'].includes(j.state))
|
|
22
|
+
throw 0;
|
|
23
|
+
if (['cancelRequested', 'drained', 'effectsUnknown'].some(k => typeof j[k] !== 'boolean'))
|
|
24
|
+
throw 0;
|
|
25
|
+
if (j.safeReason !== undefined && !WORKER_SAFE_REASONS.includes(j.safeReason))
|
|
26
|
+
throw 0;
|
|
27
|
+
if (aliases.has(j.alias))
|
|
28
|
+
throw 0;
|
|
29
|
+
aliases.add(j.alias);
|
|
30
|
+
if (j.state === 'succeeded' && (!j.drained || j.cancelRequested || j.effectsUnknown || j.safeReason !== undefined))
|
|
31
|
+
throw 0;
|
|
32
|
+
if (['pending', 'running'].includes(j.state) && (j.drained || j.cancelRequested))
|
|
33
|
+
throw 0;
|
|
34
|
+
if (['cancel-requested', 'draining'].includes(j.state) && (!j.cancelRequested || j.drained))
|
|
35
|
+
throw 0;
|
|
36
|
+
if (j.state === 'cleanup-required' && (j.drained || j.safeReason !== 'cleanup-required'))
|
|
37
|
+
throw 0;
|
|
38
|
+
if (['failed', 'interrupted', 'canceled'].includes(j.state) && j.safeReason === undefined)
|
|
39
|
+
throw 0;
|
|
40
|
+
if (j.state === 'canceled' && !j.cancelRequested)
|
|
41
|
+
throw 0;
|
|
42
|
+
return { alias: j.alias, state: j.state, ...(j.safeReason === undefined ? {} : { safeReason: j.safeReason }), cancelRequested: j.cancelRequested, drained: j.drained, effectsUnknown: j.effectsUnknown };
|
|
43
|
+
});
|
|
44
|
+
return JSON.stringify({ diagnosticSchema: 1, availability: 'unavailable', jobs, total: d.total, truncated: d.truncated }) + '\n';
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return '{"safeReason":"invalid-request"}\n';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Non-privileged management veto shared by the generated package hooks. */
|
|
2
|
-
export declare function renderHelperStoppedCheck(packageId: string): string;
|
|
2
|
+
export declare function renderHelperStoppedCheck(packageId: string, revoke?: boolean): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Non-privileged management veto shared by the generated package hooks. */
|
|
2
|
-
export function renderHelperStoppedCheck(packageId) {
|
|
3
|
-
return `/var/packages/${packageId}/target/integration/helper check-stopped || {
|
|
2
|
+
export function renderHelperStoppedCheck(packageId, revoke = false) {
|
|
3
|
+
return `${revoke ? `/var/packages/${packageId}/target/integration/helper revoke && ` : ''}/var/packages/${packageId}/target/integration/helper check-stopped || {
|
|
4
4
|
message='Run the approved helper_teardown or helper_disable operation before stopping, upgrading or uninstalling.'
|
|
5
5
|
printf '%s\\n' "$message" >&2
|
|
6
6
|
if [ -n "\${SYNOPKG_TEMP_LOGFILE:-}" ]; then
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { StandaloneManifest } from "./manifest.js";
|
|
2
|
-
/**
|
|
2
|
+
/** Package-UID hooks: root auth withdraws via the trusted socket, then retains the stopped veto. */
|
|
3
3
|
export declare function renderStandaloneScript(name: string, manifest: StandaloneManifest): string;
|