diff --git a/robosats/middleware.py b/robosats/middleware.py index ddc3aa97..12739db5 100644 --- a/robosats/middleware.py +++ b/robosats/middleware.py @@ -95,9 +95,11 @@ class RobotTokenSHA256AuthenticationMiddleWare: nostr_pubkey = request.META.get("NOSTR_PUBKEY", "").replace( "Nostr ", "" ) - token.user.robot.nostr_pubkey = nostr_pubkey - token.user.robot.save(update_fields=["nostr_pubkey"]) + if token.user.robot.nostr_pubkey != nostr_pubkey: + token.user.robot.nostr_pubkey = nostr_pubkey + + token.user.robot.save(update_fields=["nostr_pubkey"]) # END deprecate after v0.8.0 except Exception: