| 124 | pendingPasskeyMu.Lock() |
| 125 | delete(pendingPasskeyRequests, userID) |
| 126 | pendingPasskeyMu.Unlock() |
| 127 | } |
| 128 | |
| 129 | // peekPendingPasskey checks if there is a pending passkey request for this user |
| 130 | // WITHOUT consuming it. Used by /session/qr, /session/passkey-status, and |
| 131 | // /session/passkey-confirm. |
| 132 | func peekPendingPasskey(userID string) *PendingPasskeyState { |
| 133 | pendingPasskeyMu.Lock() |
| 134 | state, ok := pendingPasskeyRequests[userID] |
| 135 | pendingPasskeyMu.Unlock() |
| 136 | if !ok { |
| 137 | return nil |
| 138 | } |
| 139 | return state |
| 140 | } |
| 141 | |
| 142 | // ensureS3ClientForUser loads S3 config from DB and initializes client if not already present (lazy init for reconnect-after-restart) |
| 143 | func ensureS3ClientForUser(userID string) { |
| 144 | GetS3Manager().EnsureClientFromDB(userID) |
| 145 | } |
| 146 | |
| 147 | func sendToGlobalWebHook(jsonData []byte, token string, userID string) { |
| 148 | jsonDataStr := string(jsonData) |
| 149 | |
| 150 | instance_name := "" |
| 151 | userinfo, found := userinfocache.Get(token) |
| 152 | if found { |
| 153 | instance_name = userinfo.(Values).Get("Name") |
| 154 | } |
| 155 | |
| 156 | if *globalWebhook != "" { |
| 157 | log.Info().Str("url", *globalWebhook).Msg("Calling global webhook") |
| 158 | // Add extra information for the global webhook |