Compare commits
33
Commits
api
..
webapp/test2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52230d486e | ||
|
|
c8e45de27d | ||
|
|
6a01936c2e | ||
|
|
48374ad2a1 | ||
|
|
5b5f0ef6a2 | ||
|
|
b618b1aa41 | ||
|
|
c5f106187f | ||
|
|
f35473b010 | ||
|
|
359ae13057 | ||
|
|
8d0bf2cce7 | ||
|
|
f5c3d9fb55 | ||
|
|
56c391b24e | ||
|
|
cbdc8638bd | ||
|
|
046baab3e1 | ||
|
|
f0f3a7c5d0 | ||
|
|
43eb4966bc | ||
|
|
0d112e19de | ||
|
|
649be03c29 | ||
|
|
5e4c045312 | ||
|
|
44f397e2de | ||
|
|
9451032552 | ||
|
|
8180d3cfae | ||
|
|
f11ac3d807 | ||
|
|
cb02fd557f | ||
|
|
ac3ac51d7b | ||
|
|
ac9cc644eb | ||
|
|
545898dbbe | ||
|
|
d98aa26db9 | ||
|
|
13c0f3b70a | ||
|
|
3a4f99314d | ||
|
|
a0f7cf09e6 | ||
|
|
0ff0d889ff | ||
|
|
7009d3dedc |
@@ -58,7 +58,7 @@ You can either use your own LNbits instance (recommended) or create an account a
|
|||||||
- `lnbits_webhook_server`: URL that lnbits can reach the bot with. This is used for creating webhooks from LNbits to receive notifications about payments (optional).
|
- `lnbits_webhook_server`: URL that lnbits can reach the bot with. This is used for creating webhooks from LNbits to receive notifications about payments (optional).
|
||||||
- `message_dispose_duration`: Duration in seconds after which `/tip` are deleted from a channel (only if the bot is channel admin).
|
- `message_dispose_duration`: Duration in seconds after which `/tip` are deleted from a channel (only if the bot is channel admin).
|
||||||
- `http_proxy` uses a proxy for all LNURL-related outbound requests (optional).
|
- `http_proxy` uses a proxy for all LNURL-related outbound requests (optional).
|
||||||
- `lnurl_public_host_name` is the public URL of your lnbits/LndHub (for BlueWallet/Zap support, optional).
|
- `lnurl_public_host_name` is the public URL of your lnbits/LndHub (for BlueWallet/Zeus support, optional).
|
||||||
- `lnurl_server` is the public URL for inbound LNURL payments and your lightning address host (optional).
|
- `lnurl_server` is the public URL for inbound LNURL payments and your lightning address host (optional).
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
@@ -116,7 +116,7 @@ Users can send and receive via . For this to work, you need to set the `lnurl_pu
|
|||||||
|
|
||||||
Every user has a [Lightning Address](https://lightningaddress.com/) a la `username@host.com` with which they can send to via `/send <amount> <user@domain.com>` and receive from other wallets.
|
Every user has a [Lightning Address](https://lightningaddress.com/) a la `username@host.com` with which they can send to via `/send <amount> <user@domain.com>` and receive from other wallets.
|
||||||
|
|
||||||
### Link to BlueWallet or Zap
|
### Link to BlueWallet or Zeus
|
||||||
|
|
||||||
Every user can link their wallet to an external app like [Bluewallet](https://bluewallet.io/) or [Zeus](https://zeusln.app/) by using the command `/link`. If you host the bot, you will have to enable the LndHub extension in LNbits. You also need to edit the `lnbits_public_url` entry in `config.yaml` accordingly to an address that can be reached by the user's wallet (Tor should be fine as well).
|
Every user can link their wallet to an external app like [Bluewallet](https://bluewallet.io/) or [Zeus](https://zeusln.app/) by using the command `/link`. If you host the bot, you will have to enable the LndHub extension in LNbits. You also need to edit the `lnbits_public_url` entry in `config.yaml` accordingly to an address that can be reached by the user's wallet (Tor should be fine as well).
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ bot:
|
|||||||
lnurl_public_host_name: "mylnurl.com"
|
lnurl_public_host_name: "mylnurl.com"
|
||||||
lnurl_server: "https://mylnurl.com"
|
lnurl_server: "https://mylnurl.com"
|
||||||
lnurl_image: true
|
lnurl_image: true
|
||||||
|
admin_api_host: localhost:6060
|
||||||
telegram:
|
telegram:
|
||||||
message_dispose_duration: 10
|
message_dispose_duration: 10
|
||||||
api_key: "1234"
|
api_key: "1234"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ require (
|
|||||||
github.com/nicksnyder/go-i18n/v2 v2.1.2
|
github.com/nicksnyder/go-i18n/v2 v2.1.2
|
||||||
github.com/orcaman/concurrent-map v1.0.0
|
github.com/orcaman/concurrent-map v1.0.0
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||||
|
github.com/r3labs/sse v0.0.0-20210224172625-26fe804710bc
|
||||||
github.com/sirupsen/logrus v1.7.0
|
github.com/sirupsen/logrus v1.7.0
|
||||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||||
github.com/tidwall/buntdb v1.2.7
|
github.com/tidwall/buntdb v1.2.7
|
||||||
@@ -25,7 +26,6 @@ require (
|
|||||||
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f
|
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f
|
||||||
golang.org/x/text v0.3.7
|
golang.org/x/text v0.3.7
|
||||||
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
|
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
|
||||||
gopkg.in/lightningtipbot/telebot.v3 v3.0.0-20220326213923-f323bb71ac8e
|
|
||||||
gorm.io/driver/sqlite v1.1.4
|
gorm.io/driver/sqlite v1.1.4
|
||||||
gorm.io/gorm v1.21.12
|
gorm.io/gorm v1.21.12
|
||||||
)
|
)
|
||||||
@@ -72,7 +72,7 @@ require (
|
|||||||
github.com/miekg/dns v1.1.43 // indirect
|
github.com/miekg/dns v1.1.43 // indirect
|
||||||
github.com/nbd-wtf/ln-decodepay v1.5.1 // indirect
|
github.com/nbd-wtf/ln-decodepay v1.5.1 // indirect
|
||||||
github.com/pegasus-kv/thrift v0.13.0 // indirect
|
github.com/pegasus-kv/thrift v0.13.0 // indirect
|
||||||
github.com/spf13/cast v1.3.1 // indirect
|
github.com/spf13/cast v1.5.0 // indirect
|
||||||
github.com/tidwall/btree v0.6.1 // indirect
|
github.com/tidwall/btree v0.6.1 // indirect
|
||||||
github.com/tidwall/grect v0.1.3 // indirect
|
github.com/tidwall/grect v0.1.3 // indirect
|
||||||
github.com/tidwall/match v1.1.1 // indirect
|
github.com/tidwall/match v1.1.1 // indirect
|
||||||
@@ -86,10 +86,12 @@ require (
|
|||||||
golang.org/x/sys v0.0.0-20220817070843-5a390386f1f2 // indirect
|
golang.org/x/sys v0.0.0-20220817070843-5a390386f1f2 // indirect
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
||||||
|
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
|
||||||
|
gopkg.in/lightningtipbot/telebot.v3 v3.0.0-20220828121412-0dea11ecc6dd // indirect
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||||
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 // indirect
|
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
k8s.io/apimachinery v0.0.0-20191123233150-4c4803ed55e3 // indirect
|
k8s.io/apimachinery v0.0.0-20191123233150-4c4803ed55e3 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
// replace gopkg.in/lightningtipbot/telebot.v2 => ../telebot
|
// replace gopkg.in/lightningtipbot/telebot.v3 => ../telebot
|
||||||
|
|||||||
@@ -157,7 +157,6 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE
|
|||||||
github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk=
|
github.com/btcsuite/winsvc v1.0.0 h1:J9B4L7e3oqhXOcm+2IuNApwzQec85lE+QaikUcCs+dk=
|
||||||
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
|
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
|
||||||
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
|
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
|
||||||
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
|
|
||||||
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||||
github.com/cenkalti/backoff/v4 v4.1.0 h1:c8LkOFQTzuO0WBM/ae5HdGQuZPfPxp7lqBRwQRm4fSc=
|
github.com/cenkalti/backoff/v4 v4.1.0 h1:c8LkOFQTzuO0WBM/ae5HdGQuZPfPxp7lqBRwQRm4fSc=
|
||||||
github.com/cenkalti/backoff/v4 v4.1.0/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
|
github.com/cenkalti/backoff/v4 v4.1.0/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
|
||||||
@@ -261,6 +260,7 @@ github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHqu
|
|||||||
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
|
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
|
||||||
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
|
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
|
||||||
github.com/frankban/quicktest v1.2.2/go.mod h1:Qh/WofXFeiAFII1aEBu529AtJo6Zg2VHscnEsbBnJ20=
|
github.com/frankban/quicktest v1.2.2/go.mod h1:Qh/WofXFeiAFII1aEBu529AtJo6Zg2VHscnEsbBnJ20=
|
||||||
|
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||||
@@ -360,8 +360,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
|||||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
|
|
||||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
|
||||||
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
|
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||||
@@ -567,8 +567,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxv
|
|||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
|
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
@@ -788,11 +788,14 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
|
|||||||
github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
|
github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
|
||||||
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||||
|
github.com/r3labs/sse v0.0.0-20210224172625-26fe804710bc h1:zAsgcP8MhzAbhMnB1QQ2O7ZhWYVGYSR2iVcjzQuPV+o=
|
||||||
|
github.com/r3labs/sse v0.0.0-20210224172625-26fe804710bc/go.mod h1:S8xSOnV3CgpNrWd0GQ/OoQfMtlg2uPRSuTzcSGrzwK8=
|
||||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
|
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
|
||||||
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
||||||
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
|
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
|
||||||
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
|
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
|
||||||
@@ -823,8 +826,9 @@ github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJ
|
|||||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
|
|
||||||
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
|
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
|
||||||
|
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
|
||||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||||
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
|
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
|
||||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||||
@@ -848,8 +852,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
|
|||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
|
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
|
||||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||||
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
|
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
|
||||||
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
|
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
|
||||||
@@ -1064,6 +1068,7 @@ golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLL
|
|||||||
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20191105084925-a882066a44e0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20191105084925-a882066a44e0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20191116160921-f9c825593386/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
@@ -1366,6 +1371,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
|
|||||||
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
|
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo4Y=
|
||||||
|
gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20160105164936-4f90aeace3a2/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20160105164936-4f90aeace3a2/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
@@ -1384,6 +1391,8 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
|||||||
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/lightningtipbot/telebot.v3 v3.0.0-20220326213923-f323bb71ac8e h1:x58PfjVq6dbYSzM4URM9QfKDKVru1CpngxCM5pGqwbk=
|
gopkg.in/lightningtipbot/telebot.v3 v3.0.0-20220326213923-f323bb71ac8e h1:x58PfjVq6dbYSzM4URM9QfKDKVru1CpngxCM5pGqwbk=
|
||||||
gopkg.in/lightningtipbot/telebot.v3 v3.0.0-20220326213923-f323bb71ac8e/go.mod h1:kIC/Dlp2OjWhVrOkZDN4iEoCaqoac5w1UjpKY6Ftf+U=
|
gopkg.in/lightningtipbot/telebot.v3 v3.0.0-20220326213923-f323bb71ac8e/go.mod h1:kIC/Dlp2OjWhVrOkZDN4iEoCaqoac5w1UjpKY6Ftf+U=
|
||||||
|
gopkg.in/lightningtipbot/telebot.v3 v3.0.0-20220828121412-0dea11ecc6dd h1:LI1Q9RRmTKusLTpLGAHFUVT+wgzc0GHFKd3+34fARE8=
|
||||||
|
gopkg.in/lightningtipbot/telebot.v3 v3.0.0-20220828121412-0dea11ecc6dd/go.mod h1:BefN0q4hcqXE1jXo4mTXZ9+29zl7IGsoSFXEQF455Oc=
|
||||||
gopkg.in/macaroon-bakery.v2 v2.0.1/go.mod h1:B4/T17l+ZWGwxFSZQmlBwp25x+og7OkhETfr3S9MbIA=
|
gopkg.in/macaroon-bakery.v2 v2.0.1/go.mod h1:B4/T17l+ZWGwxFSZQmlBwp25x+og7OkhETfr3S9MbIA=
|
||||||
gopkg.in/macaroon.v2 v2.0.0/go.mod h1:+I6LnTMkm/uV5ew/0nsulNjL16SK4+C8yDmRUzHR17I=
|
gopkg.in/macaroon.v2 v2.0.0/go.mod h1:+I6LnTMkm/uV5ew/0nsulNjL16SK4+C8yDmRUzHR17I=
|
||||||
gopkg.in/mgo.v2 v2.0.0-20160818015218-f2b6f6c918c4/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
gopkg.in/mgo.v2 v2.0.0-20160818015218-f2b6f6c918c4/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
||||||
@@ -1408,8 +1417,8 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gorm.io/driver/sqlite v1.1.4 h1:PDzwYE+sI6De2+mxAneV9Xs11+ZyKV6oxD3wDGkaNvM=
|
gorm.io/driver/sqlite v1.1.4 h1:PDzwYE+sI6De2+mxAneV9Xs11+ZyKV6oxD3wDGkaNvM=
|
||||||
gorm.io/driver/sqlite v1.1.4/go.mod h1:mJCeTFr7+crvS+TRnWc5Z3UvwxUN1BGBLMrf5LA9DYw=
|
gorm.io/driver/sqlite v1.1.4/go.mod h1:mJCeTFr7+crvS+TRnWc5Z3UvwxUN1BGBLMrf5LA9DYw=
|
||||||
gorm.io/gorm v1.20.7/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
|
gorm.io/gorm v1.20.7/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
|
||||||
|
|||||||
@@ -2,12 +2,15 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal"
|
"github.com/LightningTipBot/LightningTipBot/internal"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/lnbits"
|
"github.com/LightningTipBot/LightningTipBot/internal/lnbits"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/telegram"
|
"github.com/LightningTipBot/LightningTipBot/internal/telegram"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
|
"github.com/r3labs/sse"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
@@ -119,3 +122,42 @@ func (s Service) InvoiceStatus(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
json.NewEncoder(w).Encode(payment)
|
json.NewEncoder(w).Encode(payment)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type InvoiceStream struct {
|
||||||
|
CheckingID string `json:"checking_id"`
|
||||||
|
Pending bool `json:"pending"`
|
||||||
|
Amount int `json:"amount"`
|
||||||
|
Fee int `json:"fee"`
|
||||||
|
Memo string `json:"memo"`
|
||||||
|
Time int `json:"time"`
|
||||||
|
Bolt11 string `json:"bolt11"`
|
||||||
|
Preimage string `json:"preimage"`
|
||||||
|
PaymentHash string `json:"payment_hash"`
|
||||||
|
Extra struct {
|
||||||
|
} `json:"extra"`
|
||||||
|
WalletID string `json:"wallet_id"`
|
||||||
|
Webhook string `json:"webhook"`
|
||||||
|
WebhookStatus interface{} `json:"webhook_status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s Service) InvoiceStream(w http.ResponseWriter, r *http.Request) {
|
||||||
|
user := telegram.LoadUser(r.Context())
|
||||||
|
w.Header().Set("Content-Type", "application/stream+json")
|
||||||
|
w.Header().Set("Cache-Control", "no-cache")
|
||||||
|
w.Header().Set("Connection", "keep-alive")
|
||||||
|
flusher, err := w.(http.Flusher)
|
||||||
|
if !err {
|
||||||
|
http.Error(w, "Streaming unsupported!", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
client := sse.NewClient(fmt.Sprintf("%s/api/v1/payments/sse", internal.Configuration.Lnbits.Url))
|
||||||
|
client.Headers = map[string]string{"X-Api-Key": user.Wallet.Inkey}
|
||||||
|
client.Subscribe("", func(msg *sse.Event) {
|
||||||
|
if msg.Data != nil {
|
||||||
|
fmt.Fprintf(w, "%s\n", string(msg.Data))
|
||||||
|
flusher.Flush()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
time.Sleep(time.Second * 5)
|
||||||
|
}
|
||||||
|
|||||||
+35
-17
@@ -30,15 +30,29 @@ type AuthType struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var AuthTypeBasic = AuthType{Type: "Basic"}
|
var AuthTypeBasic = AuthType{Type: "Basic"}
|
||||||
var AuthTypeBearerBase64 = AuthType{Type: "Basic", Decoder: base64.StdEncoding.DecodeString}
|
var AuthTypeBearerBase64 = AuthType{Type: "Bearer", Decoder: base64.StdEncoding.DecodeString}
|
||||||
|
var AuthTypeNone = AuthType{}
|
||||||
|
|
||||||
func AuthorizationMiddleware(database *gorm.DB, authType AuthType, next http.HandlerFunc) http.HandlerFunc {
|
// invoice key or admin key requirement
|
||||||
|
type AccessKeyType struct {
|
||||||
|
Type string
|
||||||
|
}
|
||||||
|
|
||||||
|
var AccessKeyTypeInvoice = AccessKeyType{Type: "invoice"}
|
||||||
|
var AccessKeyTypeAdmin = AccessKeyType{Type: "admin"}
|
||||||
|
var AccessKeyTypeNone = AccessKeyType{Type: "none"} // no authorization required
|
||||||
|
|
||||||
|
func AuthorizationMiddleware(database *gorm.DB, authType AuthType, accessType AccessKeyType, next http.HandlerFunc) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if accessType.Type == "none" {
|
||||||
|
next.ServeHTTP(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
auth := r.Header.Get("Authorization")
|
auth := r.Header.Get("Authorization")
|
||||||
// check if the user is banned
|
// check if the user is banned
|
||||||
if auth == "" {
|
if auth == "" {
|
||||||
w.WriteHeader(401)
|
w.WriteHeader(401)
|
||||||
log.Warn("[AuthorizationMiddleware] no auth")
|
log.Warn("[api] no auth")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_, password, ok := parseAuth(authType, auth)
|
_, password, ok := parseAuth(authType, auth)
|
||||||
@@ -49,25 +63,29 @@ func AuthorizationMiddleware(database *gorm.DB, authType AuthType, next http.Han
|
|||||||
// first we make sure that the password is not already "banned_"
|
// first we make sure that the password is not already "banned_"
|
||||||
if strings.Contains(password, "_") || strings.HasPrefix(password, "banned_") {
|
if strings.Contains(password, "_") || strings.HasPrefix(password, "banned_") {
|
||||||
w.WriteHeader(401)
|
w.WriteHeader(401)
|
||||||
log.Warnf("[AuthorizationMiddleware] Banned user %s. Not forwarding request", password)
|
log.Warnf("[api] Banned user %s. Not forwarding request", password)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// then we check whether the "normal" password provided is in the database (it should be not if the user is banned)
|
// then we check whether the "normal" password provided is in the database (it should be not if the user is banned)
|
||||||
|
|
||||||
user := &lnbits.User{}
|
user := &lnbits.User{}
|
||||||
tx := database.Where("wallet_adminkey = ? COLLATE NOCASE", password).First(user)
|
var tx *gorm.DB
|
||||||
if tx.Error != nil {
|
if accessType.Type == "admin" {
|
||||||
|
tx = database.Where("wallet_adminkey = ? COLLATE NOCASE", password).First(user)
|
||||||
|
} else if accessType.Type == "invoice" {
|
||||||
tx = database.Where("wallet_inkey = ? COLLATE NOCASE", password).First(user)
|
tx = database.Where("wallet_inkey = ? COLLATE NOCASE", password).First(user)
|
||||||
log.Warnf("[AuthorizationMiddleware] Could not get wallet admin key %s: %v", password, tx.Error)
|
} else {
|
||||||
if tx.Error != nil {
|
log.Errorf("[api] route without access type")
|
||||||
log.Warnf("[AuthorizationMiddleware] need admin key to pay invoice %s: %v", password, tx.Error)
|
w.WriteHeader(401)
|
||||||
return
|
return
|
||||||
}
|
|
||||||
if r.URL.Path == "/api/v1/payinvoice" {
|
|
||||||
log.Warnf("[AuthorizationMiddleware] need admin key to pay invoice %s: %v", password, tx.Error)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
log.Debugf("[AuthorizationMiddleware] User: %s", telegram.GetUserStr(user.Telegram))
|
if tx.Error != nil {
|
||||||
|
log.Warnf("[api] could not load access key: %v", tx.Error)
|
||||||
|
w.WriteHeader(401)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Debugf("[api] User: %s Endpoint: %s %s %s", telegram.GetUserStr(user.Telegram), r.Method, r.URL.Path, r.URL.RawQuery)
|
||||||
r = r.WithContext(context.WithValue(r.Context(), "user", user))
|
r = r.WithContext(context.WithValue(r.Context(), "user", user))
|
||||||
next.ServeHTTP(w, r)
|
next.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
@@ -82,7 +100,7 @@ func parseAuth(authType AuthType, auth string) (username, password string, ok bo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if authType.Decoder != nil {
|
if authType.Decoder != nil {
|
||||||
c, err := base64.StdEncoding.DecodeString(auth[len(prefix):])
|
c, err := authType.Decoder(auth[len(prefix):])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gorm.io/gorm"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
@@ -24,8 +25,8 @@ func NewServer(address string) *Server {
|
|||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Addr: address,
|
Addr: address,
|
||||||
// Good practice: enforce timeouts for servers you create!
|
// Good practice: enforce timeouts for servers you create!
|
||||||
WriteTimeout: 15 * time.Second,
|
WriteTimeout: 90 * time.Second,
|
||||||
ReadTimeout: 15 * time.Second,
|
ReadTimeout: 90 * time.Second,
|
||||||
}
|
}
|
||||||
apiServer := &Server{
|
apiServer := &Server{
|
||||||
httpServer: srv,
|
httpServer: srv,
|
||||||
@@ -33,7 +34,7 @@ func NewServer(address string) *Server {
|
|||||||
apiServer.router = mux.NewRouter()
|
apiServer.router = mux.NewRouter()
|
||||||
apiServer.httpServer.Handler = apiServer.router
|
apiServer.httpServer.Handler = apiServer.router
|
||||||
go apiServer.httpServer.ListenAndServe()
|
go apiServer.httpServer.ListenAndServe()
|
||||||
log.Infof("[API] Server started at %s", address)
|
log.Infof("[api] Server started at %s", address)
|
||||||
return apiServer
|
return apiServer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,8 +44,8 @@ func (w *Server) ListenAndServe() {
|
|||||||
func (w *Server) PathPrefix(path string, handler http.Handler) {
|
func (w *Server) PathPrefix(path string, handler http.Handler) {
|
||||||
w.router.PathPrefix(path).Handler(handler)
|
w.router.PathPrefix(path).Handler(handler)
|
||||||
}
|
}
|
||||||
func (w *Server) AppendAuthorizedRoute(path string, authType AuthType, database *gorm.DB, handler func(http.ResponseWriter, *http.Request), methods ...string) {
|
func (w *Server) AppendAuthorizedRoute(path string, authType AuthType, accessType AccessKeyType, database *gorm.DB, handler func(http.ResponseWriter, *http.Request), methods ...string) {
|
||||||
r := w.router.HandleFunc(path, LoggingMiddleware("API", AuthorizationMiddleware(database, authType, handler)))
|
r := w.router.HandleFunc(path, LoggingMiddleware("API", AuthorizationMiddleware(database, authType, accessType, handler)))
|
||||||
if len(methods) > 0 {
|
if len(methods) > 0 {
|
||||||
r.Methods(methods...)
|
r.Methods(methods...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,338 @@
|
|||||||
|
<!-- @format -->
|
||||||
|
|
||||||
|
{{define "webapp"}}
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
|
<meta name="format-detection" content="telephone=no" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="MobileOptimized" content="176" />
|
||||||
|
<meta name="HandheldFriendly" content="True" />
|
||||||
|
<meta name="robots" content="noindex,nofollow" />
|
||||||
|
<title>LNURL</title>
|
||||||
|
<script src="https://unpkg.com/kjua@0.6.0/dist/kjua.min.js"></script>
|
||||||
|
<script src="https://telegram.org/js/telegram-web-app.js?1"></script>
|
||||||
|
<script>
|
||||||
|
function setThemeClass() {
|
||||||
|
document.documentElement.className = Telegram.WebApp.colorScheme;
|
||||||
|
}
|
||||||
|
Telegram.WebApp.onEvent('themeChanged', setThemeClass);
|
||||||
|
setThemeClass();
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
background-color: var(--tg-theme-bg-color, #ffffff);
|
||||||
|
color: var(--tg-theme-text-color, #222222);
|
||||||
|
font-size: 16px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
color-scheme: var(--tg-color-scheme);
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: var(--tg-theme-link-color, #2678b6);
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 14px;
|
||||||
|
margin: 15px 0;
|
||||||
|
padding: 12px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: var(--tg-theme-button-color, #50a8eb);
|
||||||
|
color: var(--tg-theme-button-text-color, #ffffff);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
button[disabled] {
|
||||||
|
opacity: 0.6;
|
||||||
|
cursor: auto;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
font-size: 14px;
|
||||||
|
text-align: center;
|
||||||
|
padding: 12px 20px;
|
||||||
|
margin: 15px 0;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: var(--tg-theme-secondary-bg-color, #f5f5f5);
|
||||||
|
color: var(--tg-theme-text-color, #1a1a1a);
|
||||||
|
}
|
||||||
|
|
||||||
|
section {
|
||||||
|
padding: 5px 5px 65px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 40px 0 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
color: var(--tg-theme-hint-color, #a8a8a8);
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
background: rgba(0, 0, 0, .07);
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 4px;
|
||||||
|
margin: 7px 0;
|
||||||
|
word-break: break-all;
|
||||||
|
word-break: break-word;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark pre {
|
||||||
|
background: rgba(255, 255, 255, .15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
font-size: .8em;
|
||||||
|
color: var(--tg-theme-hint-color, #a8a8a8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ok {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
.err {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
#fixed_wrap {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
transform: translateY(100vh);
|
||||||
|
}
|
||||||
|
|
||||||
|
.viewport_border,
|
||||||
|
.viewport_stable_border {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
height: var(--tg-viewport-height, 100vh);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.viewport_stable_border {
|
||||||
|
height: var(--tg-viewport-stable-height, 100vh);
|
||||||
|
}
|
||||||
|
|
||||||
|
.viewport_border:before,
|
||||||
|
.viewport_stable_border:before {
|
||||||
|
content: attr(text);
|
||||||
|
display: inline-block;
|
||||||
|
position: absolute;
|
||||||
|
background: gray;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
font-size: 7px;
|
||||||
|
padding: 2px 4px;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.viewport_stable_border:before {
|
||||||
|
background: green;
|
||||||
|
left: 0;
|
||||||
|
right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.viewport_border:after,
|
||||||
|
.viewport_stable_border:after {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
border: 2px dashed gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.viewport_stable_border:after {
|
||||||
|
border-color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 120%;
|
||||||
|
word-wrap: break-word;
|
||||||
|
margin: 0.1em;
|
||||||
|
margin-bottom: 0.3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-container {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin: 0px;
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr > canvas {
|
||||||
|
max-height: 800px;
|
||||||
|
max-width: 800px;
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 3fr 2fr;
|
||||||
|
padding: 12px 20px;
|
||||||
|
column-gap: 10px;
|
||||||
|
row-gap: 1em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h1 id="greeting"></h1>
|
||||||
|
|
||||||
|
<div class="qr-container">
|
||||||
|
<div class="qr" id="qr">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="buttons">
|
||||||
|
<!-- <button onclick="webviewClose();">Close</button> -->
|
||||||
|
<div class="wrapper">
|
||||||
|
<div>
|
||||||
|
<input type="number" id="invoiceAmount" placeholder="amount in sat" style="width: 80%"></input>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button onclick="getInvoice(this, {{.Callback}});" style="display: inline;" id="requestInvoice">Invoice</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<script type="application/javascript">
|
||||||
|
Telegram.WebApp.ready();
|
||||||
|
|
||||||
|
// render the LNURL pay QR code
|
||||||
|
var s = "{{.LNURLPay}}";
|
||||||
|
renderQr(s);
|
||||||
|
|
||||||
|
// data passed form telegram server
|
||||||
|
const initData = Telegram.WebApp.initData || '';
|
||||||
|
const initDataUnsafe = Telegram.WebApp.initDataUnsafe || {};
|
||||||
|
|
||||||
|
document.querySelector('#greeting').innerHTML = "{{.Username}}@ln.tips";
|
||||||
|
// document.querySelector('#initData').innerHTML = JSON.stringify(initData, null, 2);
|
||||||
|
// document.querySelector('#initDataUnsafe').innerHTML = JSON.stringify(initDataUnsafe, null, 2);
|
||||||
|
|
||||||
|
// react to theme changes
|
||||||
|
try {
|
||||||
|
document.querySelector('#themeData').html(JSON.stringify(Telegram.WebApp.themeParams, null, 2));
|
||||||
|
Telegram.WebApp.onEvent('themeChanged', function() {
|
||||||
|
document.querySelector('#themeData').innerHTML = JSON.stringify(Telegram.WebApp.themeParams, null, 2);
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// listen for enter in input field
|
||||||
|
var el = document.getElementById("invoiceAmount");
|
||||||
|
el.addEventListener("keydown", function(event) {
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
document.getElementById("requestInvoice").click();
|
||||||
|
}
|
||||||
|
document.getElementById("requestInvoice").innerHTML = "Invoice"
|
||||||
|
});
|
||||||
|
|
||||||
|
// ------------------ functions ------------------
|
||||||
|
|
||||||
|
function webviewClose() {
|
||||||
|
Telegram.WebApp.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderQr(payload) {
|
||||||
|
const qr = document.getElementById('qr');
|
||||||
|
qr.innerHTML = '';
|
||||||
|
if ( qr ) {
|
||||||
|
const qrGfx = kjua({
|
||||||
|
text: payload,
|
||||||
|
rounded: 50,
|
||||||
|
size: 500,
|
||||||
|
render: 'canvas',
|
||||||
|
});
|
||||||
|
qr.appendChild( qrGfx );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getInvoice(el, callback) {
|
||||||
|
fetch(callback)
|
||||||
|
.then(data => {
|
||||||
|
return data.json();
|
||||||
|
})
|
||||||
|
.then(r => {
|
||||||
|
console.log(r);
|
||||||
|
var invoiceAmount = document.getElementById("invoiceAmount").value;
|
||||||
|
if (invoiceAmount == "") {
|
||||||
|
invoiceAmount = 1000;
|
||||||
|
console.warn("overwriting invoiceAmount with " + invoiceAmount);
|
||||||
|
}
|
||||||
|
console.log("requesting invoice with amount " + invoiceAmount);
|
||||||
|
fetch(r.callback + '?amount='+ invoiceAmount * 1000).then(data => {
|
||||||
|
return data.json();
|
||||||
|
})
|
||||||
|
.then(r => {
|
||||||
|
console.log(r);
|
||||||
|
if (r.status == "OK"){
|
||||||
|
// update qr code
|
||||||
|
renderQr(r.pr);
|
||||||
|
document.querySelector('#greeting').innerHTML = "Pay " + invoiceAmount + " sat";
|
||||||
|
} else {
|
||||||
|
document.getElementById("requestInvoice").innerHTML = "Error"
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
{{end}}
|
||||||
@@ -31,7 +31,8 @@ const botImage = "https://avatars.githubusercontent.com/u/88730856?v=7"
|
|||||||
|
|
||||||
//go:embed static
|
//go:embed static
|
||||||
var templates embed.FS
|
var templates embed.FS
|
||||||
var tmpl = template.Must(template.ParseFS(templates, "static/userpage.html"))
|
var userpage_tmpl = template.Must(template.ParseFS(templates, "static/userpage.html"))
|
||||||
|
var qr_tmpl = template.Must(template.ParseFS(templates, "static/webapp.html"))
|
||||||
|
|
||||||
var Client = &http.Client{
|
var Client = &http.Client{
|
||||||
Timeout: 10 * time.Second,
|
Timeout: 10 * time.Second,
|
||||||
@@ -67,7 +68,7 @@ func (s Service) getTelegramUserPictureURL(username string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s Service) UserPageHandler(w http.ResponseWriter, r *http.Request) {
|
func (s Service) UserPageHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
// https://ln.tips/.well-known/lnurlp/<username>
|
// https://ln.tips/@<username>
|
||||||
username := strings.ToLower(mux.Vars(r)["username"])
|
username := strings.ToLower(mux.Vars(r)["username"])
|
||||||
callback := fmt.Sprintf("%s/.well-known/lnurlp/%s", internal.Configuration.Bot.LNURLHostName, username)
|
callback := fmt.Sprintf("%s/.well-known/lnurlp/%s", internal.Configuration.Bot.LNURLHostName, username)
|
||||||
log.Infof("[UserPage] rendering page of %s", username)
|
log.Infof("[UserPage] rendering page of %s", username)
|
||||||
@@ -82,7 +83,7 @@ func (s Service) UserPageHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
image = botImage
|
image = botImage
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tmpl.ExecuteTemplate(w, "userpage", struct {
|
if err := userpage_tmpl.ExecuteTemplate(w, "userpage", struct {
|
||||||
Username string
|
Username string
|
||||||
Image string
|
Image string
|
||||||
LNURLPay string
|
LNURLPay string
|
||||||
@@ -90,3 +91,22 @@ func (s Service) UserPageHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
log.Errorf("failed to render template")
|
log.Errorf("failed to render template")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s Service) UserWebAppHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// https://ln.tips/app/<username>
|
||||||
|
username := strings.ToLower(mux.Vars(r)["username"])
|
||||||
|
callback := fmt.Sprintf("%s/.well-known/lnurlp/%s", internal.Configuration.Bot.LNURLHostName, username)
|
||||||
|
log.Infof("[UserPage] rendering webapp of %s", username)
|
||||||
|
lnurlEncode, err := lnurl.LNURLEncode(callback)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorln("[UserPage]", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := qr_tmpl.ExecuteTemplate(w, "webapp", struct {
|
||||||
|
Username string
|
||||||
|
LNURLPay string
|
||||||
|
Callback string
|
||||||
|
}{username, lnurlEncode, callback}); err != nil {
|
||||||
|
log.Errorf("failed to render template")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ type BotConfiguration struct {
|
|||||||
LNURLHostName string `yaml:"lnurl_public_host_name"`
|
LNURLHostName string `yaml:"lnurl_public_host_name"`
|
||||||
LNURLHostUrl *url.URL `yaml:"-"`
|
LNURLHostUrl *url.URL `yaml:"-"`
|
||||||
LNURLSendImage bool `yaml:"lnurl_image"`
|
LNURLSendImage bool `yaml:"lnurl_image"`
|
||||||
|
AdminAPIHost string `yaml:"admin_api_host"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TelegramConfiguration struct {
|
type TelegramConfiguration struct {
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
package lndhub
|
package lndhub
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal"
|
"github.com/LightningTipBot/LightningTipBot/internal"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/api"
|
"github.com/LightningTipBot/LightningTipBot/internal/api"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/lnbits"
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/telegram"
|
"github.com/LightningTipBot/LightningTipBot/internal/telegram"
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -21,48 +17,5 @@ func New(bot *telegram.TipBot) LndHub {
|
|||||||
return LndHub{database: bot.DB.Users}
|
return LndHub{database: bot.DB.Users}
|
||||||
}
|
}
|
||||||
func (w LndHub) Handle(writer http.ResponseWriter, request *http.Request) {
|
func (w LndHub) Handle(writer http.ResponseWriter, request *http.Request) {
|
||||||
auth := request.Header.Get("Authorization")
|
|
||||||
|
|
||||||
// check if the user is banned
|
|
||||||
if auth != "" {
|
|
||||||
_, password, ok := parseBearerAuth(auth)
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// first we make sure that the password is not already "banned_"
|
|
||||||
if strings.Contains(password, "_") || strings.HasPrefix(password, "banned_") {
|
|
||||||
log.Warnf("[LNDHUB] Banned user %s. Not forwarding request", password)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// then we check whether the "normal" password provided is in the database (it should be not if the user is banned)
|
|
||||||
user := &lnbits.User{}
|
|
||||||
tx := w.database.Where("wallet_adminkey = ? COLLATE NOCASE", password).First(user)
|
|
||||||
if tx.Error != nil {
|
|
||||||
log.Warnf("[LNDHUB] Could not get wallet admin key %s: %v", password, tx.Error)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.Debugf("[LNDHUB] User: %s", telegram.GetUserStr(user.Telegram))
|
|
||||||
}
|
|
||||||
// if not, proxy the request
|
|
||||||
api.Proxy(writer, request, internal.Configuration.Lnbits.Url)
|
api.Proxy(writer, request, internal.Configuration.Lnbits.Url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseBearerAuth parses an HTTP Basic Authentication string.
|
|
||||||
// "Bearer QWxhZGRpbjpvcGVuIHNlc2FtZQ==" returns ("Aladdin", "open sesame", true).
|
|
||||||
func parseBearerAuth(auth string) (username, password string, ok bool) {
|
|
||||||
const prefix = "Bearer "
|
|
||||||
// Case insensitive prefix match. See Issue 22736.
|
|
||||||
if len(auth) < len(prefix) || !strings.EqualFold(auth[:len(prefix)], prefix) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c, err := base64.StdEncoding.DecodeString(auth[len(prefix):])
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
cs := string(c)
|
|
||||||
s := strings.IndexByte(cs, ':')
|
|
||||||
if s < 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return cs[:s], cs[s+1:], true
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ func (w Lnurl) serveLNURLpSecond(username string, amount_msat int64, comment str
|
|||||||
return &lnurl.LNURLPayValues{
|
return &lnurl.LNURLPayValues{
|
||||||
LNURLResponse: lnurl.LNURLResponse{
|
LNURLResponse: lnurl.LNURLResponse{
|
||||||
Status: api.StatusError,
|
Status: api.StatusError,
|
||||||
Reason: fmt.Sprintf("Amount out of bounds (min: %d mSat, max: %d mSat).", MinSendable, MinSendable)},
|
Reason: fmt.Sprintf("Amount out of bounds (min: %d sat, max: %d sat).", MinSendable/1000, MaxSendable/1000)},
|
||||||
}, fmt.Errorf("amount out of bounds")
|
}, fmt.Errorf("amount out of bounds")
|
||||||
}
|
}
|
||||||
// check comment length
|
// check comment length
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ package rate
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"golang.org/x/time/rate"
|
"golang.org/x/time/rate"
|
||||||
tb "gopkg.in/lightningtipbot/telebot.v3"
|
tb "gopkg.in/lightningtipbot/telebot.v3"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/runtime/mutex"
|
"github.com/LightningTipBot/LightningTipBot/internal/runtime/mutex"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package telegram
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ func newTelegramBot() *tb.Bot {
|
|||||||
Token: internal.Configuration.Telegram.ApiKey,
|
Token: internal.Configuration.Telegram.ApiKey,
|
||||||
Poller: &tb.LongPoller{Timeout: 60 * time.Second},
|
Poller: &tb.LongPoller{Timeout: 60 * time.Second},
|
||||||
ParseMode: tb.ModeMarkdown,
|
ParseMode: tb.ModeMarkdown,
|
||||||
|
Verbose: false,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ package telegram
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/LightningTipBot/LightningTipBot/internal"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/lnbits"
|
"github.com/LightningTipBot/LightningTipBot/internal/lnbits"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
tb "gopkg.in/lightningtipbot/telebot.v3"
|
tb "gopkg.in/lightningtipbot/telebot.v3"
|
||||||
@@ -11,16 +13,18 @@ import (
|
|||||||
|
|
||||||
// we can't use space in the label of buttons, because string splitting will mess everything up.
|
// we can't use space in the label of buttons, because string splitting will mess everything up.
|
||||||
const (
|
const (
|
||||||
MainMenuCommandSend = "💸 Send"
|
MainMenuCommandWebApp = "⤵️ Receive"
|
||||||
MainMenuCommandBalance = "Balance"
|
MainMenuCommandBalance = "Balance"
|
||||||
MainMenuCommandInvoice = "⚡️ Invoice"
|
MainMenuCommandInvoice = "⚡️ Invoice"
|
||||||
MainMenuCommandHelp = "📖 Help"
|
MainMenuCommandHelp = "📖 Help"
|
||||||
|
MainMenuCommandSend = "⤴️ Send"
|
||||||
SendMenuCommandEnter = "👤 Enter"
|
SendMenuCommandEnter = "👤 Enter"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
mainMenu = &tb.ReplyMarkup{ResizeKeyboard: true}
|
mainMenu = &tb.ReplyMarkup{ResizeKeyboard: true}
|
||||||
btnHelpMainMenu = mainMenu.Text(MainMenuCommandHelp)
|
btnHelpMainMenu = mainMenu.Text(MainMenuCommandHelp)
|
||||||
|
btnWebAppMainMenu = mainMenu.Text(MainMenuCommandWebApp)
|
||||||
btnSendMainMenu = mainMenu.Text(MainMenuCommandSend)
|
btnSendMainMenu = mainMenu.Text(MainMenuCommandSend)
|
||||||
btnBalanceMainMenu = mainMenu.Text(MainMenuCommandBalance)
|
btnBalanceMainMenu = mainMenu.Text(MainMenuCommandBalance)
|
||||||
btnInvoiceMainMenu = mainMenu.Text(MainMenuCommandInvoice)
|
btnInvoiceMainMenu = mainMenu.Text(MainMenuCommandInvoice)
|
||||||
@@ -31,9 +35,10 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
btnBalanceMainMenu = mainMenu.Text(MainMenuCommandBalance)
|
||||||
mainMenu.Reply(
|
mainMenu.Reply(
|
||||||
mainMenu.Row(btnBalanceMainMenu),
|
mainMenu.Row(btnBalanceMainMenu),
|
||||||
mainMenu.Row(btnInvoiceMainMenu, btnSendMainMenu, btnHelpMainMenu),
|
mainMenu.Row(btnInvoiceMainMenu, btnWebAppMainMenu, btnSendMainMenu),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,6 +63,21 @@ func buttonWrapper(buttons []tb.Btn, markup *tb.ReplyMarkup, length int) []tb.Ro
|
|||||||
return rows
|
return rows
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// appendWebAppLinkToButton adds a WebApp object to a Button with the user's webapp page
|
||||||
|
func (bot *TipBot) appendWebAppLinkToButton(btn *tb.Btn, user *lnbits.User) {
|
||||||
|
var url string
|
||||||
|
if len(user.Telegram.Username) > 0 {
|
||||||
|
url = fmt.Sprintf("%s/app/@%s", internal.Configuration.Bot.LNURLHostName, user.Telegram.Username)
|
||||||
|
} else {
|
||||||
|
url = fmt.Sprintf("%s/app/@%s", internal.Configuration.Bot.LNURLHostName, user.AnonIDSha256)
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(url, "https://") {
|
||||||
|
// prevent adding a link if not https is used, otherwise
|
||||||
|
// Telegram returns an error and does not show the keyboard
|
||||||
|
btn.WebApp = &tb.WebAppInfo{Url: url}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// mainMenuBalanceButtonUpdate updates the balance button in the mainMenu
|
// mainMenuBalanceButtonUpdate updates the balance button in the mainMenu
|
||||||
func (bot *TipBot) mainMenuBalanceButtonUpdate(to int64) {
|
func (bot *TipBot) mainMenuBalanceButtonUpdate(to int64) {
|
||||||
var user *lnbits.User
|
var user *lnbits.User
|
||||||
@@ -75,11 +95,13 @@ func (bot *TipBot) mainMenuBalanceButtonUpdate(to int64) {
|
|||||||
log.Tracef("[appendMainMenu] user %s balance %d sat", GetUserStr(user.Telegram), amount)
|
log.Tracef("[appendMainMenu] user %s balance %d sat", GetUserStr(user.Telegram), amount)
|
||||||
MainMenuCommandBalance := fmt.Sprintf("%s %d sat", MainMenuCommandBalance, amount)
|
MainMenuCommandBalance := fmt.Sprintf("%s %d sat", MainMenuCommandBalance, amount)
|
||||||
btnBalanceMainMenu = mainMenu.Text(MainMenuCommandBalance)
|
btnBalanceMainMenu = mainMenu.Text(MainMenuCommandBalance)
|
||||||
mainMenu.Reply(
|
|
||||||
mainMenu.Row(btnBalanceMainMenu),
|
|
||||||
mainMenu.Row(btnInvoiceMainMenu, btnSendMainMenu, btnHelpMainMenu),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bot.appendWebAppLinkToButton(&btnWebAppMainMenu, user)
|
||||||
|
mainMenu.Reply(
|
||||||
|
mainMenu.Row(btnBalanceMainMenu),
|
||||||
|
mainMenu.Row(btnInvoiceMainMenu, btnWebAppMainMenu, btnSendMainMenu),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +120,7 @@ func (bot *TipBot) makeContactsButtons(ctx context.Context) []tb.Btn {
|
|||||||
// get all contacts and add them to the buttons
|
// get all contacts and add them to the buttons
|
||||||
for i, r := range records {
|
for i, r := range records {
|
||||||
log.Tracef("[makeContactsButtons] toNames[%d] = %s (id=%d)", i, r.ToUser, r.ID)
|
log.Tracef("[makeContactsButtons] toNames[%d] = %s (id=%d)", i, r.ToUser, r.ID)
|
||||||
sendToButtons = append(sendToButtons, tb.Btn{Text: fmt.Sprintf("%s", r.ToUser)})
|
sendToButtons = append(sendToButtons, tb.Btn{Text: r.ToUser})
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the "enter a username" button to the end
|
// add the "enter a username" button to the end
|
||||||
|
|||||||
@@ -3,12 +3,13 @@ package telegram
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/str"
|
"github.com/LightningTipBot/LightningTipBot/internal/str"
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -261,6 +262,25 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// previously, this was the send menu but it
|
||||||
|
// was replaced with the webapp
|
||||||
|
// {
|
||||||
|
// Endpoints: []interface{}{&btnWebAppMainMenu},
|
||||||
|
// Handler: bot.keyboardSendHandler,
|
||||||
|
// Interceptor: &Interceptor{
|
||||||
|
|
||||||
|
// Before: []intercept.Func{
|
||||||
|
// bot.localizerInterceptor,
|
||||||
|
// bot.logMessageInterceptor,
|
||||||
|
// bot.requireUserInterceptor,
|
||||||
|
// bot.loadReplyToInterceptor,
|
||||||
|
// bot.lockInterceptor,
|
||||||
|
// },
|
||||||
|
// OnDefer: []intercept.Func{
|
||||||
|
// bot.unlockInterceptor,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
Endpoints: []interface{}{"/transactions"},
|
Endpoints: []interface{}{"/transactions"},
|
||||||
Handler: bot.transactionsHandler,
|
Handler: bot.transactionsHandler,
|
||||||
@@ -280,6 +300,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -295,6 +316,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -321,7 +343,6 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Endpoints: []interface{}{"/tipjar", "/spendendose"},
|
Endpoints: []interface{}{"/tipjar", "/spendendose"},
|
||||||
Handler: bot.tipjarHandler,
|
Handler: bot.tipjarHandler,
|
||||||
Interceptor: &Interceptor{
|
Interceptor: &Interceptor{
|
||||||
|
|
||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.logMessageInterceptor,
|
bot.logMessageInterceptor,
|
||||||
@@ -337,7 +358,6 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Endpoints: []interface{}{"/help", &btnHelpMainMenu},
|
Endpoints: []interface{}{"/help", &btnHelpMainMenu},
|
||||||
Handler: bot.helpHandler,
|
Handler: bot.helpHandler,
|
||||||
Interceptor: &Interceptor{
|
Interceptor: &Interceptor{
|
||||||
|
|
||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.logMessageInterceptor,
|
bot.logMessageInterceptor,
|
||||||
@@ -385,8 +405,8 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Endpoints: []interface{}{"/advanced"},
|
Endpoints: []interface{}{"/advanced"},
|
||||||
Handler: bot.advancedHelpHandler,
|
Handler: bot.advancedHelpHandler,
|
||||||
Interceptor: &Interceptor{
|
Interceptor: &Interceptor{
|
||||||
|
|
||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
|
bot.requirePrivateChatInterceptor,
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.logMessageInterceptor,
|
bot.logMessageInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
@@ -401,8 +421,24 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Endpoints: []interface{}{"/link"},
|
Endpoints: []interface{}{"/link"},
|
||||||
Handler: bot.lndhubHandler,
|
Handler: bot.lndhubHandler,
|
||||||
Interceptor: &Interceptor{
|
Interceptor: &Interceptor{
|
||||||
|
|
||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
|
bot.requirePrivateChatInterceptor,
|
||||||
|
bot.localizerInterceptor,
|
||||||
|
bot.logMessageInterceptor,
|
||||||
|
bot.requireUserInterceptor,
|
||||||
|
bot.lockInterceptor,
|
||||||
|
},
|
||||||
|
OnDefer: []intercept.Func{
|
||||||
|
bot.unlockInterceptor,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Endpoints: []interface{}{"/api"},
|
||||||
|
Handler: bot.apiHandler,
|
||||||
|
Interceptor: &Interceptor{
|
||||||
|
Before: []intercept.Func{
|
||||||
|
bot.requirePrivateChatInterceptor,
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.logMessageInterceptor,
|
bot.logMessageInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
@@ -417,8 +453,8 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Endpoints: []interface{}{"/lnurl"},
|
Endpoints: []interface{}{"/lnurl"},
|
||||||
Handler: bot.lnurlHandler,
|
Handler: bot.lnurlHandler,
|
||||||
Interceptor: &Interceptor{
|
Interceptor: &Interceptor{
|
||||||
|
|
||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
|
bot.requirePrivateChatInterceptor,
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.logMessageInterceptor,
|
bot.logMessageInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
@@ -434,7 +470,6 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Endpoints: []interface{}{"/group"},
|
Endpoints: []interface{}{"/group"},
|
||||||
Handler: bot.groupHandler,
|
Handler: bot.groupHandler,
|
||||||
Interceptor: &Interceptor{
|
Interceptor: &Interceptor{
|
||||||
|
|
||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.logMessageInterceptor,
|
bot.logMessageInterceptor,
|
||||||
@@ -471,6 +506,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -548,6 +584,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -563,6 +600,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -578,6 +616,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -593,6 +632,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -608,6 +648,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -623,6 +664,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -638,6 +680,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -653,6 +696,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -669,10 +713,12 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
bot.singletonCallbackInterceptor,
|
bot.singletonCallbackInterceptor,
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
bot.unlockInterceptor,
|
bot.unlockInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -684,6 +730,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -699,6 +746,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -714,6 +762,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -729,6 +778,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -744,6 +794,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -759,6 +810,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -774,6 +826,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.requireUserInterceptor,
|
bot.requireUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -789,6 +842,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -803,6 +857,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -817,6 +872,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -831,6 +887,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -845,6 +902,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -859,6 +917,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -874,6 +933,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -889,6 +949,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -904,6 +965,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -919,6 +981,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -934,6 +997,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -949,6 +1013,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -964,6 +1029,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -979,6 +1045,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -994,6 +1061,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -1008,6 +1076,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -1022,6 +1091,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -1036,6 +1106,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -1051,6 +1122,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -1065,6 +1137,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -1079,6 +1152,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -1093,6 +1167,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -1107,6 +1182,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -1121,6 +1197,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -1135,6 +1212,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
@@ -1149,6 +1227,7 @@ func (bot TipBot) getHandler() []InterceptionWrapper {
|
|||||||
Before: []intercept.Func{
|
Before: []intercept.Func{
|
||||||
bot.localizerInterceptor,
|
bot.localizerInterceptor,
|
||||||
bot.loadUserInterceptor,
|
bot.loadUserInterceptor,
|
||||||
|
bot.answerCallbackInterceptor,
|
||||||
bot.lockInterceptor,
|
bot.lockInterceptor,
|
||||||
},
|
},
|
||||||
OnDefer: []intercept.Func{
|
OnDefer: []intercept.Func{
|
||||||
|
|||||||
@@ -59,10 +59,9 @@ func (bot TipBot) idInterceptor(ctx intercept.Context) (intercept.Context, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
// answerCallbackInterceptor will answer the callback with the given text in the context
|
// answerCallbackInterceptor will answer the callback with the given text in the context
|
||||||
func (bot TipBot) answerCallbackInterceptor(ctx context.Context, i interface{}) (context.Context, error) {
|
func (bot TipBot) answerCallbackInterceptor(ctx intercept.Context) (intercept.Context, error) {
|
||||||
switch i.(type) {
|
c := ctx.Callback()
|
||||||
case *tb.Callback:
|
if c != nil {
|
||||||
c := i.(*tb.Callback)
|
|
||||||
ctxcr := ctx.Value("callback_response")
|
ctxcr := ctx.Value("callback_response")
|
||||||
var res []*tb.CallbackResponse
|
var res []*tb.CallbackResponse
|
||||||
if ctxcr != nil {
|
if ctxcr != nil {
|
||||||
|
|||||||
+17
-20
@@ -20,22 +20,9 @@ func (bot *TipBot) lndhubHandler(ctx intercept.Context) (intercept.Context, erro
|
|||||||
bot.trySendMessage(m.Sender, Translate(ctx, "couldNotLinkMessage"))
|
bot.trySendMessage(m.Sender, Translate(ctx, "couldNotLinkMessage"))
|
||||||
return ctx, fmt.Errorf("invalid configuration")
|
return ctx, fmt.Errorf("invalid configuration")
|
||||||
}
|
}
|
||||||
// check and print all commands
|
|
||||||
bot.anyTextHandler(ctx)
|
|
||||||
// reply only in private message
|
|
||||||
if m.Chat.Type != tb.ChatPrivate {
|
|
||||||
// delete message
|
|
||||||
bot.tryDeleteMessage(m)
|
|
||||||
}
|
|
||||||
// first check whether the user is initialized
|
// first check whether the user is initialized
|
||||||
fromUser := LoadUser(ctx)
|
fromUser := LoadUser(ctx)
|
||||||
bot.trySendMessage(m.Sender, Translate(ctx, "walletConnectMessage"))
|
linkmsg := bot.trySendMessageEditable(m.Sender, Translate(ctx, "walletConnectMessage"))
|
||||||
|
|
||||||
// do not respond to banned users
|
|
||||||
if bot.UserIsBanned(fromUser) {
|
|
||||||
log.Warnln("[lndhubHandler] user is banned. not responding.")
|
|
||||||
return ctx, fmt.Errorf("user is banned")
|
|
||||||
}
|
|
||||||
|
|
||||||
lndhubUrl := fmt.Sprintf("lndhub://admin:%s@%slndhub/ext/", fromUser.Wallet.Adminkey, internal.Configuration.Lnbits.LnbitsPublicUrl)
|
lndhubUrl := fmt.Sprintf("lndhub://admin:%s@%slndhub/ext/", fromUser.Wallet.Adminkey, internal.Configuration.Lnbits.LnbitsPublicUrl)
|
||||||
|
|
||||||
@@ -48,14 +35,24 @@ func (bot *TipBot) lndhubHandler(ctx intercept.Context) (intercept.Context, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
// send the link to the user
|
// send the link to the user
|
||||||
linkmsg := bot.trySendMessage(m.Sender, &tb.Photo{File: tb.File{FileReader: bytes.NewReader(qr)}, Caption: fmt.Sprintf("`%s`", lndhubUrl)})
|
qrmsg := bot.trySendMessage(m.Sender, &tb.Photo{File: tb.File{FileReader: bytes.NewReader(qr)}, Caption: fmt.Sprintf("`%s`", lndhubUrl)})
|
||||||
|
// auto delete
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(time.Second * 60)
|
time.Sleep(time.Second * 60)
|
||||||
bot.tryDeleteMessage(linkmsg)
|
bot.tryDeleteMessage(qrmsg)
|
||||||
bot.trySendMessage(m.Sender, Translate(ctx, "linkHiddenMessage"), tb.Silent)
|
bot.tryEditMessage(linkmsg, Translate(ctx, "linkHiddenMessage"), tb.Silent)
|
||||||
|
}()
|
||||||
|
return ctx, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (bot *TipBot) apiHandler(ctx intercept.Context) (intercept.Context, error) {
|
||||||
|
m := ctx.Message()
|
||||||
|
fromUser := LoadUser(ctx)
|
||||||
|
apimesg := bot.trySendMessageEditable(m.Sender, fmt.Sprintf(Translate(ctx, "apiConnectMessage"), fromUser.Wallet.Adminkey, fromUser.Wallet.Inkey))
|
||||||
|
// auto delete
|
||||||
|
go func() {
|
||||||
|
time.Sleep(time.Second * 60)
|
||||||
|
bot.tryEditMessage(apimesg, Translate(ctx, "apiHiddenMessage"))
|
||||||
}()
|
}()
|
||||||
// auto delete the message
|
|
||||||
// NewMessage(linkmsg, WithDuration(time.Second*time.Duration(internal.Configuration.Telegram.MessageDisposeDuration), bot))
|
|
||||||
return ctx, nil
|
return ctx, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ func UserGetLNURL(user *lnbits.User) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func UserGetAnonLNURL(user *lnbits.User) (string, error) {
|
func UserGetAnonLNURL(user *lnbits.User) (string, error) {
|
||||||
callback := fmt.Sprintf("%s/.well-known/lnurlp/%s", internal.Configuration.Bot.LNURLHostName, fmt.Sprint(user.AnonIDSha256))
|
callback := fmt.Sprintf("%s/.well-known/lnurlp/%s", internal.Configuration.Bot.LNURLHostName, user.AnonIDSha256)
|
||||||
lnurlEncode, err := lnurl.LNURLEncode(callback)
|
lnurlEncode, err := lnurl.LNURLEncode(callback)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ package telegram
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/runtime/mutex"
|
"github.com/LightningTipBot/LightningTipBot/internal/runtime/mutex"
|
||||||
@@ -195,7 +196,7 @@ func (bot *TipBot) confirmPayHandler(ctx intercept.Context) (intercept.Context,
|
|||||||
payData.Message,
|
payData.Message,
|
||||||
&tb.ReplyMarkup{
|
&tb.ReplyMarkup{
|
||||||
InlineKeyboard: [][]tb.InlineButton{
|
InlineKeyboard: [][]tb.InlineButton{
|
||||||
{tb.InlineButton{Text: i18n.Translate(payData.LanguageCode, "lnurlGettingUserMessage")}},
|
{tb.InlineButton{Unique: "attempt_payment", Text: i18n.Translate(payData.LanguageCode, "lnurlGettingUserMessage")}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
|
||||||
"image"
|
"image"
|
||||||
"image/jpeg"
|
"image/jpeg"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/pkg/lightning"
|
"github.com/LightningTipBot/LightningTipBot/pkg/lightning"
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package telegram
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/lnbits"
|
"github.com/LightningTipBot/LightningTipBot/internal/lnbits"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/runtime"
|
"github.com/LightningTipBot/LightningTipBot/internal/runtime"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/runtime/mutex"
|
"github.com/LightningTipBot/LightningTipBot/internal/runtime/mutex"
|
||||||
@@ -10,7 +12,6 @@ import (
|
|||||||
"github.com/eko/gocache/store"
|
"github.com/eko/gocache/store"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
tb "gopkg.in/lightningtipbot/telebot.v3"
|
tb "gopkg.in/lightningtipbot/telebot.v3"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (bot TipBot) shopsMainMenu(ctx intercept.Context, shops *Shops) *tb.ReplyMarkup {
|
func (bot TipBot) shopsMainMenu(ctx intercept.Context, shops *Shops) *tb.ReplyMarkup {
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
stderrors "errors"
|
stderrors "errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal"
|
"github.com/LightningTipBot/LightningTipBot/internal"
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
"github.com/LightningTipBot/LightningTipBot/internal/errors"
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
"github.com/LightningTipBot/LightningTipBot/internal/telegram/intercept"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/LightningTipBot/LightningTipBot/internal/lnbits"
|
"github.com/LightningTipBot/LightningTipBot/internal/lnbits"
|
||||||
"github.com/LightningTipBot/LightningTipBot/pkg/lightning"
|
"github.com/LightningTipBot/LightningTipBot/pkg/lightning"
|
||||||
|
|||||||
@@ -57,25 +57,26 @@ func startApiServer(bot *telegram.TipBot) {
|
|||||||
// userpage server
|
// userpage server
|
||||||
userpage := userpage.New(bot)
|
userpage := userpage.New(bot)
|
||||||
s.AppendRoute("/@{username}", userpage.UserPageHandler, http.MethodGet)
|
s.AppendRoute("/@{username}", userpage.UserPageHandler, http.MethodGet)
|
||||||
|
s.AppendRoute("/app/@{username}", userpage.UserWebAppHandler, http.MethodGet)
|
||||||
|
|
||||||
// append lndhub ctx functions
|
// append lndhub ctx functions
|
||||||
hub := lndhub.New(bot)
|
hub := lndhub.New(bot)
|
||||||
s.AppendRoute(`/lndhub/ext/{.*}`, hub.Handle)
|
s.AppendAuthorizedRoute(`/lndhub/ext/auth`, api.AuthTypeNone, api.AccessKeyTypeNone, bot.DB.Users, hub.Handle)
|
||||||
s.AppendRoute(`/lndhub/ext`, hub.Handle)
|
s.AppendAuthorizedRoute(`/lndhub/ext/{.*}`, api.AuthTypeBearerBase64, api.AccessKeyTypeAdmin, bot.DB.Users, hub.Handle)
|
||||||
//s.AppendAuthorizedRoute(`/lndhub/ext/{.*}`, api.AuthTypeBearer, bot.DB.Users, hub.Handle)
|
s.AppendAuthorizedRoute(`/lndhub/ext`, api.AuthTypeBearerBase64, api.AccessKeyTypeAdmin, bot.DB.Users, hub.Handle)
|
||||||
//s.AppendAuthorizedRoute(`/lndhub/ext`, api.AuthTypeBearer, bot.DB.Users, hub.Handle)
|
|
||||||
|
|
||||||
// starting api service
|
// starting api service
|
||||||
apiService := api.Service{Bot: bot}
|
apiService := api.Service{Bot: bot}
|
||||||
s.AppendAuthorizedRoute(`/api/v1/paymentstatus/{payment_hash}`, api.AuthTypeBasic, bot.DB.Users, apiService.PaymentStatus, http.MethodPost)
|
s.AppendAuthorizedRoute(`/api/v1/paymentstatus/{payment_hash}`, api.AuthTypeBasic, api.AccessKeyTypeInvoice, bot.DB.Users, apiService.PaymentStatus, http.MethodPost)
|
||||||
s.AppendAuthorizedRoute(`/api/v1/invoicestatus/{payment_hash}`, api.AuthTypeBasic, bot.DB.Users, apiService.InvoiceStatus, http.MethodPost)
|
s.AppendAuthorizedRoute(`/api/v1/invoicestatus/{payment_hash}`, api.AuthTypeBasic, api.AccessKeyTypeInvoice, bot.DB.Users, apiService.InvoiceStatus, http.MethodPost)
|
||||||
s.AppendAuthorizedRoute(`/api/v1/payinvoice`, api.AuthTypeBasic, bot.DB.Users, apiService.PayInvoice, http.MethodPost)
|
s.AppendAuthorizedRoute(`/api/v1/payinvoice`, api.AuthTypeBasic, api.AccessKeyTypeAdmin, bot.DB.Users, apiService.PayInvoice, http.MethodPost)
|
||||||
s.AppendAuthorizedRoute(`/api/v1/createinvoice`, api.AuthTypeBasic, bot.DB.Users, apiService.CreateInvoice, http.MethodPost)
|
s.AppendAuthorizedRoute(`/api/v1/invoicestream`, api.AuthTypeBasic, api.AccessKeyTypeInvoice, bot.DB.Users, apiService.InvoiceStream, http.MethodGet)
|
||||||
s.AppendAuthorizedRoute(`/api/v1/balance`, api.AuthTypeBasic, bot.DB.Users, apiService.Balance, http.MethodGet)
|
s.AppendAuthorizedRoute(`/api/v1/createinvoice`, api.AuthTypeBasic, api.AccessKeyTypeInvoice, bot.DB.Users, apiService.CreateInvoice, http.MethodPost)
|
||||||
|
s.AppendAuthorizedRoute(`/api/v1/balance`, api.AuthTypeBasic, api.AccessKeyTypeInvoice, bot.DB.Users, apiService.Balance, http.MethodGet)
|
||||||
|
|
||||||
// start internal admin server
|
// start internal admin server
|
||||||
adminService := admin.New(bot)
|
adminService := admin.New(bot)
|
||||||
internalAdminServer := api.NewServer("0.0.0.0:6060")
|
internalAdminServer := api.NewServer(internal.Configuration.Bot.AdminAPIHost)
|
||||||
internalAdminServer.AppendRoute("/mutex", mutex.ServeHTTP)
|
internalAdminServer.AppendRoute("/mutex", mutex.ServeHTTP)
|
||||||
internalAdminServer.AppendRoute("/mutex/unlock/{id}", mutex.UnlockHTTP)
|
internalAdminServer.AppendRoute("/mutex/unlock/{id}", mutex.UnlockHTTP)
|
||||||
internalAdminServer.AppendRoute("/admin/ban/{id}", adminService.BanUser)
|
internalAdminServer.AppendRoute("/admin/ban/{id}", adminService.BanUser)
|
||||||
@@ -84,9 +85,6 @@ func startApiServer(bot *telegram.TipBot) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func withMiddleware(mw func(w http.ResponseWriter, r *http.Request)) http.HandlerFunc {
|
|
||||||
return mw
|
|
||||||
}
|
|
||||||
func withRecovery() {
|
func withRecovery() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
log.Errorln("Recovered panic: ", r)
|
log.Errorln("Recovered panic: ", r)
|
||||||
|
|||||||
+12
-1
@@ -260,11 +260,22 @@ lnurlWithdrawSuccess = """✅ Abhebung angefordert."""
|
|||||||
|
|
||||||
walletConnectMessage = """🔗 *Verbinde dein Wallet*
|
walletConnectMessage = """🔗 *Verbinde dein Wallet*
|
||||||
|
|
||||||
⚠️ Teile diese URL und den QR code mit niemandem! Jeder, der darauf Zugriff hat, hat auch Zugriff auf dein Konto.
|
⚠️ Teile diese URL und den QR code mit niemandem! Jeder, der darauf Zugriff hat, hat auch Zugriff auf dein Konto. Nutze /api für deine API keys.
|
||||||
|
|
||||||
- *BlueWallet:* Drücke *New wallet*, *Import wallet*, *Scan or import a file*, und scanne den QR Code.
|
- *BlueWallet:* Drücke *New wallet*, *Import wallet*, *Scan or import a file*, und scanne den QR Code.
|
||||||
- *Zeus:* Kopiere die URL unten, drücke *Add a new node*, *Import* (die URL), *Save Node Config*."""
|
- *Zeus:* Kopiere die URL unten, drücke *Add a new node*, *Import* (die URL), *Save Node Config*."""
|
||||||
couldNotLinkMessage = """🚫 Konnte dein Wallet nicht verbinden. Bitte versuche es später noch einmal."""
|
couldNotLinkMessage = """🚫 Konnte dein Wallet nicht verbinden. Bitte versuche es später noch einmal."""
|
||||||
|
linkHiddenMessage = """🔍 Link versteckt. Gebe /link ein um ihn wieder zu sehen."""
|
||||||
|
|
||||||
|
# API
|
||||||
|
|
||||||
|
walletConnectMessage = """🔗 *Deine API Keys*
|
||||||
|
|
||||||
|
⚠️ Teile diese Key mit niemandem! Jeder, der darauf Zugriff hat, hat auch Zugriff auf dein Konto. Nutze /link um dein Wallet zu verbinden.
|
||||||
|
|
||||||
|
- *Admin key:* `%s`
|
||||||
|
- *Invoice key:* `%s`"""
|
||||||
|
apiHiddenMessage = """🔍 Keys versteckt. Gebe /api ein um sie wieder zu sehen."""
|
||||||
|
|
||||||
# FAUCET
|
# FAUCET
|
||||||
|
|
||||||
|
|||||||
+11
-1
@@ -264,13 +264,23 @@ lnurlWithdrawSuccess = """✅ Withdrawal requested."""
|
|||||||
|
|
||||||
walletConnectMessage = """🔗 *Link your wallet*
|
walletConnectMessage = """🔗 *Link your wallet*
|
||||||
|
|
||||||
⚠️ Never share the URL or the QR code with anyone or they will be able to access your funds.
|
⚠️ Never share the URL or the QR code with anyone or they will be able to access your funds. Use /api for your API keys.
|
||||||
|
|
||||||
- *BlueWallet:* Press *New wallet*, *Import wallet*, *Scan or import a file*, and scan the QR code.
|
- *BlueWallet:* Press *New wallet*, *Import wallet*, *Scan or import a file*, and scan the QR code.
|
||||||
- *Zeus:* Copy the URL below, press *Add a new node*, select *LNDHub* as Node interface, enter the URL, *Save Node Config*."""
|
- *Zeus:* Copy the URL below, press *Add a new node*, select *LNDHub* as Node interface, enter the URL, *Save Node Config*."""
|
||||||
couldNotLinkMessage = """🚫 Couldn't link your wallet. Please try again later."""
|
couldNotLinkMessage = """🚫 Couldn't link your wallet. Please try again later."""
|
||||||
linkHiddenMessage = """🔍 Link hidden. Enter /link to see it again."""
|
linkHiddenMessage = """🔍 Link hidden. Enter /link to see it again."""
|
||||||
|
|
||||||
|
# API
|
||||||
|
|
||||||
|
apiConnectMessage = """🔗 *Your API keys*
|
||||||
|
|
||||||
|
⚠️ Never share these keys with anyone or they will be able to access your funds. Use /link to link your wallet.
|
||||||
|
|
||||||
|
- *Admin key:* `%s`
|
||||||
|
- *Invoice key:* `%s`"""
|
||||||
|
apiHiddenMessage = """🔍 Keys hidden. Enter /api to see them again."""
|
||||||
|
|
||||||
# FAUCET
|
# FAUCET
|
||||||
|
|
||||||
inlineQueryFaucetTitle = """🚰 Create a faucet."""
|
inlineQueryFaucetTitle = """🚰 Create a faucet."""
|
||||||
|
|||||||
Reference in New Issue
Block a user