A group row's menu has Copy to share: the group as JSON marked
"magpie": "routing-group" with a format version (provider.ShareGroup),
holding its members as it names them, patterns, routing, rules,
classifier and settings. A group holds provider/model ids only, so no
key, account or address goes with it; derived matches and the
found/hidden/off flags stay behind.
The Routing page's Import (by New group) opens a box the text is pasted
into, words or a code fence around it allowed. POST /api/groups/import
(provider.ImportGroup) adds it under a free name, never over a group.
A member whose provider the importer has is kept; else the same model
under one of their providers (listed as used instead); else it is left
out and listed, with the rules that send to it and its off/fast place;
a classifier gone takes the intent rules and auto effort. Nothing is
added when no member is left. Other text, a newer format or none is
refused in the reader's language (provider.ShareError, code "share").
Run:
- go test -tags nogui ./... (gateway failed once on a full disk, then
passed alone); new TestSharedGroupRoundTrip/MissingMembers/BadText and
TestGroupShareAndImport; the version check broken by hand turns them red
- gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...;
GOOS=windows go vet ./...; go build
- group-share.test.cjs in chromium and webkit, en/zh/zh-TW/ja/de, 420px;
every group-*, settings-groups, filter-ime, panel-routing GUI test
(210 pass); routing-* (550/557: webkit fold tests timed out only under
--test-concurrency=6 and pass alone; a webkit routing-* run under the
same load fails one test on origin/main too, a different one each run)
- real use: the owner's 12 groups from a sandbox copy of providers.json
each shared (no key in the text) and imported back whole