@synopackageland/cli 0.4.0 → 0.4.1
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/LICENSE +21 -0
- package/README.md +37 -0
- package/dist/build-spk/generator.js +3 -0
- package/dist/build-spk/notices.d.ts +5 -0
- package/dist/build-spk/notices.js +60 -0
- package/dist/cli.js +9 -2
- package/dist/error-registry.js +20 -0
- package/dist/init.d.ts +4 -0
- package/dist/init.js +20 -12
- package/dist/standalone/build.js +3 -1
- package/dist/standalone/daemon.d.ts +23 -0
- package/dist/standalone/daemon.js +114 -0
- package/dist/standalone/dsm-window.d.ts +1 -1
- package/dist/standalone/dsm-window.js +50 -10
- package/dist/standalone/helper-inventory.d.ts +16 -0
- package/dist/standalone/helper-inventory.js +2 -0
- package/dist/standalone/helper.d.ts +2 -12
- package/dist/standalone/helper.js +8 -7
- package/dist/standalone/host-adapter.d.ts +5 -0
- package/dist/standalone/host-adapter.js +148 -0
- package/dist/standalone/host-platform.d.ts +13 -0
- package/dist/standalone/host-platform.js +42 -0
- package/dist/standalone/host-types.d.ts +49 -0
- package/dist/standalone/host-types.js +1 -0
- package/dist/standalone/inspect-helper.d.ts +6 -0
- package/dist/standalone/inspect-helper.js +88 -0
- package/dist/standalone/inspect-spk.d.ts +2 -0
- package/dist/standalone/inspect-spk.js +49 -0
- package/dist/standalone/lifecycle-helper.d.ts +2 -0
- package/dist/standalone/lifecycle-helper.js +12 -0
- package/dist/standalone/lifecycle.d.ts +3 -0
- package/dist/standalone/lifecycle.js +53 -0
- package/dist/standalone/manifest.d.ts +2 -0
- package/dist/standalone/manifest.js +4 -1
- package/dist/standalone/reopen-events.d.ts +2 -0
- package/dist/standalone/reopen-events.js +28 -0
- package/dist/standalone/root-messages.js +9 -0
- package/dist/standalone/root-window.d.ts +4 -3
- package/dist/standalone/root-window.js +17 -5
- package/dist/standalone/spk.d.ts +4 -3
- package/dist/standalone/spk.js +20 -33
- package/dist/template-paths.d.ts +2 -0
- package/dist/template-paths.js +9 -0
- package/dist/templates/_daemon/fixture_linux_test.go +15 -0
- package/dist/templates/_daemon/fixture_other_test.go +7 -0
- package/dist/templates/_daemon/go.mod +3 -0
- package/dist/templates/_daemon/main.go +608 -0
- package/dist/templates/_daemon/main_test.go +242 -0
- package/dist/templates/_daemon/process_linux.go +55 -0
- package/dist/templates/_daemon/process_linux_test.go +161 -0
- package/dist/templates/_daemon/process_other.go +14 -0
- package/dist/templates/_daemon/testdata/child.go +41 -0
- package/dist/templates/_shared/GO-LICENSE +27 -0
- package/dist/templates/_shared/GO-PATENTS +22 -0
- package/dist/templates/_shared/LICENSES/TEMPLATE.txt +21 -0
- package/dist/templates/_shared/notice-overrides/index.json +14 -0
- package/dist/templates/_shared/notice-overrides/utils-0.4.2-LICENSE +21 -0
- package/dist/templates/_shared/notice-overrides/utils-0.5.0-LICENSE +21 -0
- package/dist/templates/_shared/third-party-notices.mjs +51 -0
- package/dist/templates/native-go/README.md +57 -1
- package/dist/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +59 -0
- package/dist/templates/native-go/backend/cmd/dsm-readonly-probe/main_linux.go +46 -0
- package/dist/templates/native-go/backend/go.mod +4 -0
- package/dist/templates/native-go/backend/go.sum +4 -0
- package/dist/templates/native-go/backend/internal/api/binary.go +154 -0
- package/dist/templates/native-go/backend/internal/api/binary_test.go +165 -0
- package/dist/templates/native-go/backend/internal/api/registry.go +14 -4
- package/dist/templates/native-go/backend/internal/api/server.go +4 -0
- package/dist/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +121 -0
- package/dist/templates/native-go/backend/internal/app/nas_refusal_test.go +46 -0
- package/dist/templates/native-go/backend/internal/app/routes.go +11 -0
- package/dist/templates/native-go/backend/internal/app/routes_test.go +10 -5
- package/dist/templates/native-go/backend/internal/dsmprobe/collector_linux.go +335 -0
- package/dist/templates/native-go/backend/internal/dsmprobe/collector_linux_test.go +41 -0
- package/dist/templates/native-go/backend/internal/dsmprobe/protocol.go +179 -0
- package/dist/templates/native-go/backend/internal/dsmprobe/protocol_test.go +29 -0
- package/dist/templates/native-go/backend/internal/helper/cohort.go +393 -0
- package/dist/templates/native-go/backend/internal/helper/cohort_publication.go +18 -0
- package/dist/templates/native-go/backend/internal/helper/cohort_publication_test.go +105 -0
- package/dist/templates/native-go/backend/internal/helper/cohort_test.go +372 -0
- package/dist/templates/native-go/backend/internal/helper/control.go +226 -21
- package/dist/templates/native-go/backend/internal/helper/control_test.go +10 -2
- package/dist/templates/native-go/backend/internal/helper/data_contract.go +242 -0
- package/dist/templates/native-go/backend/internal/helper/data_contract_test.go +51 -0
- package/dist/templates/native-go/backend/internal/helper/data_decode.go +184 -0
- package/dist/templates/native-go/backend/internal/helper/data_decode_pointer_test.go +30 -0
- package/dist/templates/native-go/backend/internal/helper/data_protocol.go +416 -0
- package/dist/templates/native-go/backend/internal/helper/data_protocol_test.go +449 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_acl_linux.go +139 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_acl_linux_test.go +121 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux.go +95 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux_test.go +56 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_bridge_linux.go +144 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_bridge_linux_test.go +89 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_home_linux.go +107 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_home_linux_test.go +82 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_probe_transport_linux.go +151 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_probe_transport_linux_test.go +66 -0
- package/dist/templates/native-go/backend/internal/helper/grant_authority.go +516 -0
- package/dist/templates/native-go/backend/internal/helper/grant_authority_contract.go +88 -0
- package/dist/templates/native-go/backend/internal/helper/grant_authority_test.go +510 -0
- package/dist/templates/native-go/backend/internal/helper/grant_cohort.go +389 -0
- package/dist/templates/native-go/backend/internal/helper/grant_cohort_test.go +239 -0
- package/dist/templates/native-go/backend/internal/helper/grant_delivery.go +49 -0
- package/dist/templates/native-go/backend/internal/helper/grant_delivery_methods.go +273 -0
- package/dist/templates/native-go/backend/internal/helper/grant_delivery_test.go +322 -0
- package/dist/templates/native-go/backend/internal/helper/grant_operation_contract.go +47 -0
- package/dist/templates/native-go/backend/internal/helper/grant_readonly_test.go +180 -0
- package/dist/templates/native-go/backend/internal/helper/grant_repository_linux.go +415 -0
- package/dist/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +468 -0
- package/dist/templates/native-go/backend/internal/helper/grant_rpc.go +147 -0
- package/dist/templates/native-go/backend/internal/helper/grant_rpc_test.go +51 -0
- package/dist/templates/native-go/backend/internal/helper/grant_snapshot.go +75 -0
- package/dist/templates/native-go/backend/internal/helper/grant_supervisor_linux.go +134 -0
- package/dist/templates/native-go/backend/internal/helper/grant_supervisor_linux_test.go +254 -0
- package/dist/templates/native-go/backend/internal/helper/lease.go +112 -0
- package/dist/templates/native-go/backend/internal/helper/lease_linux.go +44 -0
- package/dist/templates/native-go/backend/internal/helper/lease_other.go +8 -0
- package/dist/templates/native-go/backend/internal/helper/lifecycle.go +234 -0
- package/dist/templates/native-go/backend/internal/helper/lifecycle_test.go +473 -0
- package/dist/templates/native-go/backend/internal/helper/managed_pilot.go +284 -0
- package/dist/templates/native-go/backend/internal/helper/managed_pilot_repository_linux.go +74 -0
- package/dist/templates/native-go/backend/internal/helper/managed_pilot_repository_linux_test.go +40 -0
- package/dist/templates/native-go/backend/internal/helper/managed_pilot_test.go +210 -0
- package/dist/templates/native-go/backend/internal/helper/nas_shipped_refusal_linux_test.go +97 -0
- package/dist/templates/native-go/backend/internal/helper/native_discovery.go +79 -0
- package/dist/templates/native-go/backend/internal/helper/native_identity.go +89 -0
- package/dist/templates/native-go/backend/internal/helper/native_provider.go +159 -0
- package/dist/templates/native-go/backend/internal/helper/native_provider_test.go +421 -0
- package/dist/templates/native-go/backend/internal/helper/observation.go +204 -0
- package/dist/templates/native-go/backend/internal/helper/observation_health_test.go +115 -0
- package/dist/templates/native-go/backend/internal/helper/observation_reload_budget_test.go +117 -0
- package/dist/templates/native-go/backend/internal/helper/observation_test.go +196 -0
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic.go +109 -0
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_linux.go +76 -0
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +124 -0
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_test.go +98 -0
- package/dist/templates/native-go/backend/internal/helper/operation_bootstrap_linux.go +193 -0
- package/dist/templates/native-go/backend/internal/helper/operation_credentials_linux.go +56 -0
- package/dist/templates/native-go/backend/internal/helper/operation_linux.go +480 -0
- package/dist/templates/native-go/backend/internal/helper/operation_linux_test.go +528 -0
- package/dist/templates/native-go/backend/internal/helper/process_linux.go +11 -1
- package/dist/templates/native-go/backend/internal/helper/publication_test.go +178 -0
- package/dist/templates/native-go/backend/internal/helper/read_stream_cohort_linux_test.go +156 -0
- package/dist/templates/native-go/backend/internal/helper/read_transfer.go +40 -0
- package/dist/templates/native-go/backend/internal/helper/read_transfer_linux.go +109 -0
- package/dist/templates/native-go/backend/internal/helper/read_transfer_linux_test.go +118 -0
- package/dist/templates/native-go/backend/internal/helper/read_transfer_test.go +177 -0
- package/dist/templates/native-go/backend/internal/helper/readonly.go +105 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_admission.go +85 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_cohort_linux_test.go +253 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_linux_test.go +378 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_mount_linux.go +65 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_mount_proxy_linux.go +113 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_operations_linux.go +168 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_resolver_linux.go +241 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_test.go +40 -0
- package/dist/templates/native-go/backend/internal/helper/relaxed_identity.go +252 -0
- package/dist/templates/native-go/backend/internal/helper/relaxed_identity_contract.go +105 -0
- package/dist/templates/native-go/backend/internal/helper/relaxed_identity_test.go +406 -0
- package/dist/templates/native-go/backend/internal/helper/relaxed_invalidation.go +200 -0
- package/dist/templates/native-go/backend/internal/helper/repair.go +132 -0
- package/dist/templates/native-go/backend/internal/helper/repair_test.go +271 -0
- package/dist/templates/native-go/backend/internal/helper/s1r_actor_acl_linux_test.go +303 -0
- package/dist/templates/native-go/backend/internal/helper/s1r_actor_fixture_linux_test.go +184 -0
- package/dist/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +231 -0
- package/dist/templates/native-go/backend/internal/helper/s1r_fixture_contract_linux_test.go +18 -0
- package/dist/templates/native-go/backend/internal/helper/server_linux.go +44 -3
- package/dist/templates/native-go/backend/internal/helper/status.go +74 -11
- package/dist/templates/native-go/backend/internal/helper/status_test.go +83 -0
- package/dist/templates/native-go/backend/internal/helper/supervision.go +28 -5
- package/dist/templates/native-go/backend/internal/helper/supervisor_frame.go +76 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_frame_linux_test.go +69 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_frame_test.go +107 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_linux.go +187 -16
- package/dist/templates/native-go/backend/internal/helper/supervisor_linux_test.go +618 -7
- package/dist/templates/native-go/backend/internal/helper/supervisor_socket_eof_test.go +74 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_socket_test.go +45 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/create.json +23 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/frames.json +67 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/grant-store.json +52 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/intent.json +20 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/list.json +20 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/publish.json +20 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/read.json +22 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/stat.json +22 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/write-stream.json +22 -0
- package/dist/templates/native-go/backend/internal/helper/unit_connection.go +75 -0
- package/dist/templates/native-go/backend/internal/helper/unit_connection_linux_test.go +135 -0
- package/dist/templates/native-go/backend/internal/helper/unit_connection_test.go +133 -0
- package/dist/templates/native-go/backend/internal/helper/unit_frame_test.go +32 -0
- package/dist/templates/native-go/backend/internal/helper/unit_linux.go +364 -0
- package/dist/templates/native-go/backend/internal/helper/unit_linux_test.go +46 -0
- package/dist/templates/native-go/backend/internal/helper/unit_mechanisms_linux_test.go +217 -0
- package/dist/templates/native-go/backend/internal/helper/unit_padding_linux_test.go +178 -0
- package/dist/templates/native-go/backend/internal/helper/unit_query_linux.go +111 -0
- package/dist/templates/native-go/backend/internal/helper/unit_reload_linux_test.go +372 -0
- package/dist/templates/native-go/backend/internal/helper/unit_reload_sequence_linux_test.go +232 -0
- package/dist/templates/native-go/backend/internal/helper/write.go +77 -0
- package/dist/templates/native-go/backend/internal/helper/write_admission.go +260 -0
- package/dist/templates/native-go/backend/internal/helper/write_admission_test.go +135 -0
- package/dist/templates/native-go/backend/internal/helper/write_cohort_linux_test.go +218 -0
- package/dist/templates/native-go/backend/internal/helper/write_files_linux.go +202 -0
- package/dist/templates/native-go/backend/internal/helper/write_files_linux_test.go +199 -0
- package/dist/templates/native-go/backend/internal/helper/write_intent_linux.go +116 -0
- package/dist/templates/native-go/backend/internal/helper/write_intent_linux_test.go +74 -0
- package/dist/templates/native-go/backend/internal/helper/write_operation_linux.go +245 -0
- package/dist/templates/native-go/backend/internal/helper/write_test.go +53 -0
- package/dist/templates/native-go/ui/app.js +8 -1
- package/dist/templates/native-go-better-auth/node/build.mjs +2 -0
- package/dist/templates/native-go-vue/README.md +115 -1
- package/dist/templates/native-go-vue/frontend/DESIGN.md +1 -1
- package/dist/templates/native-go-vue/frontend/package-lock.json +132 -229
- package/dist/templates/native-go-vue/frontend/package.json +1 -1
- package/dist/templates/native-go-vue/frontend/src/App.vue +33 -6
- package/dist/templates/native-go-vue/frontend/src/context.ts +41 -2
- package/dist/templates/native-go-vue/frontend/src/main.ts +4 -1
- package/dist/templates/native-go-vue/frontend/src/nas/NasGrantSettings.vue +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/NasPathPicker.vue +106 -0
- package/dist/templates/native-go-vue/frontend/src/nas/NasUnavailable.vue +20 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/de.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/en.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/es.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/fr.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/it.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/ja.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/ko.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/zh-CN.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/zh-TW.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n.ts +38 -0
- package/dist/templates/native-go-vue/frontend/src/nas/mock-provider.ts +119 -0
- package/dist/templates/native-go-vue/frontend/src/nas/provider.ts +59 -0
- package/dist/templates/native-go-vue/frontend/src/nas/use-request.ts +27 -0
- package/dist/templates/native-go-vue/frontend/src/style.css +17 -0
- package/dist/templates/native-go-vue/frontend/test/apps.test.ts +44 -2
- package/dist/templates/native-go-vue/frontend/test/nas-provider.test.ts +81 -0
- package/dist/templates/native-go-vue/frontend/test/nas-request.test.ts +21 -0
- package/dist/templates/native-go-vue/frontend/test/nas-ui.test.ts +261 -0
- package/dist/templates/native-go-vue/frontend/tsconfig.json +1 -1
- package/dist/templates/native-go-vue/frontend/vite.config.ts +6 -4
- package/package.json +3 -2
- package/templates/_daemon/fixture_linux_test.go +15 -0
- package/templates/_daemon/fixture_other_test.go +7 -0
- package/templates/_daemon/go.mod +3 -0
- package/templates/_daemon/main.go +608 -0
- package/templates/_daemon/main_test.go +242 -0
- package/templates/_daemon/process_linux.go +55 -0
- package/templates/_daemon/process_linux_test.go +161 -0
- package/templates/_daemon/process_other.go +14 -0
- package/templates/_daemon/testdata/child.go +41 -0
- package/templates/_shared/GO-LICENSE +27 -0
- package/templates/_shared/GO-PATENTS +22 -0
- package/templates/_shared/LICENSES/TEMPLATE.txt +21 -0
- package/templates/_shared/notice-overrides/index.json +14 -0
- package/templates/_shared/notice-overrides/utils-0.4.2-LICENSE +21 -0
- package/templates/_shared/notice-overrides/utils-0.5.0-LICENSE +21 -0
- package/templates/_shared/third-party-notices.mjs +51 -0
- package/templates/native-go/README.md +57 -1
- package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +59 -0
- package/templates/native-go/backend/cmd/dsm-readonly-probe/main_linux.go +46 -0
- package/templates/native-go/backend/go.mod +4 -0
- package/templates/native-go/backend/go.sum +4 -0
- package/templates/native-go/backend/internal/api/binary.go +154 -0
- package/templates/native-go/backend/internal/api/binary_test.go +165 -0
- package/templates/native-go/backend/internal/api/registry.go +14 -4
- package/templates/native-go/backend/internal/api/server.go +4 -0
- package/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +121 -0
- package/templates/native-go/backend/internal/app/nas_refusal_test.go +46 -0
- package/templates/native-go/backend/internal/app/routes.go +11 -0
- package/templates/native-go/backend/internal/app/routes_test.go +10 -5
- package/templates/native-go/backend/internal/dsmprobe/collector_linux.go +335 -0
- package/templates/native-go/backend/internal/dsmprobe/collector_linux_test.go +41 -0
- package/templates/native-go/backend/internal/dsmprobe/protocol.go +179 -0
- package/templates/native-go/backend/internal/dsmprobe/protocol_test.go +29 -0
- package/templates/native-go/backend/internal/helper/cohort.go +393 -0
- package/templates/native-go/backend/internal/helper/cohort_publication.go +18 -0
- package/templates/native-go/backend/internal/helper/cohort_publication_test.go +105 -0
- package/templates/native-go/backend/internal/helper/cohort_test.go +372 -0
- package/templates/native-go/backend/internal/helper/control.go +226 -21
- package/templates/native-go/backend/internal/helper/control_test.go +10 -2
- package/templates/native-go/backend/internal/helper/data_contract.go +242 -0
- package/templates/native-go/backend/internal/helper/data_contract_test.go +51 -0
- package/templates/native-go/backend/internal/helper/data_decode.go +184 -0
- package/templates/native-go/backend/internal/helper/data_decode_pointer_test.go +30 -0
- package/templates/native-go/backend/internal/helper/data_protocol.go +416 -0
- package/templates/native-go/backend/internal/helper/data_protocol_test.go +449 -0
- package/templates/native-go/backend/internal/helper/dsm_acl_linux.go +139 -0
- package/templates/native-go/backend/internal/helper/dsm_acl_linux_test.go +121 -0
- package/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux.go +95 -0
- package/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux_test.go +56 -0
- package/templates/native-go/backend/internal/helper/dsm_bridge_linux.go +144 -0
- package/templates/native-go/backend/internal/helper/dsm_bridge_linux_test.go +89 -0
- package/templates/native-go/backend/internal/helper/dsm_home_linux.go +107 -0
- package/templates/native-go/backend/internal/helper/dsm_home_linux_test.go +82 -0
- package/templates/native-go/backend/internal/helper/dsm_probe_transport_linux.go +151 -0
- package/templates/native-go/backend/internal/helper/dsm_probe_transport_linux_test.go +66 -0
- package/templates/native-go/backend/internal/helper/grant_authority.go +516 -0
- package/templates/native-go/backend/internal/helper/grant_authority_contract.go +88 -0
- package/templates/native-go/backend/internal/helper/grant_authority_test.go +510 -0
- package/templates/native-go/backend/internal/helper/grant_cohort.go +389 -0
- package/templates/native-go/backend/internal/helper/grant_cohort_test.go +239 -0
- package/templates/native-go/backend/internal/helper/grant_delivery.go +49 -0
- package/templates/native-go/backend/internal/helper/grant_delivery_methods.go +273 -0
- package/templates/native-go/backend/internal/helper/grant_delivery_test.go +322 -0
- package/templates/native-go/backend/internal/helper/grant_operation_contract.go +47 -0
- package/templates/native-go/backend/internal/helper/grant_readonly_test.go +180 -0
- package/templates/native-go/backend/internal/helper/grant_repository_linux.go +415 -0
- package/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +468 -0
- package/templates/native-go/backend/internal/helper/grant_rpc.go +147 -0
- package/templates/native-go/backend/internal/helper/grant_rpc_test.go +51 -0
- package/templates/native-go/backend/internal/helper/grant_snapshot.go +75 -0
- package/templates/native-go/backend/internal/helper/grant_supervisor_linux.go +134 -0
- package/templates/native-go/backend/internal/helper/grant_supervisor_linux_test.go +254 -0
- package/templates/native-go/backend/internal/helper/lease.go +112 -0
- package/templates/native-go/backend/internal/helper/lease_linux.go +44 -0
- package/templates/native-go/backend/internal/helper/lease_other.go +8 -0
- package/templates/native-go/backend/internal/helper/lifecycle.go +234 -0
- package/templates/native-go/backend/internal/helper/lifecycle_test.go +473 -0
- package/templates/native-go/backend/internal/helper/managed_pilot.go +284 -0
- package/templates/native-go/backend/internal/helper/managed_pilot_repository_linux.go +74 -0
- package/templates/native-go/backend/internal/helper/managed_pilot_repository_linux_test.go +40 -0
- package/templates/native-go/backend/internal/helper/managed_pilot_test.go +210 -0
- package/templates/native-go/backend/internal/helper/nas_shipped_refusal_linux_test.go +97 -0
- package/templates/native-go/backend/internal/helper/native_discovery.go +79 -0
- package/templates/native-go/backend/internal/helper/native_identity.go +89 -0
- package/templates/native-go/backend/internal/helper/native_provider.go +159 -0
- package/templates/native-go/backend/internal/helper/native_provider_test.go +421 -0
- package/templates/native-go/backend/internal/helper/observation.go +204 -0
- package/templates/native-go/backend/internal/helper/observation_health_test.go +115 -0
- package/templates/native-go/backend/internal/helper/observation_reload_budget_test.go +117 -0
- package/templates/native-go/backend/internal/helper/observation_test.go +196 -0
- package/templates/native-go/backend/internal/helper/observer_diagnostic.go +109 -0
- package/templates/native-go/backend/internal/helper/observer_diagnostic_linux.go +76 -0
- package/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +124 -0
- package/templates/native-go/backend/internal/helper/observer_diagnostic_test.go +98 -0
- package/templates/native-go/backend/internal/helper/operation_bootstrap_linux.go +193 -0
- package/templates/native-go/backend/internal/helper/operation_credentials_linux.go +56 -0
- package/templates/native-go/backend/internal/helper/operation_linux.go +480 -0
- package/templates/native-go/backend/internal/helper/operation_linux_test.go +528 -0
- package/templates/native-go/backend/internal/helper/process_linux.go +11 -1
- package/templates/native-go/backend/internal/helper/publication_test.go +178 -0
- package/templates/native-go/backend/internal/helper/read_stream_cohort_linux_test.go +156 -0
- package/templates/native-go/backend/internal/helper/read_transfer.go +40 -0
- package/templates/native-go/backend/internal/helper/read_transfer_linux.go +109 -0
- package/templates/native-go/backend/internal/helper/read_transfer_linux_test.go +118 -0
- package/templates/native-go/backend/internal/helper/read_transfer_test.go +177 -0
- package/templates/native-go/backend/internal/helper/readonly.go +105 -0
- package/templates/native-go/backend/internal/helper/readonly_admission.go +85 -0
- package/templates/native-go/backend/internal/helper/readonly_cohort_linux_test.go +253 -0
- package/templates/native-go/backend/internal/helper/readonly_linux_test.go +378 -0
- package/templates/native-go/backend/internal/helper/readonly_mount_linux.go +65 -0
- package/templates/native-go/backend/internal/helper/readonly_mount_proxy_linux.go +113 -0
- package/templates/native-go/backend/internal/helper/readonly_operations_linux.go +168 -0
- package/templates/native-go/backend/internal/helper/readonly_resolver_linux.go +241 -0
- package/templates/native-go/backend/internal/helper/readonly_test.go +40 -0
- package/templates/native-go/backend/internal/helper/relaxed_identity.go +252 -0
- package/templates/native-go/backend/internal/helper/relaxed_identity_contract.go +105 -0
- package/templates/native-go/backend/internal/helper/relaxed_identity_test.go +406 -0
- package/templates/native-go/backend/internal/helper/relaxed_invalidation.go +200 -0
- package/templates/native-go/backend/internal/helper/repair.go +132 -0
- package/templates/native-go/backend/internal/helper/repair_test.go +271 -0
- package/templates/native-go/backend/internal/helper/s1r_actor_acl_linux_test.go +303 -0
- package/templates/native-go/backend/internal/helper/s1r_actor_fixture_linux_test.go +184 -0
- package/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +231 -0
- package/templates/native-go/backend/internal/helper/s1r_fixture_contract_linux_test.go +18 -0
- package/templates/native-go/backend/internal/helper/server_linux.go +44 -3
- package/templates/native-go/backend/internal/helper/status.go +74 -11
- package/templates/native-go/backend/internal/helper/status_test.go +83 -0
- package/templates/native-go/backend/internal/helper/supervision.go +28 -5
- package/templates/native-go/backend/internal/helper/supervisor_frame.go +76 -0
- package/templates/native-go/backend/internal/helper/supervisor_frame_linux_test.go +69 -0
- package/templates/native-go/backend/internal/helper/supervisor_frame_test.go +107 -0
- package/templates/native-go/backend/internal/helper/supervisor_linux.go +187 -16
- package/templates/native-go/backend/internal/helper/supervisor_linux_test.go +618 -7
- package/templates/native-go/backend/internal/helper/supervisor_socket_eof_test.go +74 -0
- package/templates/native-go/backend/internal/helper/supervisor_socket_test.go +45 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/create.json +23 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/frames.json +67 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/grant-store.json +52 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/intent.json +20 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/list.json +20 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/publish.json +20 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/read.json +22 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/stat.json +22 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/write-stream.json +22 -0
- package/templates/native-go/backend/internal/helper/unit_connection.go +75 -0
- package/templates/native-go/backend/internal/helper/unit_connection_linux_test.go +135 -0
- package/templates/native-go/backend/internal/helper/unit_connection_test.go +133 -0
- package/templates/native-go/backend/internal/helper/unit_frame_test.go +32 -0
- package/templates/native-go/backend/internal/helper/unit_linux.go +364 -0
- package/templates/native-go/backend/internal/helper/unit_linux_test.go +46 -0
- package/templates/native-go/backend/internal/helper/unit_mechanisms_linux_test.go +217 -0
- package/templates/native-go/backend/internal/helper/unit_padding_linux_test.go +178 -0
- package/templates/native-go/backend/internal/helper/unit_query_linux.go +111 -0
- package/templates/native-go/backend/internal/helper/unit_reload_linux_test.go +372 -0
- package/templates/native-go/backend/internal/helper/unit_reload_sequence_linux_test.go +232 -0
- package/templates/native-go/backend/internal/helper/write.go +77 -0
- package/templates/native-go/backend/internal/helper/write_admission.go +260 -0
- package/templates/native-go/backend/internal/helper/write_admission_test.go +135 -0
- package/templates/native-go/backend/internal/helper/write_cohort_linux_test.go +218 -0
- package/templates/native-go/backend/internal/helper/write_files_linux.go +202 -0
- package/templates/native-go/backend/internal/helper/write_files_linux_test.go +199 -0
- package/templates/native-go/backend/internal/helper/write_intent_linux.go +116 -0
- package/templates/native-go/backend/internal/helper/write_intent_linux_test.go +74 -0
- package/templates/native-go/backend/internal/helper/write_operation_linux.go +245 -0
- package/templates/native-go/backend/internal/helper/write_test.go +53 -0
- package/templates/native-go/ui/app.js +8 -1
- package/templates/native-go-better-auth/node/build.mjs +2 -0
- package/templates/native-go-vue/README.md +115 -1
- package/templates/native-go-vue/frontend/DESIGN.md +1 -1
- package/templates/native-go-vue/frontend/package-lock.json +132 -229
- package/templates/native-go-vue/frontend/package.json +1 -1
- package/templates/native-go-vue/frontend/src/App.vue +33 -6
- package/templates/native-go-vue/frontend/src/context.ts +41 -2
- package/templates/native-go-vue/frontend/src/main.ts +4 -1
- package/templates/native-go-vue/frontend/src/nas/NasGrantSettings.vue +74 -0
- package/templates/native-go-vue/frontend/src/nas/NasPathPicker.vue +106 -0
- package/templates/native-go-vue/frontend/src/nas/NasUnavailable.vue +20 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/de.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/en.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/es.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/fr.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/it.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/ja.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/ko.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/zh-CN.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/zh-TW.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n.ts +38 -0
- package/templates/native-go-vue/frontend/src/nas/mock-provider.ts +119 -0
- package/templates/native-go-vue/frontend/src/nas/provider.ts +59 -0
- package/templates/native-go-vue/frontend/src/nas/use-request.ts +27 -0
- package/templates/native-go-vue/frontend/src/style.css +17 -0
- package/templates/native-go-vue/frontend/test/apps.test.ts +44 -2
- package/templates/native-go-vue/frontend/test/nas-provider.test.ts +81 -0
- package/templates/native-go-vue/frontend/test/nas-request.test.ts +21 -0
- package/templates/native-go-vue/frontend/test/nas-ui.test.ts +261 -0
- package/templates/native-go-vue/frontend/tsconfig.json +1 -1
- package/templates/native-go-vue/frontend/vite.config.ts +6 -4
|
@@ -5,6 +5,7 @@ import { isNativeArchFamily } from "../build-spk/dsm-arch.js";
|
|
|
5
5
|
import { checkGlossary, isLocale, loadCatalogs } from "./i18n.js";
|
|
6
6
|
import { loadRootOps, ROOT_OPS_DIR } from "./root-ops.js";
|
|
7
7
|
import { readIntegration } from "./helper.js";
|
|
8
|
+
import { readDaemon } from "./daemon.js";
|
|
8
9
|
/**
|
|
9
10
|
* `dsm-package.yaml`: a Standalone Package, i.e. an unsigned native SPK that
|
|
10
11
|
* runs as its own DSM package account with a CGI backend and a DSM window UI.
|
|
@@ -12,7 +13,7 @@ import { readIntegration } from "./helper.js";
|
|
|
12
13
|
export const STANDALONE_MANIFEST = "dsm-package.yaml";
|
|
13
14
|
const KNOWN_FIELDS = new Set([
|
|
14
15
|
"schema", "package", "version", "build", "displayname", "description",
|
|
15
|
-
"maintainer", "os_min_ver", "arches", "backend", "ui", "privilege", "i18n", "integration",
|
|
16
|
+
"maintainer", "os_min_ver", "arches", "backend", "ui", "privilege", "i18n", "integration", "daemon",
|
|
16
17
|
]);
|
|
17
18
|
const I18N_FIELDS = new Set(["messages", "glossary", "info"]);
|
|
18
19
|
const INFO_TEXT_FIELDS = new Set(["displayname", "description"]);
|
|
@@ -102,6 +103,7 @@ function readManifest(raw, c) {
|
|
|
102
103
|
const maintainer = c.text(raw.maintainer, "maintainer");
|
|
103
104
|
const arches = readArches(raw.arches, c);
|
|
104
105
|
const backend = arches && readBackend(raw.backend, arches, c);
|
|
106
|
+
const daemon = arches && readDaemon(raw.daemon, c.root, arches, e => c.fail(e.code, e.message));
|
|
105
107
|
const integration = readIntegration(raw.integration, c.root, e => c.fail(e.code, e.message));
|
|
106
108
|
if (integration && (privilege !== "root" || backend?.kind !== "go" || rootOps?.some(op => op.name.startsWith("helper_")))) {
|
|
107
109
|
c.fail("STANDALONE_INTEGRATION_INVALID", "integration 需要 privilege: root 和 backend.go;helper_ 操作名稱保留給 generator。");
|
|
@@ -129,6 +131,7 @@ function readManifest(raw, c) {
|
|
|
129
131
|
privilege,
|
|
130
132
|
...(rootOps ? { rootOps } : {}),
|
|
131
133
|
...(integration ? { integration } : {}),
|
|
134
|
+
...(daemon ? { daemon } : {}),
|
|
132
135
|
};
|
|
133
136
|
}
|
|
134
137
|
function readRootOps(privilege, c) {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Wrapper-owned subscriptions; no dependency on native event names or Ext. */
|
|
2
|
+
export declare const REOPEN_EVENTS_RUNTIME = "\nfunction createReopenEvents() {\n var active = true, handlers = [];\n function subscribe(fn) {\n if (!active || typeof fn !== \"function\") return function () {};\n function handler() { if (active && fn) fn(); }\n function unsubscribe() {\n if (!fn) return;\n fn = null;\n var index = handlers.indexOf(handler);\n if (index !== -1) handlers.splice(index, 1);\n }\n handler.unsubscribe = unsubscribe;\n handlers.push(handler);\n return unsubscribe;\n }\n return {\n handlers: handlers,\n subscribe: subscribe,\n emit: function () { handlers.slice().forEach(function (handler) { handler(); }); },\n dispose: function () {\n active = false;\n handlers.slice().forEach(function (handler) { handler.unsubscribe(); });\n }\n };\n}\n";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Wrapper-owned subscriptions; no dependency on native event names or Ext. */
|
|
2
|
+
export const REOPEN_EVENTS_RUNTIME = `
|
|
3
|
+
function createReopenEvents() {
|
|
4
|
+
var active = true, handlers = [];
|
|
5
|
+
function subscribe(fn) {
|
|
6
|
+
if (!active || typeof fn !== "function") return function () {};
|
|
7
|
+
function handler() { if (active && fn) fn(); }
|
|
8
|
+
function unsubscribe() {
|
|
9
|
+
if (!fn) return;
|
|
10
|
+
fn = null;
|
|
11
|
+
var index = handlers.indexOf(handler);
|
|
12
|
+
if (index !== -1) handlers.splice(index, 1);
|
|
13
|
+
}
|
|
14
|
+
handler.unsubscribe = unsubscribe;
|
|
15
|
+
handlers.push(handler);
|
|
16
|
+
return unsubscribe;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
handlers: handlers,
|
|
20
|
+
subscribe: subscribe,
|
|
21
|
+
emit: function () { handlers.slice().forEach(function (handler) { handler(); }); },
|
|
22
|
+
dispose: function () {
|
|
23
|
+
active = false;
|
|
24
|
+
handlers.slice().forEach(function (handler) { handler.unsubscribe(); });
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
@@ -25,6 +25,7 @@ export const ROOT_MESSAGES = {
|
|
|
25
25
|
admin_only: "Only administrator accounts can perform this operation.",
|
|
26
26
|
uninstall_hint: "Before uninstalling this package, click Remove to delete its task from Task Scheduler.",
|
|
27
27
|
"error.root_conflict": "Rename or delete the task \"{name}\" in Task Scheduler, then click Retry.",
|
|
28
|
+
"error.root_cancelled": "Password confirmation was cancelled. No operation was run.",
|
|
28
29
|
"error.root_not_ready": "Authorize this operation first.",
|
|
29
30
|
"error.root_task_failed": "The task ended with an error. Check its history in Task Scheduler, then click Retry.",
|
|
30
31
|
"error.root_timeout": "The task did not finish in time. Check it in Task Scheduler, then click Retry.",
|
|
@@ -52,6 +53,7 @@ export const ROOT_MESSAGES = {
|
|
|
52
53
|
admin_only: "僅限管理員帳號允許執行此操作。",
|
|
53
54
|
uninstall_hint: "解除安裝此套件前,請按「移除」從任務排程表刪除它的任務。",
|
|
54
55
|
"error.root_conflict": "請在任務排程表中重新命名或刪除任務「{name}」,再按「重試」。",
|
|
56
|
+
"error.root_cancelled": "已取消密碼確認,未執行任何操作。",
|
|
55
57
|
"error.root_not_ready": "請先授權此操作。",
|
|
56
58
|
"error.root_task_failed": "任務執行失敗。請在任務排程表查看其記錄,再按「重試」。",
|
|
57
59
|
"error.root_timeout": "任務未在時限內完成。請在任務排程表確認後,再按「重試」。",
|
|
@@ -79,6 +81,7 @@ export const ROOT_MESSAGES = {
|
|
|
79
81
|
admin_only: "只有管理员帐户才能执行此操作。",
|
|
80
82
|
uninstall_hint: "卸载此套件前,请单击“删除”从任务计划中删除它的任务。",
|
|
81
83
|
"error.root_conflict": "请在任务计划中重命名或删除任务“{name}”,然后单击“重试”。",
|
|
84
|
+
"error.root_cancelled": "已取消密码确认,未执行任何操作。",
|
|
82
85
|
"error.root_not_ready": "请先授权此操作。",
|
|
83
86
|
"error.root_task_failed": "任务运行失败。请在任务计划中查看其记录,然后单击“重试”。",
|
|
84
87
|
"error.root_timeout": "任务未在时限内完成。请在任务计划中确认后单击“重试”。",
|
|
@@ -106,6 +109,7 @@ export const ROOT_MESSAGES = {
|
|
|
106
109
|
admin_only: "この操作を実行できるのは管理者アカウントのみです。",
|
|
107
110
|
uninstall_hint: "このパッケージをアンインストールする前に、「削除」をクリックしてタスク スケジューラーからタスクを削除してください。",
|
|
108
111
|
"error.root_conflict": "タスク スケジューラーでタスク「{name}」の名前を変更するか削除してから、「再試行」をクリックしてください。",
|
|
112
|
+
"error.root_cancelled": "パスワードの確認がキャンセルされました。操作は実行されていません。",
|
|
109
113
|
"error.root_not_ready": "先にこの操作を承認してください。",
|
|
110
114
|
"error.root_task_failed": "タスクがエラーで終了しました。タスク スケジューラーで履歴を確認してから、「再試行」をクリックしてください。",
|
|
111
115
|
"error.root_timeout": "タスクが時間内に完了しませんでした。タスク スケジューラーで確認してから、「再試行」をクリックしてください。",
|
|
@@ -133,6 +137,7 @@ export const ROOT_MESSAGES = {
|
|
|
133
137
|
admin_only: "관리자 계정에서만 이 작업을 수행할 수 있습니다.",
|
|
134
138
|
uninstall_hint: "이 패키지를 제거하기 전에 \"제거\"를 클릭하여 작업 스케줄러에서 작업을 삭제하십시오.",
|
|
135
139
|
"error.root_conflict": "작업 스케줄러에서 작업 \"{name}\"의 이름을 바꾸거나 삭제한 후 \"재시도\"를 클릭하십시오.",
|
|
140
|
+
"error.root_cancelled": "비밀번호 확인이 취소되었습니다. 작업이 실행되지 않았습니다.",
|
|
136
141
|
"error.root_not_ready": "먼저 이 작업을 승인하십시오.",
|
|
137
142
|
"error.root_task_failed": "작업이 오류로 종료되었습니다. 작업 스케줄러에서 기록을 확인한 후 \"재시도\"를 클릭하십시오.",
|
|
138
143
|
"error.root_timeout": "작업이 제시간에 완료되지 않았습니다. 작업 스케줄러에서 확인한 후 \"재시도\"를 클릭하십시오.",
|
|
@@ -160,6 +165,7 @@ export const ROOT_MESSAGES = {
|
|
|
160
165
|
admin_only: "Nur Administratorkonten können diesen Vorgang ausführen.",
|
|
161
166
|
uninstall_hint: "Klicken Sie vor der Deinstallation dieses Pakets auf „Entfernen“, um seine Aufgabe aus dem Aufgabenplaner zu löschen.",
|
|
162
167
|
"error.root_conflict": "Benennen Sie die Aufgabe „{name}“ im Aufgabenplaner um oder löschen Sie sie, und klicken Sie dann auf „Neuer Versuch“.",
|
|
168
|
+
"error.root_cancelled": "Die Passwortbestätigung wurde abgebrochen. Es wurde keine Aktion ausgeführt.",
|
|
163
169
|
"error.root_not_ready": "Geben Sie diesen Vorgang zuerst frei.",
|
|
164
170
|
"error.root_task_failed": "Die Aufgabe wurde mit einem Fehler beendet. Prüfen Sie ihren Verlauf im Aufgabenplaner, und klicken Sie dann auf „Neuer Versuch“.",
|
|
165
171
|
"error.root_timeout": "Die Aufgabe wurde nicht rechtzeitig beendet. Prüfen Sie sie im Aufgabenplaner, und klicken Sie dann auf „Neuer Versuch“.",
|
|
@@ -187,6 +193,7 @@ export const ROOT_MESSAGES = {
|
|
|
187
193
|
admin_only: "Seuls les comptes administrateur peuvent effectuer cette opération.",
|
|
188
194
|
uninstall_hint: "Avant de désinstaller ce paquet, cliquez sur « Supprimer » pour retirer sa tâche du Planificateur de tâches.",
|
|
189
195
|
"error.root_conflict": "Renommez ou supprimez la tâche « {name} » dans le Planificateur de tâches, puis cliquez sur « Réessayer ».",
|
|
196
|
+
"error.root_cancelled": "La confirmation du mot de passe a été annulée. Aucune opération n’a été exécutée.",
|
|
190
197
|
"error.root_not_ready": "Autorisez d'abord cette opération.",
|
|
191
198
|
"error.root_task_failed": "La tâche s'est terminée avec une erreur. Consultez son historique dans le Planificateur de tâches, puis cliquez sur « Réessayer ».",
|
|
192
199
|
"error.root_timeout": "La tâche ne s'est pas terminée à temps. Vérifiez-la dans le Planificateur de tâches, puis cliquez sur « Réessayer ».",
|
|
@@ -214,6 +221,7 @@ export const ROOT_MESSAGES = {
|
|
|
214
221
|
admin_only: "Solo las cuentas de administrador pueden realizar esta operación.",
|
|
215
222
|
uninstall_hint: "Antes de desinstalar este paquete, haga clic en «Quitar» para eliminar su tarea del Programador de tareas.",
|
|
216
223
|
"error.root_conflict": "Cambie el nombre de la tarea «{name}» o elimínela en el Programador de tareas y, a continuación, haga clic en «Volver a intentar».",
|
|
224
|
+
"error.root_cancelled": "Se canceló la confirmación de la contraseña. No se ejecutó ninguna operación.",
|
|
217
225
|
"error.root_not_ready": "Primero autorice esta operación.",
|
|
218
226
|
"error.root_task_failed": "La tarea terminó con un error. Consulte su historial en el Programador de tareas y, a continuación, haga clic en «Volver a intentar».",
|
|
219
227
|
"error.root_timeout": "La tarea no terminó a tiempo. Revísela en el Programador de tareas y, a continuación, haga clic en «Volver a intentar».",
|
|
@@ -241,6 +249,7 @@ export const ROOT_MESSAGES = {
|
|
|
241
249
|
admin_only: "Solo gli account administrator possono eseguire questa operazione.",
|
|
242
250
|
uninstall_hint: "Prima di disinstallare questo pacchetto, fare clic su \"Rimuovi\" per eliminare la sua attività da Utilità di pianificazione.",
|
|
243
251
|
"error.root_conflict": "Rinominare o eliminare l'attività \"{name}\" in Utilità di pianificazione, quindi fare clic su \"Riprova\".",
|
|
252
|
+
"error.root_cancelled": "La conferma della password è stata annullata. Nessuna operazione è stata eseguita.",
|
|
244
253
|
"error.root_not_ready": "Autorizzare prima questa operazione.",
|
|
245
254
|
"error.root_task_failed": "L'attività è terminata con un errore. Controllarne la cronologia in Utilità di pianificazione, quindi fare clic su \"Riprova\".",
|
|
246
255
|
"error.root_timeout": "L'attività non è terminata in tempo. Controllarla in Utilità di pianificazione, quindi fare clic su \"Riprova\".",
|
|
@@ -20,16 +20,17 @@ export declare function rootTasks(manifest: {
|
|
|
20
20
|
* with exactly the embedded script. The one-use token goes into that single
|
|
21
21
|
* create call and is never kept.
|
|
22
22
|
* - run: re-reads the task and runs it only if it is still exactly ours, then
|
|
23
|
-
* waits for its history entry and asks the backend for the output.
|
|
23
|
+
* waits for its history entry and asks the backend for the output. Repair
|
|
24
|
+
* additionally requires fresh PasswordConfirm and another exact task check.
|
|
24
25
|
* - an older version of our task is "outdated" and never runs; authorizing
|
|
25
26
|
* again replaces it. A same-named task that is not ours is a "conflict" and
|
|
26
27
|
* is never run, replaced or deleted.
|
|
27
28
|
*/
|
|
28
|
-
export declare const ROOT_RUNTIME = "function createRootAccess(options) {\n var API = \"SYNO.Core.TaskScheduler\";\n var POLL_MS = 500, POLLS = 60;\n var byOp = {};\n options.tasks.forEach(function (task) { byOp[task.op] = task; });\n\n function fail(code) {\n var error = new Error(code);\n error.code = code;\n return error;\n }\n function begin(op) {\n if (!Object.prototype.hasOwnProperty.call(byOp, op)) return Promise.reject(fail(\"root_unknown_op\"));\n if (options.user().admin !== true) return Promise.reject(fail(\"admin_required\"));\n return Promise.resolve(byOp[op]);\n }\n function isRootTask(summary) {\n return summary.owner === \"root\" && summary.real_owner === \"root\" && summary.enable === false && summary.type === \"script\";\n }\n function find(task) {\n return options.send(API, \"list\", 3, { start: 0, limit: 500 }).then(function (data) {\n if (!data || !Array.isArray(data.tasks)) throw fail(\"root_bad_response\");\n var named = data.tasks.filter(function (summary) { return summary && summary.name === task.name; });\n if (named.length === 0) return { state: \"missing\" };\n if (named.length > 1 || !isRootTask(named[0])) return { state: \"conflict\" };\n var ref = { id: named[0].id, real_owner: named[0].real_owner };\n return options.send(API, \"get\", 4, ref).then(function (detail) {\n var script = detail && detail.extra && detail.extra.script;\n if (!detail || String(detail.id) !== String(ref.id) || detail.name !== task.name\n || detail.owner !== \"root\" || detail.enable !== false || detail.type !== \"script\" || typeof script !== \"string\") {\n return { state: \"conflict\" };\n }\n if (script === task.script) return { state: \"ready\", ref: ref };\n if (script.indexOf(task.header) === 0) return { state: \"outdated\", ref: ref };\n return { state: \"conflict\" };\n });\n });\n }\n function definition(task, user) {\n var hours = [];\n for (var h = 1; h <= 23; h++) hours.push(h);\n return {\n name: task.name,\n real_owner: user,\n owner: \"root\",\n enable: false,\n type: \"script\",\n schedule: {\n date_type: 0, week_day: \"0,1,2,3,4,5,6\", repeat_date: 1001, monthly_week: [], hour: 0, minute: 0,\n repeat_hour: 0, repeat_min: 0, last_work_hour: 0,\n repeat_min_store_config: [1, 5, 10, 15, 20, 30], repeat_hour_store_config: hours\n },\n extra: { notify_enable: false, script: task.script, notify_mail: \"\", notify_if_error: false }\n };\n }\n function newest(history) {\n if (!Array.isArray(history)) throw fail(\"root_bad_response\");\n return history.reduce(function (latest, entry) {\n return entry && (!latest || Number(entry.timestamp) > Number(latest.timestamp)) ? entry : latest;\n }, null);\n }\n function history(ref) {\n return options.send(API, \"get_history_status_list\", 1, { id: ref.id }).then(newest);\n }\n function waitForRun(ref, before, polls) {\n return history(ref).then(function (latest) {\n var finished = latest && (!before || latest.timestamp !== before.timestamp)\n && latest.exit_type !== \"running\" && latest.stop_time;\n if (finished) {\n if (latest.exit_code !== 0) throw fail(\"root_task_failed\");\n return;\n }\n if (polls <= 1) throw fail(\"root_timeout\");\n return options.wait(POLL_MS).then(function () { return waitForRun(ref, before, polls - 1); });\n });\n }\n\n return {\n state: function (op) {\n return begin(op).then(find).then(function (found) { return found.state; });\n },\n authorize: function (op) {\n return begin(op).then(function (task) {\n return find(task).then(function (found) {\n if (found.state === \"ready\") return \"ready\";\n if (found.state === \"conflict\") throw fail(\"root_conflict\");\n return options.confirmPassword().then(function (token) {\n if (!token) return \"cancelled\";\n var params = definition(task, options.user().name);\n params.SynoConfirmPWToken = token;\n var replaced = found.state === \"outdated\"\n ? options.send(API, \"delete\", 2, { tasks: [found.ref] })\n : Promise.resolve();\n return replaced.then(function () {\n return options.send(API + \".Root\", \"create\", 4, params);\n }).then(function () {\n return find(task);\n }).then(function (after) {\n if (after.state !== \"ready\") throw fail(\"root_verify_failed\");\n return \"ready\";\n });\n });\n });\n });\n },\n run: function (op) {\n return begin(op).then(function (task) {\n return find(task).then(function (found) {\n if (found.state !== \"ready\") throw fail(\"root_not_ready\");\n return
|
|
29
|
+
export declare const ROOT_RUNTIME = "function createRootAccess(options) {\n var API = \"SYNO.Core.TaskScheduler\";\n var POLL_MS = 500, POLLS = 60;\n var byOp = {};\n options.tasks.forEach(function (task) { byOp[task.op] = task; });\n\n function fail(code) {\n var error = new Error(code);\n error.code = code;\n return error;\n }\n function begin(op) {\n if (!Object.prototype.hasOwnProperty.call(byOp, op)) return Promise.reject(fail(\"root_unknown_op\"));\n if (options.user().admin !== true) return Promise.reject(fail(\"admin_required\"));\n return Promise.resolve(byOp[op]);\n }\n function isRootTask(summary) {\n return summary.owner === \"root\" && summary.real_owner === \"root\" && summary.enable === false && summary.type === \"script\";\n }\n function find(task) {\n return options.send(API, \"list\", 3, { start: 0, limit: 500 }).then(function (data) {\n if (!data || !Array.isArray(data.tasks)) throw fail(\"root_bad_response\");\n var named = data.tasks.filter(function (summary) { return summary && summary.name === task.name; });\n if (named.length === 0) return { state: \"missing\" };\n if (named.length > 1 || !isRootTask(named[0])) return { state: \"conflict\" };\n var ref = { id: named[0].id, real_owner: named[0].real_owner };\n return options.send(API, \"get\", 4, ref).then(function (detail) {\n var script = detail && detail.extra && detail.extra.script;\n if (!detail || String(detail.id) !== String(ref.id) || detail.name !== task.name\n || detail.owner !== \"root\" || detail.enable !== false || detail.type !== \"script\" || typeof script !== \"string\") {\n return { state: \"conflict\" };\n }\n if (script === task.script) return { state: \"ready\", ref: ref };\n if (script.indexOf(task.header) === 0) return { state: \"outdated\", ref: ref };\n return { state: \"conflict\" };\n });\n });\n }\n function definition(task, user) {\n var hours = [];\n for (var h = 1; h <= 23; h++) hours.push(h);\n return {\n name: task.name,\n real_owner: user,\n owner: \"root\",\n enable: false,\n type: \"script\",\n schedule: {\n date_type: 0, week_day: \"0,1,2,3,4,5,6\", repeat_date: 1001, monthly_week: [], hour: 0, minute: 0,\n repeat_hour: 0, repeat_min: 0, last_work_hour: 0,\n repeat_min_store_config: [1, 5, 10, 15, 20, 30], repeat_hour_store_config: hours\n },\n extra: { notify_enable: false, script: task.script, notify_mail: \"\", notify_if_error: false }\n };\n }\n function newest(history) {\n if (!Array.isArray(history)) throw fail(\"root_bad_response\");\n return history.reduce(function (latest, entry) {\n return entry && (!latest || Number(entry.timestamp) > Number(latest.timestamp)) ? entry : latest;\n }, null);\n }\n function history(ref) {\n return options.send(API, \"get_history_status_list\", 1, { id: ref.id }).then(newest);\n }\n function waitForRun(ref, before, polls) {\n return history(ref).then(function (latest) {\n var finished = latest && (!before || latest.timestamp !== before.timestamp)\n && latest.exit_type !== \"running\" && latest.stop_time;\n if (finished) {\n if (latest.exit_code !== 0) throw fail(\"root_task_failed\");\n return;\n }\n if (polls <= 1) throw fail(\"root_timeout\");\n return options.wait(POLL_MS).then(function () { return waitForRun(ref, before, polls - 1); });\n });\n }\n\n return {\n state: function (op) {\n return begin(op).then(find).then(function (found) { return found.state; });\n },\n authorize: function (op) {\n return begin(op).then(function (task) {\n return find(task).then(function (found) {\n if (found.state === \"ready\") return \"ready\";\n if (found.state === \"conflict\") throw fail(\"root_conflict\");\n return options.confirmPassword().then(function (token) {\n if (!token) return \"cancelled\";\n var params = definition(task, options.user().name);\n params.SynoConfirmPWToken = token;\n var replaced = found.state === \"outdated\"\n ? options.send(API, \"delete\", 2, { tasks: [found.ref] })\n : Promise.resolve();\n return replaced.then(function () {\n return options.send(API + \".Root\", \"create\", 4, params);\n }).then(function () {\n return find(task);\n }).then(function (after) {\n if (after.state !== \"ready\") throw fail(\"root_verify_failed\");\n return \"ready\";\n });\n });\n });\n });\n },\n run: function (op) {\n return begin(op).then(function (task) {\n return find(task).then(function (found) {\n if (found.state !== \"ready\") throw fail(\"root_not_ready\");\n // Repair requires fresh interactive consent even for a retained task.\n // Confirmation tokens are never cached or reused as scheduler tokens.\n var consent = op === \"helper_repair\" ? options.confirmPassword() : Promise.resolve(true);\n return consent.then(function (token) {\n if (!token) throw fail(\"root_cancelled\");\n // The user may leave the dialog open while the scheduler changes.\n return op === \"helper_repair\" ? begin(op).then(find) : found;\n }).then(function (verified) {\n if (verified.state !== \"ready\") throw fail(\"root_not_ready\");\n return history(verified.ref).then(function (before) {\n return options.send(API, \"run\", 2, { tasks: [verified.ref] }).then(function () {\n return waitForRun(verified.ref, before, POLLS);\n });\n });\n });\n }).then(function () {\n return options.call(\"root.output\", { op: op });\n });\n });\n },\n remove: function (op) {\n return begin(op).then(function (task) {\n return find(task).then(function (found) {\n if (found.state === \"missing\") return \"missing\";\n if (found.state === \"conflict\") throw fail(\"root_conflict\");\n return options.send(API, \"delete\", 2, { tasks: [found.ref] }).then(function () {\n return find(task);\n }).then(function (after) {\n if (after.state !== \"missing\") throw fail(\"root_verify_failed\");\n return \"missing\";\n });\n });\n });\n },\n output: function (op) {\n return begin(op).then(function () {\n return options.call(\"root.output\", { op: op });\n });\n }\n };\n}";
|
|
29
30
|
/**
|
|
30
31
|
* The authorization panel the window shows above the app for each root
|
|
31
32
|
* operation, identical in every package. `rootPanelView(model)` decides what
|
|
32
33
|
* it shows; `mountRootPanel(host, access, i18n, tasks, admin)` draws it with
|
|
33
34
|
* DOM text nodes only (no HTML from data).
|
|
34
35
|
*/
|
|
35
|
-
export declare const ROOT_PANEL = "function rootPanelShowsResult(state) {\n return state === \"ready\" || state === \"outdated\";\n}\n\nfunction rootPanelView(model) {\n if (!model.admin) return { status: null, buttons: [], message: { key: \"admin_only\" } };\n function buttons(actions) {\n return actions.map(function (action) { return { action: action, disabled: model.busy === true }; });\n }\n if (model.error) {\n return {\n status: \"state.\" + model.state, buttons: buttons([\"retry\"]),\n message: { key: \"error.\" + model.error, params: { name: model.name, code: model.error } }\n };\n }\n var message = model.notice ? { key: model.notice } : null;\n switch (model.state) {\n case \"missing\":\n return { status: \"state.missing\", buttons: buttons([\"authorize\"]), message: message };\n case \"outdated\":\n return { status: \"state.outdated\", buttons: buttons([\"authorize\", \"remove\"]), message: message };\n case \"ready\":\n return { status: \"state.ready\", buttons: buttons([\"run\", \"remove\"]), message: message };\n case \"conflict\":\n return { status: \"state.conflict\", buttons: buttons([\"retry\"]), message: { key: \"error.root_conflict\", params: { name: model.name } } };\n default:\n return { status: \"state.checking\", buttons: [], message: null };\n }\n}\n\nfunction mountRootPanel(host, access, i18n, tasks, admin) {\n var t = i18n.t;\n function el(tag, className, text) {\n var node = document.createElement(tag);\n if (className) node.className = className;\n if (text !== undefined) node.textContent = text;\n return node;\n }\n function say(message) {\n if (!message) return \"\";\n var text = t(message.key, message.params);\n return text === message.key && message.key.indexOf(\"error.\") === 0 ? t(\"error.default\", message.params) : text;\n }\n tasks.forEach(function (task) {\n var model = { admin: admin, name: task.name, state: \"checking\", busy: false, error: null, notice: null };\n var result = null;\n var section = el(\"section\", \"dsmapp-rootpanel\");\n host.appendChild(section);\n\n function render() {\n var view = rootPanelView(model);\n while (section.firstChild) section.removeChild(section.firstChild);\n section.appendChild(el(\"h2\", null, t(\"title\")));\n section.appendChild(el(\"p\", null, t(\"intro\", { op: task.op })));\n if (view.status) {\n var facts = el(\"dl\");\n facts.appendChild(el(\"dt\", null, t(\"status\")));\n facts.appendChild(el(\"dd\", \"dsmapp-rootpanel-state\", t(view.status, { name: task.name })));\n facts.appendChild(el(\"dt\", null, t(\"last_run\")));\n facts.appendChild(el(\"dd\", null, result && result.modified\n ? new Date(result.modified * 1000).toLocaleString(i18n.locale) : t(\"never\")));\n section.appendChild(facts);\n }\n if (view.message) section.appendChild(el(\"p\", \"dsmapp-rootpanel-message\", say(view.message)));\n if (result && typeof result.output === \"string\") {\n section.appendChild(el(\"div\", \"dsmapp-rootpanel-label\", t(\"output\")));\n section.appendChild(el(\"pre\", \"dsmapp-rootpanel-output\", result.output));\n }\n var actions = el(\"div\", \"dsmapp-rootpanel-actions\");\n view.buttons.forEach(function (button) {\n var node = el(\"button\", button.action === \"remove\" ? null : \"dsmapp-rootpanel-primary\", t(button.action));\n node.type = \"button\";\n node.disabled = button.disabled;\n node.onclick = function () { act(button.action); };\n actions.appendChild(node);\n });\n section.appendChild(actions);\n if (admin && rootPanelShowsResult(model.state)) section.appendChild(el(\"p\", \"dsmapp-rootpanel-hint\", t(\"uninstall_hint\")));\n }\n function settle(promise, notice) {\n model.busy = true;\n model.error = null;\n model.notice = null;\n render();\n return promise.then(function (value) {\n model.notice = typeof notice === \"function\" ? notice(value) : notice;\n }, function (error) {\n model.error = (error && error.code) || \"unknown\";\n }).then(function () {\n model.busy = false;\n render();\n });\n }\n function refresh(notice) {\n return settle(access.state(task.op).then(function (state) {\n model.state = state;\n if (!rootPanelShowsResult(state)) return;\n return access.output(task.op).then(function (out) { result = out; });\n }), notice);\n }\n function refreshAfterChange() {\n return model.error ? null : refresh(model.notice);\n }\n function act(action) {\n if (action === \"retry\") return refresh(null);\n if (action === \"authorize\") {\n return settle(access.authorize(task.op), function (outcome) {\n return outcome === \"cancelled\" ? \"cancelled\" : null;\n }).then(refreshAfterChange);\n }\n if (action === \"run\") {\n return settle(access.run(task.op).then(function (out) { result = out; }), \"completed\");\n }\n if (action === \"remove\") {\n return settle(access.remove(task.op).then(function () { result = null; }), null).then(refreshAfterChange);\n }\n }\n render();\n if (admin) refresh(null);\n });\n}";
|
|
36
|
+
export declare const ROOT_PANEL = "function rootPanelShowsResult(state) {\n return state === \"ready\" || state === \"outdated\";\n}\n\nfunction rootPanelView(model) {\n if (!model.admin) return { status: null, buttons: [], message: { key: \"admin_only\" } };\n function buttons(actions) {\n return actions.map(function (action) { return { action: action, disabled: model.busy === true }; });\n }\n if (model.error) {\n return {\n status: \"state.\" + model.state, buttons: buttons([\"retry\"]),\n message: { key: \"error.\" + model.error, params: { name: model.name, code: model.error } }\n };\n }\n var message = model.notice ? { key: model.notice } : null;\n switch (model.state) {\n case \"missing\":\n return { status: \"state.missing\", buttons: buttons([\"authorize\"]), message: message };\n case \"outdated\":\n return { status: \"state.outdated\", buttons: buttons([\"authorize\", \"remove\"]), message: message };\n case \"ready\":\n return { status: \"state.ready\", buttons: buttons([\"run\", \"remove\"]), message: message };\n case \"conflict\":\n return { status: \"state.conflict\", buttons: buttons([\"retry\"]), message: { key: \"error.root_conflict\", params: { name: model.name } } };\n default:\n return { status: \"state.checking\", buttons: [], message: null };\n }\n}\n\nfunction mountRootPanel(host, access, i18n, tasks, admin) {\n var t = i18n.t;\n function el(tag, className, text) {\n var node = document.createElement(tag);\n if (className) node.className = className;\n if (text !== undefined) node.textContent = text;\n return node;\n }\n function say(message) {\n if (!message) return \"\";\n var text = t(message.key, message.params);\n return text === message.key && message.key.indexOf(\"error.\") === 0 ? t(\"error.default\", message.params) : text;\n }\n tasks.forEach(function (task) {\n var model = { admin: admin, name: task.name, state: \"checking\", busy: false, error: null, notice: null };\n var result = null;\n var section = el(\"section\", \"dsmapp-rootpanel\");\n host.appendChild(section);\n\n function render() {\n var view = rootPanelView(model);\n while (section.firstChild) section.removeChild(section.firstChild);\n section.appendChild(el(\"h2\", null, t(\"title\")));\n section.appendChild(el(\"p\", null, t(\"intro\", { op: task.op })));\n if (view.status) {\n var facts = el(\"dl\");\n facts.appendChild(el(\"dt\", null, t(\"status\")));\n facts.appendChild(el(\"dd\", \"dsmapp-rootpanel-state\", t(view.status, { name: task.name })));\n facts.appendChild(el(\"dt\", null, t(\"last_run\")));\n facts.appendChild(el(\"dd\", null, result && result.modified\n ? new Date(result.modified * 1000).toLocaleString(i18n.locale) : t(\"never\")));\n section.appendChild(facts);\n }\n if (view.message) section.appendChild(el(\"p\", \"dsmapp-rootpanel-message\", say(view.message)));\n if (result && typeof result.output === \"string\") {\n section.appendChild(el(\"div\", \"dsmapp-rootpanel-label\", t(\"output\")));\n section.appendChild(el(\"pre\", \"dsmapp-rootpanel-output\", result.output));\n }\n var actions = el(\"div\", \"dsmapp-rootpanel-actions\");\n view.buttons.forEach(function (button) {\n var node = el(\"button\", button.action === \"remove\" ? null : \"dsmapp-rootpanel-primary\", t(button.action));\n node.type = \"button\";\n node.disabled = button.disabled;\n node.onclick = function () { act(button.action); };\n actions.appendChild(node);\n });\n section.appendChild(actions);\n if (admin && rootPanelShowsResult(model.state)) section.appendChild(el(\"p\", \"dsmapp-rootpanel-hint\", t(\"uninstall_hint\")));\n }\n function settle(promise, notice) {\n model.busy = true;\n model.error = null;\n model.notice = null;\n render();\n return promise.then(function (value) {\n model.notice = typeof notice === \"function\" ? notice(value) : notice;\n }, function (error) {\n if (error && error.code === \"root_cancelled\") model.notice = \"cancelled\";\n else model.error = (error && error.code) || \"unknown\";\n }).then(function () {\n model.busy = false;\n render();\n });\n }\n function refresh(notice) {\n return settle(access.state(task.op).then(function (state) {\n model.state = state;\n if (!rootPanelShowsResult(state)) return;\n return access.output(task.op).then(function (out) { result = out; });\n }), notice);\n }\n function refreshAfterChange() {\n return model.error ? null : refresh(model.notice);\n }\n function act(action) {\n if (action === \"retry\") return refresh(null);\n if (action === \"authorize\") {\n return settle(access.authorize(task.op), function (outcome) {\n return outcome === \"cancelled\" ? \"cancelled\" : null;\n }).then(refreshAfterChange);\n }\n if (action === \"run\") {\n return settle(access.run(task.op).then(function (out) { result = out; }), \"completed\");\n }\n if (action === \"remove\") {\n return settle(access.remove(task.op).then(function () { result = null; }), null).then(refreshAfterChange);\n }\n }\n render();\n if (admin) refresh(null);\n });\n}";
|
|
@@ -16,7 +16,8 @@ export function rootTasks(manifest) {
|
|
|
16
16
|
* with exactly the embedded script. The one-use token goes into that single
|
|
17
17
|
* create call and is never kept.
|
|
18
18
|
* - run: re-reads the task and runs it only if it is still exactly ours, then
|
|
19
|
-
* waits for its history entry and asks the backend for the output.
|
|
19
|
+
* waits for its history entry and asks the backend for the output. Repair
|
|
20
|
+
* additionally requires fresh PasswordConfirm and another exact task check.
|
|
20
21
|
* - an older version of our task is "outdated" and never runs; authorizing
|
|
21
22
|
* again replaces it. A same-named task that is not ours is a "conflict" and
|
|
22
23
|
* is never run, replaced or deleted.
|
|
@@ -130,9 +131,19 @@ export const ROOT_RUNTIME = `function createRootAccess(options) {
|
|
|
130
131
|
return begin(op).then(function (task) {
|
|
131
132
|
return find(task).then(function (found) {
|
|
132
133
|
if (found.state !== "ready") throw fail("root_not_ready");
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
// Repair requires fresh interactive consent even for a retained task.
|
|
135
|
+
// Confirmation tokens are never cached or reused as scheduler tokens.
|
|
136
|
+
var consent = op === "helper_repair" ? options.confirmPassword() : Promise.resolve(true);
|
|
137
|
+
return consent.then(function (token) {
|
|
138
|
+
if (!token) throw fail("root_cancelled");
|
|
139
|
+
// The user may leave the dialog open while the scheduler changes.
|
|
140
|
+
return op === "helper_repair" ? begin(op).then(find) : found;
|
|
141
|
+
}).then(function (verified) {
|
|
142
|
+
if (verified.state !== "ready") throw fail("root_not_ready");
|
|
143
|
+
return history(verified.ref).then(function (before) {
|
|
144
|
+
return options.send(API, "run", 2, { tasks: [verified.ref] }).then(function () {
|
|
145
|
+
return waitForRun(verified.ref, before, POLLS);
|
|
146
|
+
});
|
|
136
147
|
});
|
|
137
148
|
});
|
|
138
149
|
}).then(function () {
|
|
@@ -254,7 +265,8 @@ function mountRootPanel(host, access, i18n, tasks, admin) {
|
|
|
254
265
|
return promise.then(function (value) {
|
|
255
266
|
model.notice = typeof notice === "function" ? notice(value) : notice;
|
|
256
267
|
}, function (error) {
|
|
257
|
-
|
|
268
|
+
if (error && error.code === "root_cancelled") model.notice = "cancelled";
|
|
269
|
+
else model.error = (error && error.code) || "unknown";
|
|
258
270
|
}).then(function () {
|
|
259
271
|
model.busy = false;
|
|
260
272
|
render();
|
package/dist/standalone/spk.d.ts
CHANGED
|
@@ -13,10 +13,11 @@ export interface AssembleOptions {
|
|
|
13
13
|
cgiPath: string;
|
|
14
14
|
outputPath: string;
|
|
15
15
|
helper?: HelperArtifact;
|
|
16
|
+
daemonControl?: string;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
|
-
* Packs an unsigned Standalone Package SPK.
|
|
19
|
-
* package account
|
|
20
|
-
*
|
|
19
|
+
* Packs an unsigned Standalone Package SPK. DSM runs installation/lifecycle
|
|
20
|
+
* as the package account, including an optional foreground daemon. Root
|
|
21
|
+
* integration remains separate and requires explicit administrator approval.
|
|
21
22
|
*/
|
|
22
23
|
export declare function assembleStandaloneSpk(options: AssembleOptions): Promise<void>;
|
package/dist/standalone/spk.js
CHANGED
|
@@ -6,8 +6,12 @@ import { infoArchValue } from "../build-spk/dsm-arch.js";
|
|
|
6
6
|
import { writeDsmWindowIcons, writePackageCenterIcons } from "../build-spk/dsm-icons.js";
|
|
7
7
|
import { renderNativePrivilege } from "../build-spk/native-lifecycle.js";
|
|
8
8
|
import { createReproducibleTar } from "../build-spk/reproducible-archive.js";
|
|
9
|
+
import { renderStandaloneScript } from "./lifecycle.js";
|
|
9
10
|
import { DSM_LANGS, LOCALES } from "./i18n.js";
|
|
10
11
|
import { CGI_PAYLOAD_PATH, renderUiConfig, renderWindowScript, windowScriptName } from "./dsm-window.js";
|
|
12
|
+
import { copyStandaloneNotices } from "../build-spk/notices.js";
|
|
13
|
+
import { hostScriptName, renderHostAdapterScript } from "./host-adapter.js";
|
|
14
|
+
import { copyDaemonPayload } from "./daemon.js";
|
|
11
15
|
const FILE_MODE = 0o644;
|
|
12
16
|
const EXEC_MODE = 0o755;
|
|
13
17
|
const MAX_UI_BYTES = 64 * 1024 * 1024;
|
|
@@ -28,9 +32,9 @@ export class StandaloneBuildError extends Error {
|
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
/**
|
|
31
|
-
* Packs an unsigned Standalone Package SPK.
|
|
32
|
-
* package account
|
|
33
|
-
*
|
|
35
|
+
* Packs an unsigned Standalone Package SPK. DSM runs installation/lifecycle
|
|
36
|
+
* as the package account, including an optional foreground daemon. Root
|
|
37
|
+
* integration remains separate and requires explicit administrator approval.
|
|
34
38
|
*/
|
|
35
39
|
export async function assembleStandaloneSpk(options) {
|
|
36
40
|
const { manifest } = options;
|
|
@@ -42,17 +46,24 @@ export async function assembleStandaloneSpk(options) {
|
|
|
42
46
|
const assetVersion = digestTree(appDir).slice(0, 12);
|
|
43
47
|
writeFile(join(uiRoot, "config"), renderUiConfig(manifest));
|
|
44
48
|
writeFile(join(uiRoot, windowScriptName(manifest)), renderWindowScript(manifest, assetVersion));
|
|
49
|
+
writeFile(join(uiRoot, hostScriptName(manifest.build)), renderHostAdapterScript(manifest.package));
|
|
45
50
|
writeDsmWindowIcons(uiRoot);
|
|
46
51
|
const cgiTarget = join(staging, "package", CGI_PAYLOAD_PATH);
|
|
47
52
|
mkdirSync(dirname(cgiTarget), { recursive: true });
|
|
48
53
|
copyFileSync(options.cgiPath, cgiTarget);
|
|
49
54
|
chmodSync(cgiTarget, EXEC_MODE);
|
|
55
|
+
if (manifest.daemon) {
|
|
56
|
+
if (!options.daemonControl)
|
|
57
|
+
throw new StandaloneBuildError("STANDALONE_DAEMON_ARTIFACT_REQUIRED", "daemon controller artifact required.");
|
|
58
|
+
copyDaemonPayload(manifest, options.arch, join(staging, "package", "daemon"), options.daemonControl);
|
|
59
|
+
}
|
|
50
60
|
if (manifest.integration && !options.helper)
|
|
51
61
|
throw new StandaloneBuildError("HELPER_ARTIFACT_REQUIRED", "integration SPK 缺少已建置的 helper inventory。");
|
|
52
62
|
if (options.helper) {
|
|
53
63
|
const dir = join(staging, "package", "integration");
|
|
54
64
|
mkdirSync(dir, { recursive: true });
|
|
55
65
|
copyFileSync(options.helper.binary, join(dir, "helper"));
|
|
66
|
+
copyFileSync(new URL("../../templates/native-go/backend/THIRD_PARTY_NOTICES.txt", import.meta.url), join(dir, "THIRD_PARTY_NOTICES.txt"));
|
|
56
67
|
chmodSync(join(dir, "helper"), EXEC_MODE);
|
|
57
68
|
writeFile(join(dir, "inventory.json"), JSON.stringify(options.helper.inventory));
|
|
58
69
|
writeFile(join(dir, "workers.json"), JSON.stringify(options.helper.workers.map(({ id, digest }) => ({ id, digest }))));
|
|
@@ -71,6 +82,9 @@ export async function assembleStandaloneSpk(options) {
|
|
|
71
82
|
copyFileSync(source, target);
|
|
72
83
|
chmodSync(target, FILE_MODE);
|
|
73
84
|
}
|
|
85
|
+
copyStandaloneNotices(manifest.root, manifest.ui.dir, join(staging, 'package'), manifest.backend.kind === 'go' || Boolean(manifest.daemon), Boolean(options.helper), manifest.integration?.identity === 'better-auth', manifest.backend.kind === 'go' ? manifest.backend.dir : undefined);
|
|
86
|
+
if (manifest.daemon)
|
|
87
|
+
copyFileSync(new URL('../../templates/_shared/LICENSES/TEMPLATE.txt', import.meta.url), join(staging, 'package', 'LICENSES', 'DAEMON-LICENSE.txt'));
|
|
74
88
|
const packageTgz = join(staging, "package.tgz");
|
|
75
89
|
await createReproducibleTar(join(staging, "package"), packageTgz, { gzip: true });
|
|
76
90
|
rmSync(join(staging, "package"), { recursive: true, force: true });
|
|
@@ -80,7 +94,7 @@ export async function assembleStandaloneSpk(options) {
|
|
|
80
94
|
writeFile(join(staging, "conf", "privilege"), renderNativePrivilege());
|
|
81
95
|
mkdirSync(join(staging, "scripts"));
|
|
82
96
|
for (const name of LIFECYCLE_SCRIPTS) {
|
|
83
|
-
writeFile(join(staging, "scripts", name),
|
|
97
|
+
writeFile(join(staging, "scripts", name), renderStandaloneScript(name, manifest), EXEC_MODE);
|
|
84
98
|
}
|
|
85
99
|
writePackageCenterIcons(staging);
|
|
86
100
|
mkdirSync(dirname(options.outputPath), { recursive: true });
|
|
@@ -113,6 +127,8 @@ function renderInfo(manifest, arch, checksum) {
|
|
|
113
127
|
["startable", "yes"],
|
|
114
128
|
["checksum", checksum],
|
|
115
129
|
];
|
|
130
|
+
if (manifest.integration || manifest.daemon)
|
|
131
|
+
fields.push(["precheckstartstop", "yes"]);
|
|
116
132
|
if (manifest.integration?.identity === "better-auth")
|
|
117
133
|
fields.push(["install_dep_packages", "Node.js_v22"]);
|
|
118
134
|
for (const locale of LOCALES) {
|
|
@@ -124,35 +140,6 @@ function renderInfo(manifest, arch, checksum) {
|
|
|
124
140
|
}
|
|
125
141
|
return fields.map(([key, value]) => `${key}=${quote(value)}\n`).join("");
|
|
126
142
|
}
|
|
127
|
-
/** No lifecycle work: the CGI needs nothing installed, started or cleaned up. */
|
|
128
|
-
function renderScript(name, manifest) {
|
|
129
|
-
if (manifest.integration && ["preupgrade", "preuninst", "start-stop-status"].includes(name)) {
|
|
130
|
-
const check = `/var/packages/${manifest.package}/target/integration/helper check-stopped || {
|
|
131
|
-
echo 'Run the approved helper_teardown or helper_disable operation before stopping, upgrading or uninstalling.' >&2
|
|
132
|
-
exit 1
|
|
133
|
-
}
|
|
134
|
-
`;
|
|
135
|
-
if (name !== "start-stop-status")
|
|
136
|
-
return `#!/bin/sh\n${check}`;
|
|
137
|
-
return `#!/bin/sh
|
|
138
|
-
case "$1" in
|
|
139
|
-
start|status) exit 0 ;;
|
|
140
|
-
stop)
|
|
141
|
-
${check} ;;
|
|
142
|
-
*) exit 1 ;;
|
|
143
|
-
esac
|
|
144
|
-
`;
|
|
145
|
-
}
|
|
146
|
-
if (name === "start-stop-status") {
|
|
147
|
-
return `#!/bin/sh
|
|
148
|
-
case "$1" in
|
|
149
|
-
start|stop|status) exit 0 ;;
|
|
150
|
-
*) exit 1 ;;
|
|
151
|
-
esac
|
|
152
|
-
`;
|
|
153
|
-
}
|
|
154
|
-
return "#!/bin/sh\nexit 0\n";
|
|
155
|
-
}
|
|
156
143
|
function copyUiTree(source, target) {
|
|
157
144
|
for (const entry of ["app.js", "app.css"]) {
|
|
158
145
|
if (!existsSync(join(source, entry))) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
/** Both source execution and the published CLI resolve the same bundled templates. */
|
|
5
|
+
export function templatesRoot() {
|
|
6
|
+
const moduleDir = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const distTemplates = join(moduleDir, "templates");
|
|
8
|
+
return existsSync(distTemplates) ? distTemplates : join(moduleDir, "..", "templates");
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//go:build linux
|
|
2
|
+
|
|
3
|
+
package main
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"os"
|
|
7
|
+
"os/exec"
|
|
8
|
+
"syscall"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
func dropFixtureUser(cmd *exec.Cmd) {
|
|
12
|
+
if os.Geteuid() == 0 {
|
|
13
|
+
cmd.SysProcAttr = &syscall.SysProcAttr{Credential: &syscall.Credential{Uid: 65534, Gid: 65534, Groups: []uint32{65534}}}
|
|
14
|
+
}
|
|
15
|
+
}
|