Commit 4d55c06
feat(sources): allow editing CalDAV sources
Closes #72. Today the source row supports test/sync/remove and
write-back-calendar selection but not editing the connection itself.
Typo'd URL? Username mistake? Periodic CalDAV password rotation? The
only path was delete-and-readd, which loses the synced events cache,
the write-back configuration, and any per-event-type calendar
selections that referenced calendars under the old source.
Adds an Edit affordance on each source row (web) and a `calrs source
update` command (CLI). The web POST and the CLI both go through small
DB updates that scope by user_id (web) or by id-prefix (CLI matching
existing convention).
Notable details:
- Password field is optional; empty means "keep existing". The web
handler decrypts the stored blob to feed the connection-test client
with credentials sync will use afterwards. The CLI uses an explicit
--password flag that prompts via rpassword (so password isn't echoed
and isn't visible in shell history).
- URL still passes validate_caldav_url (SSRF guard); the connection
test still respects the existing "Skip connection test" checkbox.
- After URL or username changes, both surfaces hint that a manual
sync is recommended to refresh the discovered calendar list. No
automatic re-sync — the discovery flow's resolve_url() already
re-resolves hrefs from the server origin, so the next manual sync
self-heals.
- Edit button only shown for sources the user owns; the GET handler
scopes by user_id and redirects on access mismatch.
Tests: 4 new web handler tests (form pre-fill, blank-password keeps
existing, password rotation re-encrypts, cross-user access blocked).
583 tests total (up from 579), all green on pre-commit. Clippy clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 80cd3ea commit 4d55c06
4 files changed
Lines changed: 453 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
43 | 60 | | |
44 | 61 | | |
45 | 62 | | |
| |||
160 | 177 | | |
161 | 178 | | |
162 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
163 | 247 | | |
164 | 248 | | |
165 | 249 | | |
| |||
0 commit comments