@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
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
//go:build !synopkgland_sdk_workers
|
|
2
|
+
|
|
3
|
+
//line dsmapp/internal/helper/supervisor_linux.go:1
|
|
1
4
|
package helper
|
|
2
5
|
|
|
3
6
|
import (
|
|
@@ -88,7 +91,8 @@ func superviseLinux(c Client, binary string) error {
|
|
|
88
91
|
defer cancelWatcher()
|
|
89
92
|
go o.watch(watcher)
|
|
90
93
|
epoch := r.Lifecycle.Epoch
|
|
91
|
-
|
|
94
|
+
stopDiagnostics := startObserverDiagnostics(c, epoch, o.gate)
|
|
95
|
+
defer stopDiagnostics()
|
|
92
96
|
identity, err := inspectSupervisor(os.Getpid(), c.Expected)
|
|
93
97
|
if err != nil {
|
|
94
98
|
return err
|
|
@@ -147,7 +151,7 @@ func superviseLinux(c Client, binary string) error {
|
|
|
147
151
|
var code Code
|
|
148
152
|
grants, grantRepo, code = openSupervisorGrants(c, binary, cohort)
|
|
149
153
|
if code != "" {
|
|
150
|
-
o.gate.
|
|
154
|
+
o.gate.fenceStartup("grants-open", code)
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
fenceRetryExhausted := false
|
|
@@ -7,6 +7,8 @@ import (
|
|
|
7
7
|
"io"
|
|
8
8
|
"net"
|
|
9
9
|
"testing"
|
|
10
|
+
|
|
11
|
+
"github.com/godbus/dbus/v5"
|
|
10
12
|
)
|
|
11
13
|
|
|
12
14
|
type observerClosedReader struct{ *bytes.Reader }
|
|
@@ -33,18 +35,34 @@ func (s *observerTestStream) Write(p []byte) (int, error) {
|
|
|
33
35
|
}
|
|
34
36
|
func (s *observerTestStream) Close() error { return nil }
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
// Cover the dependency directly as well as the production recovery boundary.
|
|
39
|
+
// Canonical frames avoid EncodeTo's map-order-dependent header alignment.
|
|
40
|
+
func TestDBusClosedHeaderPaddingReturnsErrorWithoutPanic(t *testing.T) {
|
|
37
41
|
for _, order := range []binary.ByteOrder{binary.LittleEndian, binary.BigEndian} {
|
|
38
42
|
t.Run(order.String(), func(t *testing.T) {
|
|
39
43
|
packet, header := observerPaddedFrame(t, order)
|
|
44
|
+
defer func() {
|
|
45
|
+
if failure := recover(); failure != nil {
|
|
46
|
+
t.Fatalf("closed socket during header alignment panicked: %v", failure)
|
|
47
|
+
}
|
|
48
|
+
}()
|
|
49
|
+
msg, err := dbus.DecodeMessage(observerClosedReader{bytes.NewReader(packet[:header])})
|
|
50
|
+
if msg != nil || !errors.Is(err, net.ErrClosed) {
|
|
51
|
+
t.Fatalf("partial frame accepted or close error lost: %+v %v", msg, err)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
func TestObserverDBusFrameCloseReturnsError(t *testing.T) {
|
|
58
|
+
for _, order := range []binary.ByteOrder{binary.LittleEndian, binary.BigEndian} {
|
|
59
|
+
t.Run(order.String(), func(t *testing.T) {
|
|
60
|
+
packet, _ := observerPaddedFrame(t, order)
|
|
40
61
|
for end := 0; end < len(packet); end++ {
|
|
41
62
|
frame, err := readObserverDBusFrame(observerClosedReader{bytes.NewReader(packet[:end])})
|
|
42
63
|
if frame != nil || !errors.Is(err, net.ErrClosed) {
|
|
43
64
|
t.Fatalf("close at byte %d: partial frame %x error %v", end, frame, err)
|
|
44
65
|
}
|
|
45
|
-
if end == header && !errors.Is(err, errObserverDBusDecode) {
|
|
46
|
-
t.Fatal("fixture did not exercise upstream padding panic recovery")
|
|
47
|
-
}
|
|
48
66
|
}
|
|
49
67
|
})
|
|
50
68
|
}
|
|
@@ -17,6 +17,9 @@ import (
|
|
|
17
17
|
"github.com/godbus/dbus/v5"
|
|
18
18
|
)
|
|
19
19
|
|
|
20
|
+
const unitQueryTimeout = 500 * time.Millisecond
|
|
21
|
+
const unitProbeInterval = 250 * time.Millisecond
|
|
22
|
+
|
|
20
23
|
const systemdName = "org.freedesktop.systemd1"
|
|
21
24
|
const managerInterface = systemdName + ".Manager"
|
|
22
25
|
const unitInterface = systemdName + ".Unit"
|
|
@@ -222,7 +225,7 @@ func jobID(v dbus.Variant) (uint32, bool) {
|
|
|
222
225
|
}
|
|
223
226
|
|
|
224
227
|
func openUnitObserver(parent context.Context, i Inventory) (*unitObserver, error) {
|
|
225
|
-
ctx, cancel := context.WithTimeout(parent,
|
|
228
|
+
ctx, cancel := context.WithTimeout(parent, unitQueryTimeout)
|
|
226
229
|
defer cancel()
|
|
227
230
|
binding, err := installedBinding(i)
|
|
228
231
|
if err != nil {
|
|
@@ -309,7 +312,7 @@ func openUnitObserver(parent context.Context, i Inventory) (*unitObserver, error
|
|
|
309
312
|
}
|
|
310
313
|
|
|
311
314
|
func (o *unitObserver) watch(ctx context.Context) {
|
|
312
|
-
ticker := time.
|
|
315
|
+
ticker := time.NewTimer(unitProbeInterval)
|
|
313
316
|
defer ticker.Stop()
|
|
314
317
|
for {
|
|
315
318
|
select {
|
|
@@ -320,12 +323,13 @@ func (o *unitObserver) watch(ctx context.Context) {
|
|
|
320
323
|
o.gate.fenceObserver("observation-unavailable", observerEvent{Detail: "bus-context-done", ErrorClass: observerErrorClass(o.conn.Context().Err())})
|
|
321
324
|
return
|
|
322
325
|
case <-ticker.C:
|
|
323
|
-
probe, cancel := context.WithTimeout(ctx,
|
|
326
|
+
probe, cancel := context.WithTimeout(ctx, unitQueryTimeout)
|
|
324
327
|
err := o.reconcile(probe)
|
|
325
328
|
cancel()
|
|
326
329
|
if err != nil {
|
|
327
330
|
return
|
|
328
331
|
}
|
|
332
|
+
ticker.Reset(unitProbeInterval)
|
|
329
333
|
}
|
|
330
334
|
}
|
|
331
335
|
}
|
|
@@ -54,7 +54,8 @@ func (o *unitObserver) reconcile(ctx context.Context) error {
|
|
|
54
54
|
return o.reconcileSnapshot(ctx, o.snapshot)
|
|
55
55
|
}
|
|
56
56
|
func (o *unitObserver) reconcileSnapshot(ctx context.Context, query func(context.Context) (Binding, map[string]dbus.Variant, error)) error {
|
|
57
|
-
|
|
57
|
+
started := time.Now()
|
|
58
|
+
serial, ready := o.gate.unitProbe(started)
|
|
58
59
|
// Initial observation has no freshness baseline yet.
|
|
59
60
|
if !ready {
|
|
60
61
|
return nil
|
|
@@ -73,6 +74,9 @@ func (o *unitObserver) reconcileSnapshot(ctx context.Context, query func(context
|
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
o.gate.recordObserver(e)
|
|
77
|
+
if !definitive && errors.Is(err, context.DeadlineExceeded) && (e.Phase == "get-owner" || e.Phase == "get-unit" || e.Phase == "get-all") && o.gate.deferUnitDeadline(serial, started, time.Now(), e) {
|
|
78
|
+
return nil
|
|
79
|
+
}
|
|
76
80
|
if o.gate.failUnitProbe(serial, reason, definitive, time.Now(), e) {
|
|
77
81
|
return err
|
|
78
82
|
}
|
|
@@ -173,10 +173,7 @@ func (x *actorFileWriter) Commit(ctx context.Context) (MutationReceipt, Code) {
|
|
|
173
173
|
// the destination is ever performed, including failure/foreign replacement.
|
|
174
174
|
e := unix.Linkat(unix.AT_FDCWD, "/proc/self/fd/"+strconv.Itoa(int(x.file.Fd())), int(x.parent.data.Fd()), x.work.Segments[len(x.work.Segments)-1], unix.AT_SYMLINK_FOLLOW)
|
|
175
175
|
if e != nil {
|
|
176
|
-
|
|
177
|
-
return x.receipt, ErrDenied
|
|
178
|
-
}
|
|
179
|
-
return x.receipt, ErrUnsupported
|
|
176
|
+
return x.receipt, publishLinkError(e)
|
|
180
177
|
}
|
|
181
178
|
}
|
|
182
179
|
x.receipt.Published = true
|
|
@@ -192,6 +189,12 @@ func (x *actorFileWriter) Commit(ctx context.Context) (MutationReceipt, Code) {
|
|
|
192
189
|
x.receipt.Committed = true
|
|
193
190
|
return x.receipt, ""
|
|
194
191
|
}
|
|
192
|
+
func publishLinkError(err error) Code {
|
|
193
|
+
if errors.Is(err, unix.EEXIST) || errors.Is(err, unix.EACCES) {
|
|
194
|
+
return ErrDenied
|
|
195
|
+
}
|
|
196
|
+
return ErrUnsupported
|
|
197
|
+
}
|
|
195
198
|
func (x *actorFileWriter) Close() {
|
|
196
199
|
if x.closed {
|
|
197
200
|
return
|
|
@@ -8,6 +8,32 @@ import (
|
|
|
8
8
|
"testing"
|
|
9
9
|
)
|
|
10
10
|
|
|
11
|
+
func TestPublishLinkError(t *testing.T) {
|
|
12
|
+
for _, tc := range []struct {
|
|
13
|
+
err error
|
|
14
|
+
want Code
|
|
15
|
+
}{
|
|
16
|
+
{unix.EACCES, ErrDenied},
|
|
17
|
+
{unix.EEXIST, ErrDenied},
|
|
18
|
+
{unix.EPERM, ErrUnsupported},
|
|
19
|
+
{unix.ENOSYS, ErrUnsupported},
|
|
20
|
+
{unix.EOPNOTSUPP, ErrUnsupported},
|
|
21
|
+
{unix.EINVAL, ErrUnsupported},
|
|
22
|
+
{unix.ENOENT, ErrUnsupported},
|
|
23
|
+
{unix.EXDEV, ErrUnsupported},
|
|
24
|
+
{unix.EROFS, ErrUnsupported},
|
|
25
|
+
{unix.EIO, ErrUnsupported},
|
|
26
|
+
} {
|
|
27
|
+
t.Run(tc.err.Error(), func(t *testing.T) {
|
|
28
|
+
for _, err := range []error{tc.err, &os.LinkError{Op: "linkat", Old: "fixed-fd", New: "destination", Err: tc.err}} {
|
|
29
|
+
if got := publishLinkError(err); got != tc.want {
|
|
30
|
+
t.Errorf("publishLinkError(%v) = %s, want %s", err, got, tc.want)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
11
37
|
func TestWriteExclusivePartialAndNoForeignUnlink(t *testing.T) {
|
|
12
38
|
pin, root := readOnlyFixture(t)
|
|
13
39
|
w := writeWork{RootPath: root, Action: ActionCreate, Segments: []string{"new"}, MaxBytes: 10}
|
|
@@ -11,7 +11,7 @@ build: 1
|
|
|
11
11
|
displayname: __DISPLAY_NAME__
|
|
12
12
|
description: A native DSM package with a Go backend and a DSM window UI.
|
|
13
13
|
maintainer: Your Name
|
|
14
|
-
os_min_ver: "7.
|
|
14
|
+
os_min_ver: "7.1-42661"
|
|
15
15
|
|
|
16
16
|
# One SPK per architecture. Supported: x86_64, aarch64.
|
|
17
17
|
arches: [x86_64, aarch64]
|
|
@@ -35,7 +35,7 @@ ui:
|
|
|
35
35
|
# UI languages: i18n/messages/<locale>.json for en, zh-TW, zh-CN, ja, ko, de,
|
|
36
36
|
# fr, es and it (DSM's other languages fall back to English). build-spk checks
|
|
37
37
|
# that every language has the en.json keys and placeholders, and that the keys
|
|
38
|
-
# listed in the glossary use
|
|
38
|
+
# listed in the glossary use DSM's own wording.
|
|
39
39
|
i18n:
|
|
40
40
|
messages: i18n/messages
|
|
41
41
|
glossary: i18n/glossary.json
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
package app
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"context"
|
|
5
|
+
"crypto/sha256"
|
|
6
|
+
"dsmapp/internal/api"
|
|
7
|
+
"encoding/base64"
|
|
8
|
+
"encoding/hex"
|
|
9
|
+
"encoding/json"
|
|
10
|
+
"errors"
|
|
11
|
+
"io"
|
|
12
|
+
"net"
|
|
13
|
+
"net/http"
|
|
14
|
+
"net/url"
|
|
15
|
+
"os"
|
|
16
|
+
"strconv"
|
|
17
|
+
"strings"
|
|
18
|
+
"time"
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
// Compiled into the CGI. Package-owned JSON is never the source of trust.
|
|
22
|
+
type authorizationTask struct {
|
|
23
|
+
Op string `json:"op"`
|
|
24
|
+
Name string `json:"name"`
|
|
25
|
+
Header string `json:"header"`
|
|
26
|
+
Script string `json:"script"`
|
|
27
|
+
Output bool `json:"output"`
|
|
28
|
+
}
|
|
29
|
+
type authorizationBuild struct {
|
|
30
|
+
Schema int `json:"schema"`
|
|
31
|
+
Package string `json:"package"`
|
|
32
|
+
Version string `json:"version"`
|
|
33
|
+
Pin string `json:"bootstrapSha256"`
|
|
34
|
+
Inventory struct {
|
|
35
|
+
Files []struct {
|
|
36
|
+
Path string `json:"path"`
|
|
37
|
+
Size int64 `json:"size"`
|
|
38
|
+
Hash string `json:"sha256"`
|
|
39
|
+
} `json:"files"`
|
|
40
|
+
} `json:"inventory"`
|
|
41
|
+
Tasks []authorizationTask `json:"tasks"`
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
func (cfg Config) authorizationRoutes() []api.Route {
|
|
45
|
+
if cfg.RootAuthorization == "" {
|
|
46
|
+
return nil
|
|
47
|
+
}
|
|
48
|
+
return []api.Route{api.UserRequest("authorization.status", cfg.authorizationStatus), api.Admin("authorization.request", cfg.authorizationRequest), api.Admin("authorization.revoke", cfg.authorizationRevoke)}
|
|
49
|
+
}
|
|
50
|
+
func authorizationDocument(state string, reason any) any {
|
|
51
|
+
return map[string]any{"command": "authorization", "schema_version": 1, "state": state, "reason": reason}
|
|
52
|
+
}
|
|
53
|
+
func (cfg Config) authorizationPlan() (authorizationBuild, error) {
|
|
54
|
+
var p authorizationBuild
|
|
55
|
+
raw, decode := base64.StdEncoding.DecodeString(cfg.RootAuthorization)
|
|
56
|
+
if decode != nil || json.Unmarshal(raw, &p) != nil || p.Schema != 2 || p.Package != cfg.PackageID || p.Version != cfg.Version || len(p.Tasks) == 0 || len(p.Pin) != 64 {
|
|
57
|
+
return p, errors.New("invalid build authorization")
|
|
58
|
+
}
|
|
59
|
+
if b, e := hex.DecodeString(p.Pin); e != nil || len(b) != 32 {
|
|
60
|
+
return p, errors.New("invalid bootstrap pin")
|
|
61
|
+
}
|
|
62
|
+
return p, nil
|
|
63
|
+
}
|
|
64
|
+
func (cfg Config) authorizationRequest(_ context.Context, _ api.Caller, params json.RawMessage) (any, error) {
|
|
65
|
+
if e := decodeParams(params, &struct{}{}); e != nil {
|
|
66
|
+
return nil, e
|
|
67
|
+
}
|
|
68
|
+
p, e := cfg.authorizationPlan()
|
|
69
|
+
if e != nil {
|
|
70
|
+
return nil, e
|
|
71
|
+
}
|
|
72
|
+
if cfg.authorizationTrusted(p) != nil {
|
|
73
|
+
return nil, &api.Error{Code: "authorization_required", Message: "Build payload cannot be trusted; reinstall this package"}
|
|
74
|
+
}
|
|
75
|
+
ops := []string{}
|
|
76
|
+
for _, t := range p.Tasks {
|
|
77
|
+
if t.Op == "helper_enable" {
|
|
78
|
+
ops = []string{t.Op}
|
|
79
|
+
break
|
|
80
|
+
}
|
|
81
|
+
ops = append(ops, t.Op)
|
|
82
|
+
}
|
|
83
|
+
return map[string]any{"command": "authorization", "schema_version": 1, "phase": "plan", "operations": ops, "run": cfg.HelperInventory.Package != ""}, nil
|
|
84
|
+
}
|
|
85
|
+
func (cfg Config) authorizationRevoke(_ context.Context, _ api.Caller, params json.RawMessage) (any, error) {
|
|
86
|
+
if e := decodeParams(params, &struct{}{}); e != nil {
|
|
87
|
+
return nil, e
|
|
88
|
+
}
|
|
89
|
+
p, e := cfg.authorizationPlan()
|
|
90
|
+
if e != nil {
|
|
91
|
+
return nil, e
|
|
92
|
+
}
|
|
93
|
+
// Root task still pins bootstrap. Corrupt UI must not prevent safe cleanup.
|
|
94
|
+
ops := []string{}
|
|
95
|
+
purge := false
|
|
96
|
+
for _, t := range p.Tasks {
|
|
97
|
+
ops = append(ops, t.Op)
|
|
98
|
+
if cfg.HelperInventory.Package != "" && t.Op == "helper_purge" {
|
|
99
|
+
purge = true
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return map[string]any{"command": "authorization", "schema_version": 1, "phase": "plan", "operations": ops, "disable": cfg.HelperInventory.Package != "", "purge": purge}, nil
|
|
103
|
+
}
|
|
104
|
+
func (cfg Config) authorizationTrusted(p authorizationBuild) error {
|
|
105
|
+
root, e := os.OpenRoot("/var/packages/" + cfg.PackageID + "/target")
|
|
106
|
+
if e != nil {
|
|
107
|
+
return e
|
|
108
|
+
}
|
|
109
|
+
defer root.Close()
|
|
110
|
+
verify := func(path string, size int64, want string) error {
|
|
111
|
+
f, e := root.Open(path)
|
|
112
|
+
if e != nil {
|
|
113
|
+
return e
|
|
114
|
+
}
|
|
115
|
+
defer f.Close()
|
|
116
|
+
st, e := f.Stat()
|
|
117
|
+
if e != nil || !st.Mode().IsRegular() || st.Size() > 64<<20 || size >= 0 && st.Size() != size {
|
|
118
|
+
return errors.New("untrusted payload")
|
|
119
|
+
}
|
|
120
|
+
h := sha256.New()
|
|
121
|
+
_, e = io.Copy(h, io.LimitReader(f, (64<<20)+1))
|
|
122
|
+
if e != nil || hex.EncodeToString(h.Sum(nil)) != want {
|
|
123
|
+
return errors.New("untrusted payload")
|
|
124
|
+
}
|
|
125
|
+
return nil
|
|
126
|
+
}
|
|
127
|
+
if e = verify("authorization/bootstrap", -1, p.Pin); e != nil {
|
|
128
|
+
return e
|
|
129
|
+
}
|
|
130
|
+
for _, f := range p.Inventory.Files {
|
|
131
|
+
if e = verify(f.Path, f.Size, f.Hash); e != nil {
|
|
132
|
+
return e
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return nil
|
|
136
|
+
}
|
|
137
|
+
func (cfg Config) authorizationStatus(ctx context.Context, caller api.Caller, r *http.Request, params json.RawMessage) (any, error) {
|
|
138
|
+
if e := decodeParams(params, &struct{}{}); e != nil {
|
|
139
|
+
return nil, e
|
|
140
|
+
}
|
|
141
|
+
p, e := cfg.authorizationPlan()
|
|
142
|
+
if e != nil {
|
|
143
|
+
return authorizationDocument("unavailable", "service_unavailable"), nil
|
|
144
|
+
}
|
|
145
|
+
if cfg.authorizationTrusted(p) != nil {
|
|
146
|
+
return authorizationDocument("authorization_required", "helper_untrusted"), nil
|
|
147
|
+
}
|
|
148
|
+
if cfg.HelperInventory.Package != "" {
|
|
149
|
+
s := cfg.integrationState(ctx)
|
|
150
|
+
if s.State == "ready" {
|
|
151
|
+
return authorizationDocument("ready", nil), nil
|
|
152
|
+
}
|
|
153
|
+
if !caller.Admin() {
|
|
154
|
+
return authorizationDocument("not_admin", "not_admin"), nil
|
|
155
|
+
}
|
|
156
|
+
switch s.State {
|
|
157
|
+
case "incompatible":
|
|
158
|
+
return authorizationDocument("authorization_required", "grant_incompatible"), nil
|
|
159
|
+
case "pending":
|
|
160
|
+
return authorizationDocument("unavailable", "health_probe_timeout"), nil
|
|
161
|
+
case "failed":
|
|
162
|
+
return authorizationDocument("unavailable", "service_unavailable"), nil
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if !caller.Admin() {
|
|
166
|
+
return authorizationDocument("not_admin", "not_admin"), nil
|
|
167
|
+
}
|
|
168
|
+
state, reason := authorizationScheduler(ctx, r, p.Tasks)
|
|
169
|
+
if cfg.HelperInventory.Package != "" && state == "ready" {
|
|
170
|
+
state = "authorization_required"
|
|
171
|
+
reason = "grant_missing"
|
|
172
|
+
}
|
|
173
|
+
return authorizationDocument(state, reason), nil
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Read-only scheduler observations; never accept caller-selected URLs or task IDs.
|
|
177
|
+
// One modern probe; legacy fallback only for explicit missing method (103).
|
|
178
|
+
func authorizationScheduler(ctx context.Context, r *http.Request, tasks []authorizationTask) (string, any) {
|
|
179
|
+
return authorizationSchedulerAt(ctx, r, tasks, "http://127.0.0.1:5000")
|
|
180
|
+
}
|
|
181
|
+
func authorizationSchedulerAt(ctx context.Context, r *http.Request, tasks []authorizationTask, endpoint string) (string, any) {
|
|
182
|
+
tr := &http.Transport{Proxy: nil, DialContext: (&net.Dialer{Timeout: 3 * time.Second}).DialContext, DisableKeepAlives: true, DisableCompression: true, ResponseHeaderTimeout: 5 * time.Second, MaxResponseHeaderBytes: 32 << 10}
|
|
183
|
+
defer tr.CloseIdleConnections()
|
|
184
|
+
client := &http.Client{Transport: tr, Timeout: 8 * time.Second, CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
|
|
185
|
+
ctx, cancel := context.WithTimeout(ctx, 15*time.Second)
|
|
186
|
+
defer cancel()
|
|
187
|
+
call := func(method string, version int, params url.Values) (json.RawMessage, int, error) {
|
|
188
|
+
params.Set("api", "SYNO.Core.TaskScheduler")
|
|
189
|
+
params.Set("method", method)
|
|
190
|
+
params.Set("version", strconv.Itoa(version))
|
|
191
|
+
req, e := http.NewRequestWithContext(ctx, "GET", endpoint+"/webapi/entry.cgi?"+params.Encode(), nil)
|
|
192
|
+
if e != nil {
|
|
193
|
+
return nil, 0, e
|
|
194
|
+
}
|
|
195
|
+
cookies := r.CookiesNamed("id")
|
|
196
|
+
if len(cookies) != 1 {
|
|
197
|
+
return nil, 0, errors.New("session")
|
|
198
|
+
}
|
|
199
|
+
req.AddCookie(cookies[0])
|
|
200
|
+
req.Header.Set("X-SYNO-TOKEN", r.Header.Get("X-SYNO-TOKEN"))
|
|
201
|
+
response, e := client.Do(req)
|
|
202
|
+
if e != nil {
|
|
203
|
+
return nil, 0, e
|
|
204
|
+
}
|
|
205
|
+
defer response.Body.Close()
|
|
206
|
+
b, e := io.ReadAll(io.LimitReader(response.Body, (1<<20)+1))
|
|
207
|
+
if e != nil || len(b) > 1<<20 || response.StatusCode != 200 {
|
|
208
|
+
return nil, 0, errors.New("scheduler unavailable")
|
|
209
|
+
}
|
|
210
|
+
var wire struct {
|
|
211
|
+
Success bool `json:"success"`
|
|
212
|
+
Data json.RawMessage `json:"data"`
|
|
213
|
+
Error struct {
|
|
214
|
+
Code int `json:"code"`
|
|
215
|
+
} `json:"error"`
|
|
216
|
+
}
|
|
217
|
+
if json.Unmarshal(b, &wire) != nil {
|
|
218
|
+
return nil, 0, errors.New("scheduler schema")
|
|
219
|
+
}
|
|
220
|
+
if !wire.Success {
|
|
221
|
+
return nil, wire.Error.Code, errors.New("scheduler refused")
|
|
222
|
+
}
|
|
223
|
+
return wire.Data, 0, nil
|
|
224
|
+
}
|
|
225
|
+
data, code, e := call("list", 3, url.Values{"start": {"0"}, "limit": {"500"}})
|
|
226
|
+
legacy := code == 103
|
|
227
|
+
if legacy {
|
|
228
|
+
data, code, e = call("list", 2, url.Values{"offset": {"0"}, "limit": {"500"}})
|
|
229
|
+
}
|
|
230
|
+
if e != nil {
|
|
231
|
+
if code == 106 || code == 107 || code == 119 {
|
|
232
|
+
return "session_expired", "session_expired"
|
|
233
|
+
}
|
|
234
|
+
return "unavailable", "scheduler_unavailable"
|
|
235
|
+
}
|
|
236
|
+
type item struct {
|
|
237
|
+
ID json.Number `json:"id"`
|
|
238
|
+
Name string `json:"name"`
|
|
239
|
+
Owner string `json:"owner"`
|
|
240
|
+
RealOwner string `json:"real_owner"`
|
|
241
|
+
Enable *bool `json:"enable"`
|
|
242
|
+
Type string `json:"type"`
|
|
243
|
+
Extra struct {
|
|
244
|
+
Script string `json:"script"`
|
|
245
|
+
} `json:"extra"`
|
|
246
|
+
}
|
|
247
|
+
var list struct {
|
|
248
|
+
Tasks []item `json:"tasks"`
|
|
249
|
+
Total *int `json:"total"`
|
|
250
|
+
}
|
|
251
|
+
if json.Unmarshal(data, &list) != nil || list.Total == nil || *list.Total != len(list.Tasks) || len(list.Tasks) > 500 {
|
|
252
|
+
return "unavailable", "scheduler_unavailable"
|
|
253
|
+
}
|
|
254
|
+
for _, expected := range tasks {
|
|
255
|
+
// Helper control tasks are individually approved on demand. Enable is the
|
|
256
|
+
// activation anchor; live helper health remains required separately.
|
|
257
|
+
if strings.HasPrefix(expected.Op, "helper_") && expected.Op != "helper_enable" {
|
|
258
|
+
continue
|
|
259
|
+
}
|
|
260
|
+
var found *item
|
|
261
|
+
for n := range list.Tasks {
|
|
262
|
+
if list.Tasks[n].Name == expected.Name {
|
|
263
|
+
if found != nil {
|
|
264
|
+
return "authorization_required", "maintenance_task_mismatch"
|
|
265
|
+
}
|
|
266
|
+
found = &list.Tasks[n]
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if found == nil {
|
|
270
|
+
return "authorization_required", "grant_missing"
|
|
271
|
+
}
|
|
272
|
+
valid := func(t item) bool {
|
|
273
|
+
return t.Owner == "root" && t.RealOwner == "root" && t.Enable != nil && !*t.Enable && t.Type == "script"
|
|
274
|
+
}
|
|
275
|
+
if !valid(*found) {
|
|
276
|
+
return "authorization_required", "maintenance_task_mismatch"
|
|
277
|
+
}
|
|
278
|
+
version := 4
|
|
279
|
+
if legacy {
|
|
280
|
+
version = 3
|
|
281
|
+
}
|
|
282
|
+
detail, _, e := call("get", version, url.Values{"id": {string(found.ID)}, "real_owner": {"root"}})
|
|
283
|
+
if e != nil {
|
|
284
|
+
return "unavailable", "scheduler_unavailable"
|
|
285
|
+
}
|
|
286
|
+
var full item
|
|
287
|
+
if json.Unmarshal(detail, &full) != nil || full.ID != found.ID || full.Name != expected.Name || !valid(full) {
|
|
288
|
+
return "authorization_required", "maintenance_task_mismatch"
|
|
289
|
+
}
|
|
290
|
+
if full.Extra.Script != expected.Script {
|
|
291
|
+
if strings.HasPrefix(full.Extra.Script, expected.Header) {
|
|
292
|
+
return "authorization_required", "grant_incompatible"
|
|
293
|
+
}
|
|
294
|
+
return "authorization_required", "maintenance_task_mismatch"
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return "ready", nil
|
|
298
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
package app
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"context"
|
|
5
|
+
"dsmapp/internal/api"
|
|
6
|
+
"encoding/json"
|
|
7
|
+
"io"
|
|
8
|
+
"net/http"
|
|
9
|
+
"net/http/httptest"
|
|
10
|
+
"slices"
|
|
11
|
+
"testing"
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
func TestAuthorizationFailClosed(t *testing.T) {
|
|
15
|
+
cfg := Config{PackageID: "RootDemo", Version: "0.1.0-0001", RootAuthorization: `{"schema":2}`}
|
|
16
|
+
if _, e := cfg.authorizationPlan(); e == nil {
|
|
17
|
+
t.Fatal("accepted missing pin")
|
|
18
|
+
}
|
|
19
|
+
if _, e := cfg.authorizationRequest(context.Background(), api.Caller{}, json.RawMessage(`{"op":"arbitrary"}`)); e == nil {
|
|
20
|
+
t.Fatal("accepted arbitrary params")
|
|
21
|
+
}
|
|
22
|
+
if len((Config{}).authorizationRoutes()) != 0 {
|
|
23
|
+
t.Fatal("default registered root routes")
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
func TestAuthorizationDocuments(t *testing.T) {
|
|
27
|
+
for _, state := range []string{"ready", "authorization_required", "not_admin", "unavailable"} {
|
|
28
|
+
b, e := json.Marshal(authorizationDocument(state, nil))
|
|
29
|
+
if e != nil {
|
|
30
|
+
t.Fatal(e)
|
|
31
|
+
}
|
|
32
|
+
var d map[string]any
|
|
33
|
+
json.Unmarshal(b, &d)
|
|
34
|
+
if d["command"] != "authorization" || d["schema_version"] != float64(1) || d["state"] != state {
|
|
35
|
+
t.Fatal(string(b))
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
func TestSchedulerRejectsChangedTaskAndFallsBackOnlyOn103(t *testing.T) {
|
|
41
|
+
for _, legacy := range []bool{false, true} {
|
|
42
|
+
altered := false
|
|
43
|
+
var versions []string
|
|
44
|
+
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
45
|
+
q := r.URL.Query()
|
|
46
|
+
versions = append(versions, q.Get("method")+":"+q.Get("version"))
|
|
47
|
+
if q.Get("method") == "list" && q.Get("version") == "3" && legacy {
|
|
48
|
+
io.WriteString(w, `{"success":false,"error":{"code":103}}`)
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
script := "approved"
|
|
52
|
+
if altered {
|
|
53
|
+
script = "unapproved"
|
|
54
|
+
}
|
|
55
|
+
item := map[string]any{"id": 1, "name": "RootDemo root: whoami", "owner": "root", "real_owner": "root", "enable": false, "type": "script", "extra": map[string]string{"script": script}}
|
|
56
|
+
var data any = item
|
|
57
|
+
if q.Get("method") == "list" {
|
|
58
|
+
data = map[string]any{"tasks": []any{item}, "total": 1}
|
|
59
|
+
}
|
|
60
|
+
json.NewEncoder(w).Encode(map[string]any{"success": true, "data": data})
|
|
61
|
+
}))
|
|
62
|
+
request := httptest.NewRequest("POST", "/", nil)
|
|
63
|
+
request.AddCookie(&http.Cookie{Name: "id", Value: "fixture-session"})
|
|
64
|
+
tasks := []authorizationTask{{Op: "whoami", Name: "RootDemo root: whoami", Script: "approved", Header: "header"}}
|
|
65
|
+
state, _ := authorizationSchedulerAt(context.Background(), request, tasks, server.URL)
|
|
66
|
+
if state != "ready" {
|
|
67
|
+
t.Fatal(state)
|
|
68
|
+
}
|
|
69
|
+
if legacy && !slices.Contains(versions, "get:3") {
|
|
70
|
+
t.Fatal(versions)
|
|
71
|
+
}
|
|
72
|
+
if !legacy && slices.Contains(versions, "get:3") {
|
|
73
|
+
t.Fatal(versions)
|
|
74
|
+
}
|
|
75
|
+
altered = true
|
|
76
|
+
state, reason := authorizationSchedulerAt(context.Background(), request, tasks, server.URL)
|
|
77
|
+
if state != "authorization_required" || reason != "maintenance_task_mismatch" {
|
|
78
|
+
t.Fatal(state, reason)
|
|
79
|
+
}
|
|
80
|
+
server.Close()
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
func TestSchedulerPermissionFailureIsNotLegacyFallback(t *testing.T) {
|
|
84
|
+
calls := 0
|
|
85
|
+
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
86
|
+
calls++
|
|
87
|
+
io.WriteString(w, `{"success":false,"error":{"code":105}}`)
|
|
88
|
+
}))
|
|
89
|
+
defer server.Close()
|
|
90
|
+
request := httptest.NewRequest("POST", "/", nil)
|
|
91
|
+
request.AddCookie(&http.Cookie{Name: "id", Value: "fixture-session"})
|
|
92
|
+
state, _ := authorizationSchedulerAt(context.Background(), request, nil, server.URL)
|
|
93
|
+
if state != "unavailable" || calls != 1 {
|
|
94
|
+
t.Fatal(state, calls)
|
|
95
|
+
}
|
|
96
|
+
}
|