@synopackageland/templates 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -4
- package/package.json +2 -2
- package/templates/_shared/AGENTS.md +95 -18
- package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +1 -1
- package/templates/native-go/backend/cmd/app/main.go +8 -1
- package/templates/native-go/backend/cmd/background-worker/main.go +5 -1
- package/templates/native-go/backend/go.mod +1 -1
- package/templates/native-go/backend/go.sum +2 -2
- package/templates/native-go/backend/internal/app/background.go +19 -8
- package/templates/native-go/backend/internal/app/background_owner_test.go +2 -2
- package/templates/native-go/backend/internal/app/background_test.go +24 -0
- package/templates/native-go/backend/internal/app/background_work.go +94 -0
- package/templates/native-go/backend/internal/app/background_work_test.go +95 -0
- package/templates/native-go/backend/internal/app/uninstall.go +19 -0
- package/templates/native-go/backend/internal/app/uninstall_test.go +33 -0
- package/templates/native-go/dsm-package.yaml +18 -0
- package/templates/native-go-delegate/backend/cmd/background-worker/main.go +1 -1
- package/templates/native-go-jobs/backend/internal/app/background_routes_test.go +4 -0
- package/templates/native-go-jobs/frontend/test/background-page.test.ts +21 -0
- package/templates/native-go-vue/frontend/package-lock.json +4 -4
- package/templates/native-go-vue/frontend/package.json +1 -1
- package/templates/native-rust/README.md +381 -0
- package/templates/native-rust/backend/Cargo.lock +125 -0
- package/templates/native-rust/backend/Cargo.toml +24 -0
- package/templates/native-rust/backend/THIRD_PARTY_NOTICES.txt +207 -0
- package/templates/native-rust/backend/permissions.json +5 -0
- package/templates/native-rust/backend/rust-toolchain.toml +4 -0
- package/templates/native-rust/backend/src/app/background/mod.rs +424 -0
- package/templates/native-rust/backend/src/app/background/owner.rs +77 -0
- package/templates/native-rust/backend/src/app/background/owner_tests.rs +174 -0
- package/templates/native-rust/backend/src/app/background/schedule.rs +126 -0
- package/templates/native-rust/backend/src/app/background/schedule_tests.rs +108 -0
- package/templates/native-rust/backend/src/app/background/tests.rs +505 -0
- package/templates/native-rust/backend/src/app/background/work.rs +78 -0
- package/templates/native-rust/backend/src/app/background/work_tests.rs +123 -0
- package/templates/native-rust/backend/src/app/background_routes.rs +22 -0
- package/templates/native-rust/backend/src/app/delegate_config.rs +188 -0
- package/templates/native-rust/backend/src/app/delegate_routes.rs +22 -0
- package/templates/native-rust/backend/src/app/identity.rs +56 -0
- package/templates/native-rust/backend/src/app/migrations.rs +79 -0
- package/templates/native-rust/backend/src/app/mod.rs +30 -0
- package/templates/native-rust/backend/src/app/portal.rs +317 -0
- package/templates/native-rust/backend/src/app/root_routes.rs +23 -0
- package/templates/native-rust/backend/src/app/routes.rs +315 -0
- package/templates/native-rust/backend/src/app/session_files.rs +19 -0
- package/templates/native-rust/backend/src/app/shared_folder.rs +383 -0
- package/templates/native-rust/backend/src/app/test_support.rs +200 -0
- package/templates/native-rust/backend/src/app/uninstall.rs +38 -0
- package/templates/native-rust/backend/src/bin/api.rs +72 -0
- package/templates/native-rust/backend/src/bin/background-worker.rs +37 -0
- package/templates/native-rust/backend/src/build_env.rs +155 -0
- package/templates/native-rust/backend/src/lib.rs +6 -0
- package/templates/native-rust/backend/src/permissions.rs +54 -0
- package/templates/native-rust/backend/src/process.rs +91 -0
- package/templates/native-rust/dsm-package.yaml +89 -0
- package/templates/native-rust/gitignore +2 -0
- package/templates/native-rust/i18n/glossary.json +663 -0
- package/templates/native-rust/i18n/messages/de.json +29 -0
- package/templates/native-rust/i18n/messages/en.json +29 -0
- package/templates/native-rust/i18n/messages/es.json +29 -0
- package/templates/native-rust/i18n/messages/fr.json +29 -0
- package/templates/native-rust/i18n/messages/it.json +29 -0
- package/templates/native-rust/i18n/messages/ja.json +29 -0
- package/templates/native-rust/i18n/messages/ko.json +29 -0
- package/templates/native-rust/i18n/messages/zh-CN.json +29 -0
- package/templates/native-rust/i18n/messages/zh-TW.json +29 -0
- package/templates/native-rust/ui/app.css +45 -0
- package/templates/native-rust/ui/app.js +111 -0
- package/templates/native-rust-delegate/backend/src/app/delegate_routes.rs +92 -0
- package/templates/native-rust-delegate/backend/src/bin/background-worker.rs +52 -0
- package/templates/native-rust-jobs/backend/src/app/background_routes.rs +109 -0
- package/templates/native-rust-root-ops/backend/src/app/root_routes.rs +475 -0
- package/templates/native-rust-vue/README.md +55 -0
- package/templates/native-rust-vue/gitignore +3 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
package app
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"os"
|
|
5
|
+
"path/filepath"
|
|
6
|
+
"testing"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
func TestUninstallDeletesTheJobSpoolOnlyWhenAsked(t *testing.T) {
|
|
10
|
+
dir := t.TempDir()
|
|
11
|
+
spool := filepath.Join(dir, "background")
|
|
12
|
+
if err := os.MkdirAll(filepath.Join(spool, "inputs"), 0o700); err != nil {
|
|
13
|
+
t.Fatal(err)
|
|
14
|
+
}
|
|
15
|
+
if err := Uninstall(dir, false); err != nil {
|
|
16
|
+
t.Fatal(err)
|
|
17
|
+
}
|
|
18
|
+
if _, err := os.Stat(spool); err != nil {
|
|
19
|
+
t.Fatalf("kept state is gone: %v", err)
|
|
20
|
+
}
|
|
21
|
+
if err := Uninstall(dir, true); err != nil {
|
|
22
|
+
t.Fatal(err)
|
|
23
|
+
}
|
|
24
|
+
if _, err := os.Stat(spool); !os.IsNotExist(err) {
|
|
25
|
+
t.Fatalf("state not deleted: %v", err)
|
|
26
|
+
}
|
|
27
|
+
if _, err := os.Stat(dir); err != nil {
|
|
28
|
+
t.Fatalf("package data must stay: %v", err)
|
|
29
|
+
}
|
|
30
|
+
if err := Uninstall(dir, true); err != nil {
|
|
31
|
+
t.Fatalf("nothing left to delete: %v", err)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -69,3 +69,21 @@ i18n:
|
|
|
69
69
|
|
|
70
70
|
# Optional SDK capabilities; delegate/rootOps share administrator-approved executor setup.
|
|
71
71
|
capabilities: {}
|
|
72
|
+
|
|
73
|
+
# Optional uninstall hook. DSM runs `exec args` as the package account on a
|
|
74
|
+
# real uninstall (not an upgrade), before the executor is removed, with
|
|
75
|
+
# SYNOPKGLAND_DELETE_STATE=0|1 and SYNOPKGLAND_REMOVE_DATA=0|1 from the wizard.
|
|
76
|
+
# A failure or timeout is logged (syslog tag synopkgland-uninstall, output in
|
|
77
|
+
# var/uninstall-hook.log) and never blocks the uninstall. The backend's
|
|
78
|
+
# `uninstall` mode deletes the background job spool when the admin ticks
|
|
79
|
+
# "delete state"; add uninstall.state.jobs to i18n/messages in every language.
|
|
80
|
+
# uninstall:
|
|
81
|
+
# purge:
|
|
82
|
+
# exec: ui/cgi/api.cgi
|
|
83
|
+
# args: [uninstall]
|
|
84
|
+
# timeout: 60 # seconds, 2..120
|
|
85
|
+
# # root: purge # rootOps only: root/purge.sh runs as root at
|
|
86
|
+
# # # uninstall, and only while its approval stands
|
|
87
|
+
# state:
|
|
88
|
+
# items:
|
|
89
|
+
# - key: jobs # i18n key uninstall.state.jobs
|
|
@@ -37,7 +37,7 @@ func main() {
|
|
|
37
37
|
defer stop()
|
|
38
38
|
log.Printf("started as uid %s", strconv.Itoa(info.UID))
|
|
39
39
|
dataDir := "/var/packages/" + packageID + "/var"
|
|
40
|
-
service := &delegate.Service{Client: delegate.Local(packageID), Store: background.NewStore(dataDir + "/background"), StagingDir: dataDir + "/executor-staging"}
|
|
40
|
+
service := &delegate.Service{Client: delegate.Local(packageID), Store: background.NewStore(dataDir + "/background"), StagingDir: dataDir + "/executor-staging", Work: app.HashWork}
|
|
41
41
|
settings, err := app.ParseDelegateConfig(app.Config{DelegateScope: delegateScope, DelegateOperationsJSON: delegateOperationsJSON, DelegateDestinationsJSON: delegateDestinationsJSON, DelegateLifetime: delegateLifetime})
|
|
42
42
|
if err != nil {
|
|
43
43
|
log.Fatal(err)
|
|
@@ -35,11 +35,15 @@ func init() {
|
|
|
35
35
|
sampleParams["bg.jobs.list"] = `{}`
|
|
36
36
|
sampleParams["bg.jobs.get"] = id
|
|
37
37
|
sampleParams["bg.jobs.cancel"] = id
|
|
38
|
+
sampleParams["bg.jobs.pause"] = id
|
|
39
|
+
sampleParams["bg.jobs.resume"] = id
|
|
38
40
|
sampleParams["bg.jobs.result"] = id
|
|
39
41
|
sampleOutcome["bg.browse"] = "session_required"
|
|
40
42
|
sampleOutcome["bg.jobs.submit"] = "session_required"
|
|
41
43
|
sampleOutcome["bg.jobs.get"] = "not_found"
|
|
42
44
|
sampleOutcome["bg.jobs.cancel"] = "not_found"
|
|
45
|
+
sampleOutcome["bg.jobs.pause"] = "not_found"
|
|
46
|
+
sampleOutcome["bg.jobs.resume"] = "not_found"
|
|
43
47
|
sampleOutcome["bg.jobs.result"] = "not_found"
|
|
44
48
|
}
|
|
45
49
|
|
|
@@ -18,3 +18,24 @@ test('a jobs project mounts the background panel for the signed-in user',async()
|
|
|
18
18
|
expect(root.querySelector('[data-page="background"]')).not.toBeNull()
|
|
19
19
|
}finally{app.unmount();root.remove()}
|
|
20
20
|
})
|
|
21
|
+
test('the background panel pauses a running job and resumes a paused one',async()=>{
|
|
22
|
+
const submitter={user:'alice',uid:'1024'}
|
|
23
|
+
const jobs=[{id:'run',name:'a.bin',state:'running',submitter},{id:'held',name:'b.bin',state:'paused',pauseReason:'user',submitter}]
|
|
24
|
+
const call=vi.fn(async(method:string):Promise<unknown>=>{
|
|
25
|
+
if(method==='app.status')return {package:'Jobs',version:'1',user:'alice',admin:false}
|
|
26
|
+
if(method==='bg.status')return {owner:submitter,admin:false,revision:1,worker:{username:'pkg',alive:true},limits:{maxInputBytes:1024,maxQueued:8,maxOwnerPending:4,maxOwnerBytes:4096,jobTimeoutSeconds:60}}
|
|
27
|
+
if(method==='bg.jobs.list')return {jobs}
|
|
28
|
+
if(method==='bg.schedules.list')return {schedules:[]}
|
|
29
|
+
return {}
|
|
30
|
+
})
|
|
31
|
+
const root=document.createElement('div');document.body.append(root)
|
|
32
|
+
const app=mount(root,{locale:'en',call,reopen:()=>()=>{}} as unknown as Context)
|
|
33
|
+
const button=(id:string,label:string)=>Array.from(root.querySelectorAll(`[data-job-id="${id}"] button`)).find(b=>b.textContent===label) as HTMLButtonElement|undefined
|
|
34
|
+
try{
|
|
35
|
+
await settle()
|
|
36
|
+
button('run','Pause')!.click();await settle()
|
|
37
|
+
expect(call).toHaveBeenCalledWith('bg.jobs.pause',{id:'run'})
|
|
38
|
+
button('held','Resume')!.click();await settle()
|
|
39
|
+
expect(call).toHaveBeenCalledWith('bg.jobs.resume',{id:'held'})
|
|
40
|
+
}finally{app.unmount();root.remove()}
|
|
41
|
+
})
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"name": "native-dsm-vue-app",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@lucide/vue": "1.48.0",
|
|
10
|
-
"@synopackageland/sdk": "0.9.
|
|
10
|
+
"@synopackageland/sdk": "0.9.7",
|
|
11
11
|
"@synopackageland/ui": "0.9.2",
|
|
12
12
|
"vue": "3.5.43"
|
|
13
13
|
},
|
|
@@ -1148,9 +1148,9 @@
|
|
|
1148
1148
|
}
|
|
1149
1149
|
},
|
|
1150
1150
|
"node_modules/@synopackageland/sdk": {
|
|
1151
|
-
"version": "0.9.
|
|
1152
|
-
"resolved": "https://registry.npmjs.org/@synopackageland/sdk/-/sdk-0.9.
|
|
1153
|
-
"integrity": "sha512-
|
|
1151
|
+
"version": "0.9.7",
|
|
1152
|
+
"resolved": "https://registry.npmjs.org/@synopackageland/sdk/-/sdk-0.9.7.tgz",
|
|
1153
|
+
"integrity": "sha512-uU0GvgMXmTRX4UMrm6NUDQEiPdVze1Y6uE/mwmM8kqrhnLhe90kt0RrcSoEpSj9KMH+bXACz1Dw3OBRygiA2wg==",
|
|
1154
1154
|
"license": "MIT",
|
|
1155
1155
|
"peerDependencies": {
|
|
1156
1156
|
"@lucide/vue": "^1.48.0",
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
# __DISPLAY_NAME__
|
|
2
|
+
|
|
3
|
+
A native DSM package (`__PACKAGE__`): a Rust backend that DSM runs as a CGI,
|
|
4
|
+
and a UI that opens in its own DSM window. It installs as an **unsigned** SPK,
|
|
5
|
+
runs as its own DSM package account, needs no containers, and has no root by default.
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
DSM main menu → DSM window (ui/app.js)
|
|
9
|
+
│ ctx.call("greeting.get") same-origin POST + DSM session
|
|
10
|
+
▼
|
|
11
|
+
/webman/3rdparty/__PACKAGE__/cgi/api.cgi (backend/, runs as package user)
|
|
12
|
+
1. transport guards: POST, JSON, same origin, ≤ 1 MiB, bounded JSON complexity
|
|
13
|
+
2. one DSM authentication (unless the route is Public)
|
|
14
|
+
3. route policy: User or Admin → refusal before any handler
|
|
15
|
+
4. your handler (backend/src/app)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick start
|
|
19
|
+
|
|
20
|
+
Needs Node.js with `synopkgland` installed, and Rust through rustup:
|
|
21
|
+
`backend/rust-toolchain.toml` pins 1.97.1 with the three DSM targets, so the
|
|
22
|
+
first `cargo` run installs them.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
(cd backend && cargo test --locked) # auth policy + route tests
|
|
26
|
+
synopkgland build # → dist/__PACKAGE__-0.1.0-0001-{x86_64,aarch64}.spk
|
|
27
|
+
synopkgland inspect dist/__PACKAGE__-0.1.0-0001-x86_64.spk
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Install: Package Center → Settings → General → Trust Level "Any publisher",
|
|
31
|
+
then Manual Install with the SPK for your NAS's CPU. Open
|
|
32
|
+
**__DISPLAY_NAME__** from the DSM main menu: it shows who you are signed in
|
|
33
|
+
as, what the backend reports, and (for administrators) a form that stores a
|
|
34
|
+
greeting in the package's data folder.
|
|
35
|
+
|
|
36
|
+
## Capabilities and schema 2
|
|
37
|
+
|
|
38
|
+
`dsm-package.yaml` requires `schema: 2` and `backend: {kind: rust, dir: backend, package: app}`.
|
|
39
|
+
Declare `capabilities.files: session` for interactive File Station access,
|
|
40
|
+
`capabilities.jobs: true` for persistent package-account jobs,
|
|
41
|
+
`capabilities.identity: standalone` for independent DSM login, and
|
|
42
|
+
`capabilities.rootOps: true` for administrator-approved fixed executor operations.
|
|
43
|
+
`init --with files,jobs,root-ops` supports plain and Vue UI; `login` and
|
|
44
|
+
`delegate` need the Vue UI. `daemon` cannot be combined with `jobs`, but it can
|
|
45
|
+
be combined with an until-revoked `delegate`.
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
synopkgland add files jobs login
|
|
49
|
+
synopkgland check --json
|
|
50
|
+
synopkgland status --host my-nas --json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`add` writes SDK overlay files and updates capabilities. Your handlers/pages and
|
|
54
|
+
application entry files remain app-owned. Differing existing overlay files and
|
|
55
|
+
modified SDK placeholders cause `ADD_FILE_CONFLICT` with the conflicting paths;
|
|
56
|
+
resolve them before retrying. Already-declared capabilities are a no-op.
|
|
57
|
+
`check`, `build`, `inspect`, `deploy`, `status` emit one stdout object with
|
|
58
|
+
`--json`; failures include `code`, `message`, `hint`.
|
|
59
|
+
|
|
60
|
+
## Project layout
|
|
61
|
+
|
|
62
|
+
| Path | What it is | Edit it? |
|
|
63
|
+
| --- | --- | --- |
|
|
64
|
+
| `dsm-package.yaml` | Package identity, version/build, arches, where backend and UI come from | Yes |
|
|
65
|
+
| `ui/app.js`, `ui/app.css` | The app inside the DSM window | Yes — your UI |
|
|
66
|
+
| `ui/…` | Any other assets; served from `/webman/3rdparty/__PACKAGE__/app/` | Yes |
|
|
67
|
+
| `i18n/messages/<locale>.json` | UI text in nine languages | Yes |
|
|
68
|
+
| `i18n/glossary.json` | DSM's own UI terms, and which messages must use them | Add terms |
|
|
69
|
+
| `backend/src/app/` | Your API: routes and handlers | Yes — your backend |
|
|
70
|
+
| `backend/permissions.json` | Who may call each of your methods | Yes |
|
|
71
|
+
| `backend/src/bin/api.rs` | Wires your routes to the SDK server | Rarely |
|
|
72
|
+
| `backend/Cargo.toml`, `backend/Cargo.lock` | Your crate; the `syno-pkg-land-sdk` dependency's `tag` pins the SDK, and the committed lock file pins everything else | SDK upgrades |
|
|
73
|
+
| `backend/rust-toolchain.toml` | The Rust release and DSM targets the SPK is built with | Toolchain upgrades |
|
|
74
|
+
| `dist/` | Built SPKs (ignored by git) | No |
|
|
75
|
+
|
|
76
|
+
`build` generates everything else: `INFO`, `conf/privilege`
|
|
77
|
+
(`run-as: package`), no-op lifecycle scripts, icons, the DSM window wrapper
|
|
78
|
+
(`ui/config`, `ui/window-<build>.js`) and the CGI at `ui/cgi/api.cgi`.
|
|
79
|
+
|
|
80
|
+
## Add an API operation
|
|
81
|
+
|
|
82
|
+
Add a handler in `backend/src/app/routes.rs`. Every method defaults to
|
|
83
|
+
DSM administrator membership, resolved by its native SDK. All access rules live in
|
|
84
|
+
`backend/permissions.json`, including launcher access:
|
|
85
|
+
|
|
86
|
+
```rust
|
|
87
|
+
pub fn routes(cfg: Config) -> Vec<Route> {
|
|
88
|
+
let cfg = Arc::new(cfg);
|
|
89
|
+
vec![
|
|
90
|
+
cfg.handle("app.status", Config::status),
|
|
91
|
+
cfg.handle("greeting.get", Config::get_greeting),
|
|
92
|
+
cfg.handle("greeting.set", Config::set_greeting),
|
|
93
|
+
cfg.handle("notes.list", Config::list_notes), // new: administrators by default
|
|
94
|
+
cfg.handle("notes.purge", Config::purge_notes), // new: administrators by default
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
impl Config {
|
|
99
|
+
fn list_notes(&self, _: &Context, caller: &Caller, params: &[u8]) -> Result<Value, BoxError> {
|
|
100
|
+
#[derive(Default, Deserialize)]
|
|
101
|
+
#[serde(deny_unknown_fields)]
|
|
102
|
+
struct Params {
|
|
103
|
+
#[serde(default)]
|
|
104
|
+
limit: i64,
|
|
105
|
+
}
|
|
106
|
+
let _params: Params = decode_params(params)?;
|
|
107
|
+
Ok(json!({"owner": caller.user(), "notes": []}))
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Then add the method's valid params to `samples()` in `test_support.rs`; the
|
|
113
|
+
test fails until you do, and once you do it proves the new route refuses
|
|
114
|
+
callers without a session and ordinary users without touching
|
|
115
|
+
the data folder.
|
|
116
|
+
|
|
117
|
+
Call it from the UI with `ctx.call("notes.list", { limit: 20 })`. Errors
|
|
118
|
+
reject with `{ code, message }`, for example `session_required`,
|
|
119
|
+
`admin_required`, `bad_request` or `internal`.
|
|
120
|
+
|
|
121
|
+
### Who can call what
|
|
122
|
+
|
|
123
|
+
The shipped policy is:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{"schema": 1, "default": "administrators", "methods": {}}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The default must remain `administrators`. An intentional exception belongs in
|
|
130
|
+
`methods`, for example `"notes.list": "authenticated"`; `"public"` explicitly
|
|
131
|
+
allows anonymous calls. Such exceptions also enable ordinary-user launcher
|
|
132
|
+
access. The template ships no exceptions and sets DSM `allUsers` to `false`.
|
|
133
|
+
|
|
134
|
+
| JSON rule | No session | Ordinary user | Administrators group member |
|
|
135
|
+
| --- | --- | --- | --- |
|
|
136
|
+
| absent or `administrators` | `session_required` | `admin_required` | runs |
|
|
137
|
+
| explicit `authenticated` | `session_required` | runs | runs |
|
|
138
|
+
| explicit `public` | runs | runs | runs |
|
|
139
|
+
| unregistered method | `session_required` | `unknown_method` | `unknown_method` |
|
|
140
|
+
|
|
141
|
+
Missing or invalid JSON, duplicate keys, unknown permissions and rules for
|
|
142
|
+
unregistered methods fail closed. The CLI validates the file and binds its
|
|
143
|
+
SHA-256 digest to the compiled CGI, which checks it at startup before migration.
|
|
144
|
+
Changing policy requires rebuilding the SPK; request parameters cannot alter it.
|
|
145
|
+
Register routes with `Route::handle`. Binary reads cannot be configured as anonymous.
|
|
146
|
+
|
|
147
|
+
## The SDK
|
|
148
|
+
|
|
149
|
+
Everything outside `backend/src/app`, `backend/permissions.json`
|
|
150
|
+
and your UI comes from the SDK: the Rust crate `syno-pkg-land-sdk`
|
|
151
|
+
(a git dependency pinned by `tag` in `backend/Cargo.toml`, the single source of the SDK version; `Cargo.lock` records the same tag) and, for the
|
|
152
|
+
Vue UI, the npm package `@synopackageland/sdk` at the same version. Transport
|
|
153
|
+
guards, DSM authentication, the administrator check, File Station, jobs,
|
|
154
|
+
identity, portal, migrations and the executor protocol are documented in the SDK
|
|
155
|
+
repository: <https://github.com/synopackageland/syno-pkg-land-sdk>.
|
|
156
|
+
|
|
157
|
+
Upgrade the SDK by changing the dependency's `tag` and running `cargo update -p
|
|
158
|
+
syno-pkg-land-sdk` (and changing `frontend/package.json`) to the new version; `synopkgland check` refuses mismatched versions.
|
|
159
|
+
|
|
160
|
+
## Customize the UI
|
|
161
|
+
|
|
162
|
+
`ui/app.js` must register `window.DsmPackageApps[<package>].mount(root, ctx)`
|
|
163
|
+
(the template shows how, using `document.currentScript.dataset.package`).
|
|
164
|
+
`ctx.call(method, params)` is the only transport. `ctx.reopen(fn)` runs `fn`
|
|
165
|
+
whenever DSM shows the window again and returns an idempotent unsubscribe function. Scope your CSS under your own root class:
|
|
166
|
+
every DSM app shares one page.
|
|
167
|
+
|
|
168
|
+
Plain JS and Vue receive the same `ctx.host` adapter. `ctx.host.platform()`
|
|
169
|
+
returns a fresh frozen snapshot: `web`, `host` (`dsm`, `standalone-web` or
|
|
170
|
+
`unavailable`), `dsmStandalone`, `dsmLanguage`, `appLocale`, `systemVersion`,
|
|
171
|
+
`fullVersion`, and `theme`. Unknown fields are `null`; `theme` stays unknown.
|
|
172
|
+
DSM launch mode is separate from plain-web fallback, and `appLocale` is the
|
|
173
|
+
app's catalog locale, which may differ from DSM's UI language code.
|
|
174
|
+
|
|
175
|
+
```js
|
|
176
|
+
const platform = ctx.host.platform();
|
|
177
|
+
const result = ctx.host.setTitle('My notes');
|
|
178
|
+
if (result.status !== 'ok') showTitleStatus(result.status);
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
`setTitle` enables DSM HTML encoding or assigns standalone `document.title`.
|
|
182
|
+
It returns `{status: 'ok', target: 'dsm-window' | 'document'}` on synchronous
|
|
183
|
+
completion, or `unsupported`, `unavailable`, `invalid-input`, `failed` statuses.
|
|
184
|
+
A missing DSM method is unsupported; it never changes the DSM desktop's title.
|
|
185
|
+
Destroy disposes the adapter and clears reopen handlers; retained adapters
|
|
186
|
+
return unavailable. Navigation exposes activateWindow/requestClose/openApp/openURL;
|
|
187
|
+
requests do not acknowledge completion. `ctx.host.subscribe('window-resize', fn)`
|
|
188
|
+
returns `{status: 'subscribed', dispose}` only for a verified DSM window with on/un.
|
|
189
|
+
The callback receives no native arguments. Remove your subscriptions on unmount;
|
|
190
|
+
wrapper destroy also cleans them. `host-theme-change` and `host-language-change`
|
|
191
|
+
return unsupported: no third-party host event is proven. These observations do
|
|
192
|
+
not authorize work.
|
|
193
|
+
|
|
194
|
+
`ctx.host.openFileManager('/example-share/docs')` requests File Station folder
|
|
195
|
+
navigation; `revealFile('/home/report.txt')` requests a file highlight. Both require
|
|
196
|
+
a registered, enabled and launchable File Station and report requested plus action,
|
|
197
|
+
not location completion or ACL success. Use canonical virtual share paths only;
|
|
198
|
+
OS `/volumeN/...`, traversal, repeated/trailing slash, controls and backslash are
|
|
199
|
+
invalid. No path conversion or grant is performed. `openFile`, `showFileDetails`
|
|
200
|
+
and `openAppSetting` return unsupported; private preview/details/settings flows
|
|
201
|
+
have no proven generic contract.
|
|
202
|
+
|
|
203
|
+
File reveal adds a best-effort correction using File Station 1.4.x private
|
|
204
|
+
structures. Required APIs are feature-detected; absent/throwing APIs silently
|
|
205
|
+
cancel and release timers/listeners. One AppLaunch callback binds one receiver;
|
|
206
|
+
only its model may be selected once. Interaction, navigation away from the reached
|
|
207
|
+
parent, close/destroy, disposal and new requests cancel the correction. The named
|
|
208
|
+
5000 ms total budget, 100 ms checks and 300 ms quiet interval have no device latency
|
|
209
|
+
proof. `requested` still does not mean `selected`; actual effectiveness on DSM 7.4 /
|
|
210
|
+
File Station 1.4.4 awaits a rebuilt-SPK device matrix. No second launch or broadcast
|
|
211
|
+
setter is used, and later reloads may still clear selection.
|
|
212
|
+
|
|
213
|
+
For an independent browser shell, use the SPK's generated `ui/host-0001.js`
|
|
214
|
+
(the number follows the manifest build). It has no Ext or npm runtime dependency:
|
|
215
|
+
|
|
216
|
+
```html
|
|
217
|
+
<script src="./host-0001.js"></script>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
```js
|
|
221
|
+
// shellContext supplies your app's own auth/transport and other context members.
|
|
222
|
+
const ctx = {...shellContext, host: window.DsmPackageHosts.__PACKAGE__({locale: 'en'})};
|
|
223
|
+
const app = window.DsmPackageApps.__PACKAGE__.mount(root, ctx);
|
|
224
|
+
// When your shell unmounts:
|
|
225
|
+
ctx.host.dispose();
|
|
226
|
+
app.unmount();
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Serve the generated script with your shell (or reference its same-origin DSM
|
|
230
|
+
static path). `ctx.host` does not create a standalone backend, DSM session,
|
|
231
|
+
cross-origin iframe bridge, or implementations of `ctx.call/t/root/reopen`.
|
|
232
|
+
Standalone title affects the document shared by that shell's mounts.
|
|
233
|
+
|
|
234
|
+
To build the UI with Vite, Vue or React, point `ui` at the build output and
|
|
235
|
+
give the build command as an argv list (no shell):
|
|
236
|
+
|
|
237
|
+
```yaml
|
|
238
|
+
ui:
|
|
239
|
+
dir: web/dist
|
|
240
|
+
build:
|
|
241
|
+
cwd: web
|
|
242
|
+
command: [npm, run, build]
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The build must emit `app.js` (one script that registers `mount`) and
|
|
246
|
+
`app.css`. The installed `@synopackageland/ui` package gives Vue components with DSM 7 styling;
|
|
247
|
+
import its `themes/dsm7-embedded.css` for use inside a DSM window.
|
|
248
|
+
|
|
249
|
+
## Languages
|
|
250
|
+
|
|
251
|
+
The UI ships in nine of DSM's languages: `en`, `zh-TW`,
|
|
252
|
+
`zh-CN`, `ja`, `ko`, `de`, `fr`, `es` and `it`. DSM's other languages show
|
|
253
|
+
English. The window follows DSM's own language setting (`_S("lang")`).
|
|
254
|
+
|
|
255
|
+
- **Messages**: `i18n/messages/<locale>.json`, flat `"key": "text"`. Use
|
|
256
|
+
`ctx.t("greeting.setBy", { text, user })` in the UI; `{name}` is a
|
|
257
|
+
placeholder, and `ctx.t("files", { count: 3 })` picks `files.one` or
|
|
258
|
+
`files.other`. Missing keys fall back to English, then to the key itself.
|
|
259
|
+
`build` embeds the catalogs in the DSM window script, so there is no
|
|
260
|
+
extra request.
|
|
261
|
+
- **Errors**: the backend returns a `code`; the UI shows
|
|
262
|
+
`error.<code>` from the catalogs and uses the backend's English text only for
|
|
263
|
+
codes it has no message for. Add `error.<code>` for every code you return.
|
|
264
|
+
- **Glossary**: `i18n/glossary.json` records DSM's own words in all nine
|
|
265
|
+
languages, each with its source (`section/key` in DSM 7.4's
|
|
266
|
+
`/usr/syno/synoman/webman/texts/<lang>/strings`). A term's `keys` lists the
|
|
267
|
+
messages that must contain it; that is how "Save" uses DSM's own word in
|
|
268
|
+
every language, the same as the rest of DSM. Product names in `untranslated`
|
|
269
|
+
stay in English everywhere.
|
|
270
|
+
- **Package Center text**: `i18n.info` in `dsm-package.yaml` writes INFO
|
|
271
|
+
`displayname_<lang>` / `description_<lang>` (for example `description_cht`).
|
|
272
|
+
|
|
273
|
+
`synopkgland check` and `build` refuse a language file with missing or
|
|
274
|
+
extra keys, a translation that drops a `{placeholder}`, an unsupported
|
|
275
|
+
language, or a listed message that drifts from the glossary.
|
|
276
|
+
|
|
277
|
+
To add a message: add the key to `en.json` and to the other eight files. To
|
|
278
|
+
use a DSM term, copy its `text` from the glossary and add your key to the
|
|
279
|
+
term's `keys`. A Vue or React UI can keep its own i18n library; `ctx.t` and
|
|
280
|
+
`ctx.locale` are there if you want them.
|
|
281
|
+
|
|
282
|
+
The Vue shell (`--ui vue`) keeps the app's own text in `frontend/src/i18n/<locale>.json`,
|
|
283
|
+
in the same nine languages; SDK components (sign-in, files, background jobs) ship
|
|
284
|
+
their own catalogs. Add new text to all nine files rather than writing it into a
|
|
285
|
+
`.vue` file.
|
|
286
|
+
|
|
287
|
+
## Package an existing binary
|
|
288
|
+
|
|
289
|
+
Keep the Rust backend and call your tool from a handler (recommended: auth
|
|
290
|
+
stays central), or replace the CGI with your own executable:
|
|
291
|
+
|
|
292
|
+
```yaml
|
|
293
|
+
arches: [x86_64]
|
|
294
|
+
backend:
|
|
295
|
+
kind: binary
|
|
296
|
+
files:
|
|
297
|
+
x86_64: prebuilt/api-x86_64
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
The file must be a regular file in the project, a 64-bit Linux ELF for that
|
|
301
|
+
arch, and statically linked (DSM models ship different libc versions). It is
|
|
302
|
+
installed as `ui/cgi/api.cgi` (mode 0755) and runs as the package account.
|
|
303
|
+
It then owns everything the SDK server does for you: bounded reads,
|
|
304
|
+
POST-only JSON, same-origin checks, authentication before any work, and a
|
|
305
|
+
refusal for unknown methods.
|
|
306
|
+
|
|
307
|
+
## DSM Application Portal link
|
|
308
|
+
|
|
309
|
+
Only an App with the root executor (`rootOps` or `delegate`) can declare a
|
|
310
|
+
portal; `synopkgland add root-ops portal` declares both. Uninstall then
|
|
311
|
+
removes the App's Application Privileges rules and reloads nginx once DSM has
|
|
312
|
+
removed the alias, so it stops answering. `synopkgland add portal` adds
|
|
313
|
+
`portal: {}` to dsm-package.yaml so
|
|
314
|
+
`https://<nas>/<alias>/` opens this app right after DSM sign-in. The install
|
|
315
|
+
wizard proposes the alias (the package name in lowercase by default); an
|
|
316
|
+
administrator turns it on from the app's portal panel or Control Panel >
|
|
317
|
+
Login Portal > Applications. Ordinary users then see the link; until then
|
|
318
|
+
they see "ask an administrator". DSM owns the setting: the backend's
|
|
319
|
+
`portal.status` only reads it, and nothing in the package may write it. See
|
|
320
|
+
`synopkgland skill show portal`.
|
|
321
|
+
|
|
322
|
+
A portal needs DSM 7.3.2-86009 or later, so `add portal` raises a lower
|
|
323
|
+
`os_min_ver` and build refuses one below it. DSM 7.1.1 rejects an unsigned
|
|
324
|
+
package that registers a portal (Package Center error 320); 7.3.2 and 7.4
|
|
325
|
+
install it; 7.2 is untested. To keep supporting older DSM, remove `portal:`.
|
|
326
|
+
|
|
327
|
+
## Data, upgrades, uninstall
|
|
328
|
+
|
|
329
|
+
The backend stores data in `/var/packages/__PACKAGE__/var` (the package's
|
|
330
|
+
own folder, kept across upgrades). Bump `build` for every SPK you hand out;
|
|
331
|
+
bump `version` for feature releases. There are no lifecycle scripts to write:
|
|
332
|
+
the CGI starts per request, so start/stop do nothing.
|
|
333
|
+
|
|
334
|
+
### What an upgrade keeps
|
|
335
|
+
|
|
336
|
+
An upgrade replaces the program files and keeps the data. DSM preserves `var`
|
|
337
|
+
(`@appdata`), `home` (`@apphome`) and `etc` (`@appconf`) across an upgrade and
|
|
338
|
+
removes `tmp` (`@apptemp`) and `target` (`@appstore`). Keep everything you need
|
|
339
|
+
to keep under `var`, `home` or `etc`.
|
|
340
|
+
|
|
341
|
+
### Schema migrations
|
|
342
|
+
|
|
343
|
+
The SDK's `datamigrate` module applies ordered, idempotent schema migrations and
|
|
344
|
+
records the result in `<var>/data-version`. `backend/src/bin/api.rs` runs `app::migrate`
|
|
345
|
+
on every start; the recorded version makes that a cheap no-op.
|
|
346
|
+
|
|
347
|
+
- Versions start at 1 and never change meaning. The template ships one empty
|
|
348
|
+
example in `backend/src/app/migrations.rs`; replace it with your steps.
|
|
349
|
+
- Every step must be idempotent: a crash between the step and the version record,
|
|
350
|
+
or two CGI requests racing on the first start after an upgrade, can run one step
|
|
351
|
+
twice.
|
|
352
|
+
- A step that fails stops the run with the previous version still recorded, and
|
|
353
|
+
the next start resumes from there. The helper never deletes or rewrites data
|
|
354
|
+
itself, so a failed migration leaves your old data in place.
|
|
355
|
+
- `datamigrate::Context::old_pkg_ver` is the version being upgraded from:
|
|
356
|
+
`SYNOPKG_OLD_PKGVER` when your environment sets it, otherwise the version the last
|
|
357
|
+
successful run recorded. `new_pkg_ver` is the version running now.
|
|
358
|
+
|
|
359
|
+
Uninstalling keeps your data: DSM leaves `@appdata` and `@apphome` on the volume,
|
|
360
|
+
and reinstalling the same package ID picks them up again. The install wizard is a
|
|
361
|
+
dynamic `WIZARD_UIFILES/install_uifile.sh` that checks — read-only — whether
|
|
362
|
+
`@appdata/<package>` already exists and, if it does, tells the administrator the
|
|
363
|
+
install reuses the old data and how to start clean.
|
|
364
|
+
|
|
365
|
+
The generated SPK ships
|
|
366
|
+
an uninstall wizard (English, plus eight other languages) with one box, **Also
|
|
367
|
+
delete the app data listed above** (`pkgwizard_remove_additional`), unchecked by
|
|
368
|
+
default. Ticked, `postuninst` empties `@appdata/<package>`, `@apphome/<package>`
|
|
369
|
+
and `@appconf/<package>` and nothing else: not Shared Folders, the package
|
|
370
|
+
account or other packages. An upgrade never deletes anything. Do not write your own `postuninst`;
|
|
371
|
+
`synopkgland inspect` flags a deleting script that lacks the upgrade guard
|
|
372
|
+
or deletes outside the package's own folders.
|
|
373
|
+
|
|
374
|
+
## Support matrix
|
|
375
|
+
|
|
376
|
+
| | Status |
|
|
377
|
+
| --- | --- |
|
|
378
|
+
| Build hosts | macOS, Linux (any OS with Rust and Node) |
|
|
379
|
+
| Target CPUs | x86_64 and aarch64 DSM models (one SPK each). armv7 (DSM 7.2+ platforms `alpine`, `alpine4k`, `armada38x`, `monaco`) is opt-in: add it to `arches`; it covers the Rust CGI (plain or Vue UI), jobs, daemon, root-ops and delegate. armv7 jobs, daemon and executor (root-ops, delegate) are built and checked locally but have not been verified on a NAS |
|
|
380
|
+
| DSM | 7.1 or later declared (`os_min_ver`, change it with `init --min-dsm` or `build --min-dsm`). Installed and tested on DSM 7.4 and 7.3.2 (x86_64). armv7 was installed and tested on DSM 7.1.1 (`alpine4k`, Linux 3.10, where the bridge runs from the package tmp fallback) with administrator, AppPriv and unauthenticated requests; `armada38x` and `monaco` have not been run on a NAS. No x86_64 Linux 3.10 model has been tested. aarch64 SPKs are built the same way but have not been run on a NAS. |
|
|
381
|
+
| Not supported | armv7 platforms only DSM 7.0/7.1 ship (`armada370`, `armada375`, `armadaxp`, `comcerto2k`); DSM 6, running anything as root without an administrator's approval |
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "app"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"libc",
|
|
10
|
+
"serde",
|
|
11
|
+
"serde_json",
|
|
12
|
+
"syno-pkg-land-sdk",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[[package]]
|
|
16
|
+
name = "itoa"
|
|
17
|
+
version = "1.0.18"
|
|
18
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
19
|
+
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
|
20
|
+
|
|
21
|
+
[[package]]
|
|
22
|
+
name = "libc"
|
|
23
|
+
version = "0.2.190"
|
|
24
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
25
|
+
checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"
|
|
26
|
+
|
|
27
|
+
[[package]]
|
|
28
|
+
name = "memchr"
|
|
29
|
+
version = "2.8.3"
|
|
30
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
31
|
+
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|
32
|
+
|
|
33
|
+
[[package]]
|
|
34
|
+
name = "proc-macro2"
|
|
35
|
+
version = "1.0.107"
|
|
36
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
37
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
38
|
+
dependencies = [
|
|
39
|
+
"unicode-ident",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[[package]]
|
|
43
|
+
name = "quote"
|
|
44
|
+
version = "1.0.47"
|
|
45
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
46
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
47
|
+
dependencies = [
|
|
48
|
+
"proc-macro2",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[[package]]
|
|
52
|
+
name = "serde"
|
|
53
|
+
version = "1.0.229"
|
|
54
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
55
|
+
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
|
|
56
|
+
dependencies = [
|
|
57
|
+
"serde_core",
|
|
58
|
+
"serde_derive",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
[[package]]
|
|
62
|
+
name = "serde_core"
|
|
63
|
+
version = "1.0.229"
|
|
64
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
65
|
+
checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
|
|
66
|
+
dependencies = [
|
|
67
|
+
"serde_derive",
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
[[package]]
|
|
71
|
+
name = "serde_derive"
|
|
72
|
+
version = "1.0.229"
|
|
73
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
74
|
+
checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
|
75
|
+
dependencies = [
|
|
76
|
+
"proc-macro2",
|
|
77
|
+
"quote",
|
|
78
|
+
"syn",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
[[package]]
|
|
82
|
+
name = "serde_json"
|
|
83
|
+
version = "1.0.154"
|
|
84
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
85
|
+
checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
|
|
86
|
+
dependencies = [
|
|
87
|
+
"itoa",
|
|
88
|
+
"memchr",
|
|
89
|
+
"serde",
|
|
90
|
+
"serde_core",
|
|
91
|
+
"zmij",
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
[[package]]
|
|
95
|
+
name = "syn"
|
|
96
|
+
version = "3.0.8"
|
|
97
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
98
|
+
checksum = "01016da373cd8f7ef12624f796309f5c31ba8d646dd08856c02cd741d823c622"
|
|
99
|
+
dependencies = [
|
|
100
|
+
"proc-macro2",
|
|
101
|
+
"quote",
|
|
102
|
+
"unicode-ident",
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
[[package]]
|
|
106
|
+
name = "syno-pkg-land-sdk"
|
|
107
|
+
version = "0.9.7"
|
|
108
|
+
source = "git+https://github.com/synopackageland/syno-pkg-land-sdk?tag=v0.9.7#7f3a01ceb182caada349ee243c831efad3d3d93e"
|
|
109
|
+
dependencies = [
|
|
110
|
+
"libc",
|
|
111
|
+
"serde",
|
|
112
|
+
"serde_json",
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
[[package]]
|
|
116
|
+
name = "unicode-ident"
|
|
117
|
+
version = "1.0.27"
|
|
118
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
119
|
+
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
|
120
|
+
|
|
121
|
+
[[package]]
|
|
122
|
+
name = "zmij"
|
|
123
|
+
version = "1.0.23"
|
|
124
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
125
|
+
checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "app"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
publish = false
|
|
6
|
+
|
|
7
|
+
[[bin]]
|
|
8
|
+
name = "api"
|
|
9
|
+
path = "src/bin/api.rs"
|
|
10
|
+
|
|
11
|
+
[[bin]]
|
|
12
|
+
name = "background-worker"
|
|
13
|
+
path = "src/bin/background-worker.rs"
|
|
14
|
+
|
|
15
|
+
[dependencies]
|
|
16
|
+
libc = "0.2"
|
|
17
|
+
serde = { version = "1", features = ["derive"] }
|
|
18
|
+
serde_json = "1"
|
|
19
|
+
# The SDK version is the tag; `synopkgland check` reads it from Cargo.lock.
|
|
20
|
+
syno-pkg-land-sdk = { git = "https://github.com/synopackageland/syno-pkg-land-sdk", tag = "v0.9.7" }
|
|
21
|
+
|
|
22
|
+
[profile.release]
|
|
23
|
+
# A handler panic becomes an "internal" reply (api::Server); abort would end the CGI instead.
|
|
24
|
+
panic = "unwind"
|