Add Webhooks and XMPP notifications for incoming sats #79

Merged
raucao merged 10 commits from feature/webhooks into master 2023-01-13 04:33:02 +00:00
Owner
  • Migrate ln_login out of encrypted column to ln_account, so we can look up users by login
  • Add Webhooks controller and config for allowed IPs
  • Add send_message API to ejabberd service, plus respective background job
  • Add Webhook for incoming sats, which notifies the user via XMPP message
* Migrate `ln_login` out of encrypted column to `ln_account`, so we can look up users by login * Add Webhooks controller and config for allowed IPs * Add `send_message` API to ejabberd service, plus respective background job * Add Webhook for incoming sats, which notifies the user via XMPP message
raucao added 5 commits 2023-01-12 03:48:28 +00:00
WIP Add Webhooks controller, allowed IP config
All checks were successful
continuous-integration/drone/push Build is passing
68e0d00f6e
Add migration for unencrypted ln login field
All checks were successful
continuous-integration/drone/push Build is passing
51952ecdc2
Notify user about incoming sats via XMPP
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
9e988e92d1
raucao added 1 commit 2023-01-12 03:50:32 +00:00
Fix spec after renaming job
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
d4a3f8dadb
raucao added 3 commits 2023-01-12 06:33:47 +00:00
Add specs for lndhub webhook
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
a1663b9f9d
raucao changed title from WIP: Add Webhooks and XMPP notifications for incoming sats to Add Webhooks and XMPP notifications for incoming sats 2023-01-12 06:33:57 +00:00
raucao added the
kredits-2
label 2023-01-12 06:34:01 +00:00
raucao requested review from greg 2023-01-12 06:34:07 +00:00
raucao requested review from galfert 2023-01-12 06:34:08 +00:00
raucao requested review from bumi 2023-01-12 06:34:09 +00:00
bumi approved these changes 2023-01-13 00:17:59 +00:00
bumi left a comment
Owner

that's super cool!
from checking the code it looks good to me.
I have a few minor comments

that's super cool! from checking the code it looks good to me. I have a few minor comments
@ -0,0 +5,4 @@
def lndhub
begin
payload = JSON.parse(request.body.read, symbolize_names: true)
Owner

doesn't rails automatically parse the JSON because the proper content type is set?
so params[:type] and params[:user_login] should be enough?

doesn't rails automatically parse the JSON because the proper content type is set? so `params[:type]` and `params[:user_login]` should be enough?
Author
Owner

I didn't know, so I tried (also with explicitly setting the content type in the spec). Doesn't do it.

I didn't know, so I tried (also with explicitly setting the content type in the spec). Doesn't do it.
raucao marked this conversation as resolved
@ -0,0 +11,4 @@
head :unprocessable_entity and return
end
user = User.find_by(ln_account: payload[:user_login])
Owner

should not be the case, but this might be nil. maybe we should do a User.find_by!

should not be the case, but this might be nil. maybe we should do a `User.find_by!`
Author
Owner

Good idea! Fails much cleaner and more expressively than when trying to access properties on nil later.

Good idea! Fails much cleaner and more expressively than when trying to access properties on `nil` later.
raucao marked this conversation as resolved
raucao added 1 commit 2023-01-13 04:24:44 +00:00
Throw exception when user cannot be found
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
b0c787bbc7
raucao merged commit f62e49f524 into master 2023-01-13 04:33:02 +00:00
raucao deleted branch feature/webhooks 2023-01-13 04:33:02 +00:00
raucao removed review request for galfert 2023-01-13 04:33:19 +00:00
raucao removed review request for greg 2023-01-13 04:33:22 +00:00
raucao added the
feature
label 2023-03-28 14:43:05 +00:00
Sign in to join this conversation.
No description provided.