mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-09 21:43:05 +09:00
Follow-up to PR #94. ChatWebhookService.update() decrypted every stored credential and re-encrypted the lot on any credential-bearing request. decrypt_secret_safe() returns its input unchanged when a value will not decrypt, so a wrong-key or not-yet-migrated row got wrapped a second time and became unrecoverable -- and it happened to fields the request never named. It now patches the ciphertext dict directly and encrypts only what it assigns, so untouched credentials survive byte-identical. Also tolerate an unchanged is_default in a round-tripped body (to_dict() always emits it, so GET -> edit -> PUT rejected an untouched field), and record the delivery failure reason in the server log. The reason stays out of the HTTP response: transport errors embed the full webhook URL and any Telegram bot token. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>