/// // Family onboarding template (distribution site). // // One admin-maintained record holding the *plaintext* addon config that new // family accounts start from: the onboarding page (pb_public) fetches it // through an invite-code-gated route, encrypts it in the browser under the new // user's password, and pushes the result as their addon_config blob — so the // server still only ever stores ciphertext per account, and family members get // a working setup without typing addon URLs. // // Deliberately NO adult fields: the template is family config by definition // (mirrors the #14/#20 child-profile stripping). Adult stays per-account, // configured manually. // // All rules are null → superusers only. Clients never read this collection // directly; the invite-gated hook (onboarding.pb.js) is the sole reader. // Maintain the single record via the PocketBase admin UI. migrate((app) => { const tpl = new Collection({ type: "base", name: "onboarding_template", listRule: null, viewRule: null, createRule: null, updateRule: null, deleteRule: null, fields: [ // Same value shapes SettingsRepository stores (base URLs, no trailing // /manifest.json). All optional so the record can be filled gradually. { type: "text", name: "addonUrl", max: 2000 }, { type: "text", name: "czechAddonUrl", max: 2000 }, { type: "text", name: "tmdbKey", max: 200 }, // Free-form admin note ("updated after TorBox key rotation" etc.) — // never served to clients. { type: "text", name: "note", max: 1000 }, { type: "autodate", name: "updated", onCreate: true, onUpdate: true }, ], }) app.save(tpl) }, (app) => { try { app.delete(app.findCollectionByNameOrId("onboarding_template")) } catch (_) { /* already gone */ } })