Compare commits
35 Commits
v0.3.0
...
778babcc05
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
778babcc05
|
||
|
|
fa3b53d3b3
|
||
|
|
0ca85656b7
|
||
|
|
f7183f68d5
|
||
| 87027b514b | |||
|
|
16ad621365
|
||
| 33e87d6472 | |||
|
03dc6c7a9c
|
|||
|
897b5bf4ea
|
|||
|
caea2d0121
|
|||
|
e1ff5c479e
|
|||
|
9b3386de30
|
|||
|
f2287c1186
|
|||
| b29197cf4e | |||
|
5c48055ac8
|
|||
|
5ead3476b7
|
|||
| fbf163740a | |||
|
|
1fc1457e97 | ||
| 1f57bbd9c2 | |||
|
2a2793ae44
|
|||
|
8773bf5f9e
|
|||
|
d9970c126a
|
|||
|
4e0d4bf86d
|
|||
|
333bcbfe7e
|
|||
| 875af6d14c | |||
| 8f87a03060 | |||
|
7838fe5f34
|
|||
|
512798d122
|
|||
|
384c28aaaa
|
|||
|
8e5d6dabdc
|
|||
|
ade9261c2c
|
|||
|
bd2a161306
|
|||
|
78c243c985
|
|||
|
cf62bfc5c2
|
|||
|
10f179a095
|
@@ -29,9 +29,6 @@ steps:
|
|||||||
- yarn install
|
- yarn install
|
||||||
- rake css:build
|
- rake css:build
|
||||||
- rake spec
|
- rake spec
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
- name: rebuild-cache
|
- name: rebuild-cache
|
||||||
image: drillster/drone-volume-cache
|
image: drillster/drone-volume-cache
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
EJABBERD_API_URL='https://xmpp.kosmos.org/api'
|
EJABBERD_API_URL='https://xmpp.kosmos.org/api'
|
||||||
|
BTCPAY_API_URL='http://localhost:23001/api/v1'
|
||||||
LNDHUB_API_URL='http://localhost:3023'
|
LNDHUB_API_URL='http://localhost:3023'
|
||||||
LNDHUB_PUBLIC_URL='https://lndhub.kosmos.org'
|
LNDHUB_PUBLIC_URL='https://lndhub.kosmos.org'
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
EJABBERD_API_URL='https://xmpp.kosmos.org:5443/api'
|
EJABBERD_API_URL='https://xmpp.kosmos.org:5443/api'
|
||||||
|
BTCPAY_API_URL='http://10.1.1.163:23001/api/v1'
|
||||||
LNDHUB_API_URL='http://10.1.1.163:3023'
|
LNDHUB_API_URL='http://10.1.1.163:3023'
|
||||||
LNDHUB_PUBLIC_URL='https://lndhub.kosmos.org'
|
LNDHUB_PUBLIC_URL='https://lndhub.kosmos.org'
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
EJABBERD_API_URL='http://xmpp.example.com/api'
|
EJABBERD_API_URL='http://xmpp.example.com/api'
|
||||||
|
BTCPAY_API_URL='http://btcpay.example.com/api/v1'
|
||||||
LNDHUB_API_URL='http://localhost:3023'
|
LNDHUB_API_URL='http://localhost:3023'
|
||||||
LNDHUB_PUBLIC_URL='https://lndhub.kosmos.org'
|
LNDHUB_PUBLIC_URL='https://lndhub.kosmos.org'
|
||||||
|
|||||||
21
Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM ruby:2.7
|
||||||
|
RUN apt-get update -qq && apt-get install -y curl ldap-utils
|
||||||
|
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
|
||||||
|
RUN apt-get update && apt-get install -y nodejs
|
||||||
|
WORKDIR /akkounts
|
||||||
|
COPY Gemfile /akkounts/Gemfile
|
||||||
|
COPY Gemfile.lock /akkounts/Gemfile.lock
|
||||||
|
COPY package.json /akkounts/package.json
|
||||||
|
RUN bundle install
|
||||||
|
RUN npm install -g yarn
|
||||||
|
RUN yarn install
|
||||||
|
|
||||||
|
# Add a script to be executed every time the container starts.
|
||||||
|
COPY docker/entrypoint.sh /usr/bin/
|
||||||
|
RUN chmod +x /usr/bin/entrypoint.sh
|
||||||
|
ENTRYPOINT ["entrypoint.sh"]
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Configure the main process to run when running the image
|
||||||
|
CMD ["bin", "dev"]
|
||||||
2
Gemfile
@@ -43,7 +43,7 @@ gem "rqrcode", "~> 2.0"
|
|||||||
gem 'faraday'
|
gem 'faraday'
|
||||||
|
|
||||||
# Background/scheduled jobs
|
# Background/scheduled jobs
|
||||||
gem 'sidekiq'
|
gem 'sidekiq', '< 7'
|
||||||
gem 'sidekiq-scheduler'
|
gem 'sidekiq-scheduler'
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
|
|||||||
271
Gemfile.lock
@@ -1,77 +1,77 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (7.0.2.2)
|
actioncable (7.0.4)
|
||||||
actionpack (= 7.0.2.2)
|
actionpack (= 7.0.4)
|
||||||
activesupport (= 7.0.2.2)
|
activesupport (= 7.0.4)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (>= 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
actionmailbox (7.0.2.2)
|
actionmailbox (7.0.4)
|
||||||
actionpack (= 7.0.2.2)
|
actionpack (= 7.0.4)
|
||||||
activejob (= 7.0.2.2)
|
activejob (= 7.0.4)
|
||||||
activerecord (= 7.0.2.2)
|
activerecord (= 7.0.4)
|
||||||
activestorage (= 7.0.2.2)
|
activestorage (= 7.0.4)
|
||||||
activesupport (= 7.0.2.2)
|
activesupport (= 7.0.4)
|
||||||
mail (>= 2.7.1)
|
mail (>= 2.7.1)
|
||||||
net-imap
|
net-imap
|
||||||
net-pop
|
net-pop
|
||||||
net-smtp
|
net-smtp
|
||||||
actionmailer (7.0.2.2)
|
actionmailer (7.0.4)
|
||||||
actionpack (= 7.0.2.2)
|
actionpack (= 7.0.4)
|
||||||
actionview (= 7.0.2.2)
|
actionview (= 7.0.4)
|
||||||
activejob (= 7.0.2.2)
|
activejob (= 7.0.4)
|
||||||
activesupport (= 7.0.2.2)
|
activesupport (= 7.0.4)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
net-imap
|
net-imap
|
||||||
net-pop
|
net-pop
|
||||||
net-smtp
|
net-smtp
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (7.0.2.2)
|
actionpack (7.0.4)
|
||||||
actionview (= 7.0.2.2)
|
actionview (= 7.0.4)
|
||||||
activesupport (= 7.0.2.2)
|
activesupport (= 7.0.4)
|
||||||
rack (~> 2.0, >= 2.2.0)
|
rack (~> 2.0, >= 2.2.0)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||||
actiontext (7.0.2.2)
|
actiontext (7.0.4)
|
||||||
actionpack (= 7.0.2.2)
|
actionpack (= 7.0.4)
|
||||||
activerecord (= 7.0.2.2)
|
activerecord (= 7.0.4)
|
||||||
activestorage (= 7.0.2.2)
|
activestorage (= 7.0.4)
|
||||||
activesupport (= 7.0.2.2)
|
activesupport (= 7.0.4)
|
||||||
globalid (>= 0.6.0)
|
globalid (>= 0.6.0)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
actionview (7.0.2.2)
|
actionview (7.0.4)
|
||||||
activesupport (= 7.0.2.2)
|
activesupport (= 7.0.4)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.4)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||||
activejob (7.0.2.2)
|
activejob (7.0.4)
|
||||||
activesupport (= 7.0.2.2)
|
activesupport (= 7.0.4)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (7.0.2.2)
|
activemodel (7.0.4)
|
||||||
activesupport (= 7.0.2.2)
|
activesupport (= 7.0.4)
|
||||||
activerecord (7.0.2.2)
|
activerecord (7.0.4)
|
||||||
activemodel (= 7.0.2.2)
|
activemodel (= 7.0.4)
|
||||||
activesupport (= 7.0.2.2)
|
activesupport (= 7.0.4)
|
||||||
activestorage (7.0.2.2)
|
activestorage (7.0.4)
|
||||||
actionpack (= 7.0.2.2)
|
actionpack (= 7.0.4)
|
||||||
activejob (= 7.0.2.2)
|
activejob (= 7.0.4)
|
||||||
activerecord (= 7.0.2.2)
|
activerecord (= 7.0.4)
|
||||||
activesupport (= 7.0.2.2)
|
activesupport (= 7.0.4)
|
||||||
marcel (~> 1.0)
|
marcel (~> 1.0)
|
||||||
mini_mime (>= 1.1.0)
|
mini_mime (>= 1.1.0)
|
||||||
activesupport (7.0.2.2)
|
activesupport (7.0.4)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 1.6, < 2)
|
i18n (>= 1.6, < 2)
|
||||||
minitest (>= 5.1)
|
minitest (>= 5.1)
|
||||||
tzinfo (~> 2.0)
|
tzinfo (~> 2.0)
|
||||||
addressable (2.8.0)
|
addressable (2.8.1)
|
||||||
public_suffix (>= 2.0.2, < 5.0)
|
public_suffix (>= 2.0.2, < 6.0)
|
||||||
bcrypt (3.1.16)
|
bcrypt (3.1.18)
|
||||||
bindex (0.8.1)
|
bindex (0.8.1)
|
||||||
builder (3.2.4)
|
builder (3.2.4)
|
||||||
capybara (3.36.0)
|
capybara (3.38.0)
|
||||||
addressable
|
addressable
|
||||||
matrix
|
matrix
|
||||||
mini_mime (>= 0.1.3)
|
mini_mime (>= 0.1.3)
|
||||||
@@ -81,12 +81,12 @@ GEM
|
|||||||
regexp_parser (>= 1.5, < 3.0)
|
regexp_parser (>= 1.5, < 3.0)
|
||||||
xpath (~> 3.2)
|
xpath (~> 3.2)
|
||||||
chunky_png (1.4.0)
|
chunky_png (1.4.0)
|
||||||
concurrent-ruby (1.1.9)
|
concurrent-ruby (1.1.10)
|
||||||
connection_pool (2.2.5)
|
connection_pool (2.3.0)
|
||||||
crack (0.4.5)
|
crack (0.4.5)
|
||||||
rexml
|
rexml
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
cssbundling-rails (1.0.0)
|
cssbundling-rails (1.1.1)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
database_cleaner (2.0.1)
|
database_cleaner (2.0.1)
|
||||||
database_cleaner-active_record (~> 2.0.0)
|
database_cleaner-active_record (~> 2.0.0)
|
||||||
@@ -104,44 +104,41 @@ GEM
|
|||||||
devise (>= 3.4.1)
|
devise (>= 3.4.1)
|
||||||
net-ldap (>= 0.16.0)
|
net-ldap (>= 0.16.0)
|
||||||
diff-lcs (1.5.0)
|
diff-lcs (1.5.0)
|
||||||
digest (3.1.0)
|
dotenv (2.8.1)
|
||||||
dotenv (2.7.6)
|
dotenv-rails (2.8.1)
|
||||||
dotenv-rails (2.7.6)
|
dotenv (= 2.8.1)
|
||||||
dotenv (= 2.7.6)
|
|
||||||
railties (>= 3.2)
|
railties (>= 3.2)
|
||||||
e2mmap (0.1.0)
|
erubi (1.11.0)
|
||||||
erubi (1.10.0)
|
et-orbi (1.2.7)
|
||||||
et-orbi (1.2.6)
|
|
||||||
tzinfo
|
tzinfo
|
||||||
factory_bot (6.2.0)
|
factory_bot (6.2.1)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
factory_bot_rails (6.2.0)
|
factory_bot_rails (6.2.0)
|
||||||
factory_bot (~> 6.2.0)
|
factory_bot (~> 6.2.0)
|
||||||
railties (>= 5.0.0)
|
railties (>= 5.0.0)
|
||||||
faraday (2.2.0)
|
faraday (2.7.1)
|
||||||
faraday-net_http (~> 2.0)
|
faraday-net_http (>= 2.0, < 3.1)
|
||||||
ruby2_keywords (>= 0.0.4)
|
ruby2_keywords (>= 0.0.4)
|
||||||
faraday-net_http (2.0.1)
|
faraday-net_http (3.0.2)
|
||||||
ffi (1.15.5)
|
ffi (1.15.5)
|
||||||
fugit (1.5.2)
|
fugit (1.7.2)
|
||||||
et-orbi (~> 1.1, >= 1.1.8)
|
et-orbi (~> 1, >= 1.2.7)
|
||||||
raabro (~> 1.4)
|
raabro (~> 1.4)
|
||||||
globalid (1.0.0)
|
globalid (1.0.0)
|
||||||
activesupport (>= 5.0)
|
activesupport (>= 5.0)
|
||||||
hashdiff (1.0.1)
|
hashdiff (1.0.1)
|
||||||
i18n (1.9.1)
|
i18n (1.12.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
importmap-rails (1.0.2)
|
importmap-rails (1.1.5)
|
||||||
actionpack (>= 6.0.0)
|
actionpack (>= 6.0.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
io-wait (0.2.1)
|
|
||||||
jbuilder (2.11.5)
|
jbuilder (2.11.5)
|
||||||
actionview (>= 5.0.0)
|
actionview (>= 5.0.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
launchy (2.5.0)
|
launchy (2.5.0)
|
||||||
addressable (~> 2.7)
|
addressable (~> 2.7)
|
||||||
letter_opener (1.7.0)
|
letter_opener (1.8.1)
|
||||||
launchy (~> 2.2)
|
launchy (>= 2.2, < 3)
|
||||||
letter_opener_web (2.0.0)
|
letter_opener_web (2.0.0)
|
||||||
actionmailer (>= 5.2)
|
actionmailer (>= 5.2)
|
||||||
letter_opener (~> 1.7)
|
letter_opener (~> 1.7)
|
||||||
@@ -150,8 +147,8 @@ GEM
|
|||||||
listen (3.7.1)
|
listen (3.7.1)
|
||||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||||
rb-inotify (~> 0.9, >= 0.9.10)
|
rb-inotify (~> 0.9, >= 0.9.10)
|
||||||
lockbox (0.6.8)
|
lockbox (1.1.0)
|
||||||
loofah (2.14.0)
|
loofah (2.19.0)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
mail (2.7.1)
|
mail (2.7.1)
|
||||||
@@ -160,130 +157,123 @@ GEM
|
|||||||
matrix (0.4.2)
|
matrix (0.4.2)
|
||||||
method_source (1.0.0)
|
method_source (1.0.0)
|
||||||
mini_mime (1.1.2)
|
mini_mime (1.1.2)
|
||||||
minitest (5.15.0)
|
minitest (5.16.3)
|
||||||
net-imap (0.2.3)
|
net-imap (0.3.1)
|
||||||
digest
|
|
||||||
net-protocol
|
net-protocol
|
||||||
strscan
|
net-ldap (0.17.1)
|
||||||
net-ldap (0.17.0)
|
net-pop (0.1.2)
|
||||||
net-pop (0.1.1)
|
|
||||||
digest
|
|
||||||
net-protocol
|
net-protocol
|
||||||
|
net-protocol (0.1.3)
|
||||||
timeout
|
timeout
|
||||||
net-protocol (0.1.2)
|
net-smtp (0.3.3)
|
||||||
io-wait
|
|
||||||
timeout
|
|
||||||
net-smtp (0.3.1)
|
|
||||||
digest
|
|
||||||
net-protocol
|
net-protocol
|
||||||
timeout
|
|
||||||
nio4r (2.5.8)
|
nio4r (2.5.8)
|
||||||
nokogiri (1.13.1-x86_64-linux)
|
nokogiri (1.13.9-x86_64-linux)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
pg (1.2.3)
|
pg (1.2.3)
|
||||||
public_suffix (4.0.6)
|
public_suffix (5.0.0)
|
||||||
puma (4.3.11)
|
puma (4.3.12)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
raabro (1.4.0)
|
raabro (1.4.0)
|
||||||
racc (1.6.0)
|
racc (1.6.0)
|
||||||
rack (2.2.3)
|
rack (2.2.4)
|
||||||
rack-test (1.1.0)
|
rack-test (2.0.2)
|
||||||
rack (>= 1.0, < 3)
|
rack (>= 1.3)
|
||||||
rails (7.0.2.2)
|
rails (7.0.4)
|
||||||
actioncable (= 7.0.2.2)
|
actioncable (= 7.0.4)
|
||||||
actionmailbox (= 7.0.2.2)
|
actionmailbox (= 7.0.4)
|
||||||
actionmailer (= 7.0.2.2)
|
actionmailer (= 7.0.4)
|
||||||
actionpack (= 7.0.2.2)
|
actionpack (= 7.0.4)
|
||||||
actiontext (= 7.0.2.2)
|
actiontext (= 7.0.4)
|
||||||
actionview (= 7.0.2.2)
|
actionview (= 7.0.4)
|
||||||
activejob (= 7.0.2.2)
|
activejob (= 7.0.4)
|
||||||
activemodel (= 7.0.2.2)
|
activemodel (= 7.0.4)
|
||||||
activerecord (= 7.0.2.2)
|
activerecord (= 7.0.4)
|
||||||
activestorage (= 7.0.2.2)
|
activestorage (= 7.0.4)
|
||||||
activesupport (= 7.0.2.2)
|
activesupport (= 7.0.4)
|
||||||
bundler (>= 1.15.0)
|
bundler (>= 1.15.0)
|
||||||
railties (= 7.0.2.2)
|
railties (= 7.0.4)
|
||||||
rails-dom-testing (2.0.3)
|
rails-dom-testing (2.0.3)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
nokogiri (>= 1.6)
|
nokogiri (>= 1.6)
|
||||||
rails-html-sanitizer (1.4.2)
|
rails-html-sanitizer (1.4.3)
|
||||||
loofah (~> 2.3)
|
loofah (~> 2.3)
|
||||||
railties (7.0.2.2)
|
railties (7.0.4)
|
||||||
actionpack (= 7.0.2.2)
|
actionpack (= 7.0.4)
|
||||||
activesupport (= 7.0.2.2)
|
activesupport (= 7.0.4)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 12.2)
|
rake (>= 12.2)
|
||||||
thor (~> 1.0)
|
thor (~> 1.0)
|
||||||
zeitwerk (~> 2.5)
|
zeitwerk (~> 2.5)
|
||||||
rake (13.0.6)
|
rake (13.0.6)
|
||||||
rb-fsevent (0.11.1)
|
rb-fsevent (0.11.2)
|
||||||
rb-inotify (0.10.1)
|
rb-inotify (0.10.1)
|
||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
redis (4.6.0)
|
redis (5.0.5)
|
||||||
regexp_parser (2.2.1)
|
redis-client (>= 0.9.0)
|
||||||
|
redis-client (0.11.2)
|
||||||
|
connection_pool
|
||||||
|
regexp_parser (2.6.1)
|
||||||
responders (3.0.1)
|
responders (3.0.1)
|
||||||
actionpack (>= 5.0)
|
actionpack (>= 5.0)
|
||||||
railties (>= 5.0)
|
railties (>= 5.0)
|
||||||
rexml (3.2.5)
|
rexml (3.2.5)
|
||||||
rqrcode (2.1.1)
|
rqrcode (2.1.2)
|
||||||
chunky_png (~> 1.0)
|
chunky_png (~> 1.0)
|
||||||
rqrcode_core (~> 1.0)
|
rqrcode_core (~> 1.0)
|
||||||
rqrcode_core (1.2.0)
|
rqrcode_core (1.2.0)
|
||||||
rspec-core (3.11.0)
|
rspec-core (3.12.0)
|
||||||
rspec-support (~> 3.11.0)
|
rspec-support (~> 3.12.0)
|
||||||
rspec-expectations (3.11.0)
|
rspec-expectations (3.12.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.11.0)
|
rspec-support (~> 3.12.0)
|
||||||
rspec-mocks (3.11.0)
|
rspec-mocks (3.12.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.11.0)
|
rspec-support (~> 3.12.0)
|
||||||
rspec-rails (5.1.0)
|
rspec-rails (6.0.1)
|
||||||
actionpack (>= 5.2)
|
actionpack (>= 6.1)
|
||||||
activesupport (>= 5.2)
|
activesupport (>= 6.1)
|
||||||
railties (>= 5.2)
|
railties (>= 6.1)
|
||||||
rspec-core (~> 3.10)
|
rspec-core (~> 3.11)
|
||||||
rspec-expectations (~> 3.10)
|
rspec-expectations (~> 3.11)
|
||||||
rspec-mocks (~> 3.10)
|
rspec-mocks (~> 3.11)
|
||||||
rspec-support (~> 3.10)
|
rspec-support (~> 3.11)
|
||||||
rspec-support (3.11.0)
|
rspec-support (3.12.0)
|
||||||
ruby2_keywords (0.0.5)
|
ruby2_keywords (0.0.5)
|
||||||
rufus-scheduler (3.8.1)
|
rufus-scheduler (3.8.2)
|
||||||
fugit (~> 1.1, >= 1.1.6)
|
fugit (~> 1.1, >= 1.1.6)
|
||||||
sidekiq (6.4.1)
|
sidekiq (6.5.5)
|
||||||
connection_pool (>= 2.2.2)
|
connection_pool (>= 2.2.2)
|
||||||
rack (~> 2.0)
|
rack (~> 2.0)
|
||||||
|
redis (>= 4.5.0)
|
||||||
|
sidekiq-scheduler (4.0.3)
|
||||||
redis (>= 4.2.0)
|
redis (>= 4.2.0)
|
||||||
sidekiq-scheduler (3.1.1)
|
|
||||||
e2mmap
|
|
||||||
redis (>= 3, < 5)
|
|
||||||
rufus-scheduler (~> 3.2)
|
rufus-scheduler (~> 3.2)
|
||||||
sidekiq (>= 3)
|
sidekiq (>= 4, < 7)
|
||||||
thwait
|
|
||||||
tilt (>= 1.4.0)
|
tilt (>= 1.4.0)
|
||||||
sprockets (4.0.2)
|
sprockets (4.1.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
sprockets-rails (3.4.2)
|
sprockets-rails (3.4.2)
|
||||||
actionpack (>= 5.2)
|
actionpack (>= 5.2)
|
||||||
activesupport (>= 5.2)
|
activesupport (>= 5.2)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
sqlite3 (1.4.2)
|
sqlite3 (1.5.4-x86_64-linux)
|
||||||
stimulus-rails (1.0.2)
|
stimulus-rails (1.2.1)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
strscan (3.0.1)
|
|
||||||
thor (1.2.1)
|
thor (1.2.1)
|
||||||
thwait (0.2.0)
|
tilt (2.0.11)
|
||||||
e2mmap
|
timeout (0.3.0)
|
||||||
tilt (2.0.10)
|
turbo-rails (1.3.2)
|
||||||
timeout (0.2.0)
|
|
||||||
turbo-rails (1.0.1)
|
|
||||||
actionpack (>= 6.0.0)
|
actionpack (>= 6.0.0)
|
||||||
|
activejob (>= 6.0.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
tzinfo (2.0.4)
|
tzinfo (2.0.5)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
view_component (2.49.0)
|
view_component (2.78.0)
|
||||||
activesupport (>= 5.0.0, < 8.0)
|
activesupport (>= 5.0.0, < 8.0)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
method_source (~> 1.0)
|
method_source (~> 1.0)
|
||||||
warden (1.2.9)
|
warden (1.2.9)
|
||||||
rack (>= 2.0.9)
|
rack (>= 2.0.9)
|
||||||
@@ -292,7 +282,7 @@ GEM
|
|||||||
activemodel (>= 6.0.0)
|
activemodel (>= 6.0.0)
|
||||||
bindex (>= 0.4.0)
|
bindex (>= 0.4.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
webmock (3.14.0)
|
webmock (3.18.1)
|
||||||
addressable (>= 2.8.0)
|
addressable (>= 2.8.0)
|
||||||
crack (>= 0.3.2)
|
crack (>= 0.3.2)
|
||||||
hashdiff (>= 0.4.0, < 2.0.0)
|
hashdiff (>= 0.4.0, < 2.0.0)
|
||||||
@@ -301,9 +291,10 @@ GEM
|
|||||||
websocket-extensions (0.1.5)
|
websocket-extensions (0.1.5)
|
||||||
xpath (3.2.0)
|
xpath (3.2.0)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
zeitwerk (2.5.4)
|
zeitwerk (2.6.6)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
|
ruby
|
||||||
x86_64-linux
|
x86_64-linux
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
@@ -327,7 +318,7 @@ DEPENDENCIES
|
|||||||
rails (~> 7.0.2)
|
rails (~> 7.0.2)
|
||||||
rqrcode (~> 2.0)
|
rqrcode (~> 2.0)
|
||||||
rspec-rails
|
rspec-rails
|
||||||
sidekiq
|
sidekiq (< 7)
|
||||||
sidekiq-scheduler
|
sidekiq-scheduler
|
||||||
sprockets-rails
|
sprockets-rails
|
||||||
sqlite3 (~> 1.4)
|
sqlite3 (~> 1.4)
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
web: bin/rails server -p 3000
|
web: bin/rails server -b 0.0.0.0 -p 3000
|
||||||
css: yarn build:css --watch
|
css: yarn build:css --watch
|
||||||
|
|||||||
@@ -7,3 +7,4 @@
|
|||||||
@import "components/forms";
|
@import "components/forms";
|
||||||
@import "components/links";
|
@import "components/links";
|
||||||
@import "components/notifications";
|
@import "components/notifications";
|
||||||
|
@import "components/tables";
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
@layer base {
|
@layer base {
|
||||||
body {
|
html {
|
||||||
@apply leading-none
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* h1, h2, h3 { */
|
body {
|
||||||
/* @apply font-light; */
|
@apply leading-none bg-cover bg-fixed;
|
||||||
/* } */
|
background-image: linear-gradient(35deg, rgba(255,0,255,0.2) 0, rgba(13,79,153,0.8) 100%), url('/img/bg-1.jpg');
|
||||||
|
}
|
||||||
|
|
||||||
|
body#admin {
|
||||||
|
background-image: linear-gradient(35deg, rgba(255,0,255,0.2) 0, rgba(153,12,14,0.9) 100%), url('/img/bg-1.jpg');
|
||||||
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
@apply text-3xl uppercase;
|
@apply text-3xl uppercase;
|
||||||
@@ -26,4 +31,16 @@
|
|||||||
main section:first-of-type {
|
main section:first-of-type {
|
||||||
@apply pt-0;
|
@apply pt-0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main p {
|
||||||
|
@apply mb-4 leading-6;
|
||||||
|
}
|
||||||
|
|
||||||
|
main ul {
|
||||||
|
@apply mb-6;
|
||||||
|
}
|
||||||
|
|
||||||
|
main ul li {
|
||||||
|
@apply leading-6;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
app/assets/stylesheets/components/tables.css
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
@layer components {
|
||||||
|
table {
|
||||||
|
@apply w-full;
|
||||||
|
}
|
||||||
|
|
||||||
|
table thead tr {
|
||||||
|
@apply text-left;
|
||||||
|
}
|
||||||
|
|
||||||
|
table th {
|
||||||
|
@apply pb-3.5 text-sm font-normal uppercase text-gray-500;
|
||||||
|
}
|
||||||
|
|
||||||
|
table th:not(:last-of-type),
|
||||||
|
table td:not(:last-of-type) {
|
||||||
|
@apply pr-2;
|
||||||
|
}
|
||||||
|
|
||||||
|
table td {
|
||||||
|
@apply py-2;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
@import "legacy/layout";
|
|
||||||
@import "legacy/main_nav";
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
@import "variables";
|
|
||||||
@import "mediaqueries";
|
|
||||||
|
|
||||||
body {
|
|
||||||
background: linear-gradient(35deg, rgba(255,0,255,0.2) 0, rgba(13,79,153,0.8) 100%),
|
|
||||||
url('/img/bg-1.jpg');
|
|
||||||
background-size: cover;
|
|
||||||
background-attachment: fixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
body#admin {
|
|
||||||
background: linear-gradient(35deg, rgba(255,0,255,0.2) 0, rgba(153,12,14,0.9) 100%),
|
|
||||||
url('/img/bg-1.jpg');
|
|
||||||
background-size: cover;
|
|
||||||
background-attachment: fixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ks-site-icon {
|
|
||||||
svg {
|
|
||||||
display: inline-block;
|
|
||||||
height: 1.875rem;
|
|
||||||
vertical-align: top;
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#wrapper {
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
> header {
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 4rem 0;
|
|
||||||
text-align: center;
|
|
||||||
background: linear-gradient(35deg, rgba(255,0,255,0.2) 0, rgba(13,79,153,0.8) 100%),
|
|
||||||
url('/img/bg-1.jpg');
|
|
||||||
background-size: cover;
|
|
||||||
|
|
||||||
@include media-max(small) {
|
|
||||||
padding: 3rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
color: #fff;
|
|
||||||
|
|
||||||
span.project-name {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
p.current-user {
|
|
||||||
color: rgba(255,255,255,0.6);
|
|
||||||
|
|
||||||
@include media-max(small) {
|
|
||||||
font-size: 0.85rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: rgba(255,255,255,0.6);
|
|
||||||
transition: color 0.1s linear;
|
|
||||||
|
|
||||||
&:hover, &:active {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main {
|
|
||||||
p {
|
|
||||||
line-height: 1.5rem;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
|
|
||||||
&.notice {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
|
|
||||||
li {
|
|
||||||
line-height: 1.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
th {
|
|
||||||
color: $text-color-discreet;
|
|
||||||
font-weight: normal;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
padding-bottom: 0.825rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
|
||||||
padding-top: 0.5rem;
|
|
||||||
padding-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.grid {
|
|
||||||
display: grid;
|
|
||||||
|
|
||||||
&.services {
|
|
||||||
grid-template-columns: 1fr 1fr 1fr;
|
|
||||||
grid-row-gap: 1rem;
|
|
||||||
grid-column-gap: 2rem;
|
|
||||||
|
|
||||||
@include media-max(small) {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
@import "variables";
|
|
||||||
@import "mediaqueries";
|
|
||||||
|
|
||||||
#main-nav {
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #efefef;
|
|
||||||
|
|
||||||
.wrapper {
|
|
||||||
width: $content-width;
|
|
||||||
max-width: $content-max-width;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
|
||||||
@include media-max(large) {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
@include media-min(large) {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
@include media-max(large) {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 1.5rem 2rem;
|
|
||||||
text-decoration: none;
|
|
||||||
color: $text-color-discreet;
|
|
||||||
|
|
||||||
@include media-max(large) {
|
|
||||||
display: block;
|
|
||||||
text-align: center;
|
|
||||||
padding-left: 0;
|
|
||||||
padding-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@include media-max(small) {
|
|
||||||
font-size: 0.85rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
color: $text-color-body;
|
|
||||||
border-bottom: 2px solid #4ea2df;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
$breakpoints-max: (
|
|
||||||
small: 600px,
|
|
||||||
medium: 960px,
|
|
||||||
large: 1280px
|
|
||||||
);
|
|
||||||
|
|
||||||
$breakpoints-min: (
|
|
||||||
small: 601px,
|
|
||||||
medium: 961px,
|
|
||||||
large: 1281px
|
|
||||||
);
|
|
||||||
|
|
||||||
@mixin media-max($screen-size) {
|
|
||||||
@if map-has-key($breakpoints-max, $screen-size) {
|
|
||||||
@media (max-width: map-get($breakpoints-max, $screen-size)) {
|
|
||||||
@content;
|
|
||||||
}
|
|
||||||
} @else {
|
|
||||||
// Debugging
|
|
||||||
@warn "'#{$screen-size}' has not been declared as a breakpoint."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin media-min($screen-size) {
|
|
||||||
@if map-has-key($breakpoints-min, $screen-size) {
|
|
||||||
@media (min-width: map-get($breakpoints-min, $screen-size)) {
|
|
||||||
@content;
|
|
||||||
}
|
|
||||||
} @else {
|
|
||||||
// Debugging
|
|
||||||
@warn "'#{$screen-size}' has not been declared as a breakpoint."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
$content-width: 800px;
|
|
||||||
$content-max-width: 100%;
|
|
||||||
|
|
||||||
$text-color-body: #222;
|
|
||||||
$text-color-discreet: #888;
|
|
||||||
|
|
||||||
$background-color-notice: #efffc4;
|
|
||||||
$background-color-alert: #fff4c2;
|
|
||||||
|
|
||||||
$color-blue: #0d4f99;
|
|
||||||
$color-purple: #8955a0;
|
|
||||||
$color-red-bright: #c00;
|
|
||||||
$color-red-dark: #990c0e;
|
|
||||||
18
app/components/wallet_summary_component.html.erb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<section class="w-full grid grid-cols-1 md:grid-cols-12 md:mb-0">
|
||||||
|
<div class="md:col-span-8">
|
||||||
|
<p>
|
||||||
|
Send and receive sats via the Bitcoin Lightning Network.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="md:col-span-4 mt-4 md:mt-0">
|
||||||
|
<p class="font-mono md:text-right mb-0 p-4 border border-gray-300 rounded-lg overflow-hidden">
|
||||||
|
<% if @balance %>
|
||||||
|
<span class="text-xl"><%= number_with_delimiter @balance %> sats</span><br>
|
||||||
|
<span class="text-sm text-gray-500">Available balance</span>
|
||||||
|
<% else %>
|
||||||
|
<span class="text-xl">n/a sats</span><br>
|
||||||
|
<span class="text-sm text-gray-500">Balance unavailable</span>
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
8
app/components/wallet_summary_component.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class WalletSummaryComponent < ViewComponent::Base
|
||||||
|
def initialize(balance:)
|
||||||
|
@balance = balance
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
5
app/controllers/api/base_controller.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class Api::BaseController < ApplicationController
|
||||||
|
|
||||||
|
layout false
|
||||||
|
|
||||||
|
end
|
||||||
13
app/controllers/api/kredits_controller.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
class Api::KreditsController < Api::BaseController
|
||||||
|
|
||||||
|
def onchain_btc_balance
|
||||||
|
btcpay = BtcPay.new
|
||||||
|
balance = btcpay.onchain_wallet_balance
|
||||||
|
render json: balance
|
||||||
|
rescue => error
|
||||||
|
Rails.logger.warn "Failed to fetch kredits BTC wallet balance: #{error.message}"
|
||||||
|
render json: { error: 'Failed to fetch wallet balance' },
|
||||||
|
status: 500
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
class LnurlpayController < ApplicationController
|
class LnurlpayController < ApplicationController
|
||||||
before_action :find_user_by_address
|
before_action :find_user_by_address
|
||||||
|
|
||||||
MIN_SATS = 100
|
MIN_SATS = 10
|
||||||
MAX_SATS = 1_000_000
|
MAX_SATS = 1_000_000
|
||||||
MAX_COMMENT_CHARS = 100
|
MAX_COMMENT_CHARS = 100
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ require "rqrcode"
|
|||||||
class WalletController < ApplicationController
|
class WalletController < ApplicationController
|
||||||
before_action :require_user_signed_in
|
before_action :require_user_signed_in
|
||||||
before_action :authenticate_with_lndhub
|
before_action :authenticate_with_lndhub
|
||||||
|
before_action :set_current_section
|
||||||
|
before_action :fetch_balance
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@current_section = :wallet
|
|
||||||
|
|
||||||
@wallet_url = "lndhub://#{current_user.ln_login}:#{current_user.ln_password}@#{ENV['LNDHUB_PUBLIC_URL']}"
|
@wallet_url = "lndhub://#{current_user.ln_login}:#{current_user.ln_password}@#{ENV['LNDHUB_PUBLIC_URL']}"
|
||||||
|
|
||||||
qrcode = RQRCode::QRCode.new(@wallet_url)
|
qrcode = RQRCode::QRCode.new(@wallet_url)
|
||||||
@@ -20,8 +20,10 @@ class WalletController < ApplicationController
|
|||||||
class: 'inline-block'
|
class: 'inline-block'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
@balance = fetch_balance rescue nil
|
def transactions
|
||||||
|
@transactions = fetch_transactions
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -39,9 +41,41 @@ class WalletController < ApplicationController
|
|||||||
# TODO add exception tracking
|
# TODO add exception tracking
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_current_section
|
||||||
|
@current_section = :wallet
|
||||||
|
end
|
||||||
|
|
||||||
def fetch_balance
|
def fetch_balance
|
||||||
lndhub = Lndhub.new
|
lndhub = Lndhub.new
|
||||||
data = lndhub.balance @ln_auth_token
|
data = lndhub.balance @ln_auth_token
|
||||||
data["BTC"]["AvailableBalance"]
|
@balance = data["BTC"]["AvailableBalance"] rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def fetch_transactions
|
||||||
|
lndhub = Lndhub.new
|
||||||
|
txs = lndhub.gettxs @ln_auth_token
|
||||||
|
invoices = lndhub.getuserinvoices(@ln_auth_token).select{|i| i["ispaid"]}
|
||||||
|
|
||||||
|
process_transactions(txs + invoices)
|
||||||
|
end
|
||||||
|
|
||||||
|
def process_transactions(txs)
|
||||||
|
txs.collect do |tx|
|
||||||
|
if tx["type"] == "bitcoind_tx"
|
||||||
|
tx["amount_sats"] = (tx["amount"] * 100000000).to_i
|
||||||
|
tx["datetime"] = Time.at(tx["time"].to_i)
|
||||||
|
tx["title"] = "Received"
|
||||||
|
tx["description"] = "On-chain topup"
|
||||||
|
tx["received"] = true
|
||||||
|
else
|
||||||
|
tx["amount_sats"] = tx["value"] || tx["amt"]
|
||||||
|
tx["datetime"] = Time.at(tx["timestamp"].to_i)
|
||||||
|
tx["title"] = tx["type"] == "paid_invoice" ? "Sent" : "Received"
|
||||||
|
tx["description"] = tx["memo"] || tx["description"]
|
||||||
|
tx["received"] = tx["type"] == "user_invoice"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
txs.sort{ |a,b| b["datetime"] <=> a["datetime"] }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
32
app/services/btc_pay.rb
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#
|
||||||
|
# API Docs: https://docs.btcpayserver.org/API/Greenfield/v1/
|
||||||
|
#
|
||||||
|
class BtcPay
|
||||||
|
def initialize
|
||||||
|
@base_url = ENV["BTCPAY_API_URL"]
|
||||||
|
@store_id = Rails.application.credentials.btcpay[:store_id]
|
||||||
|
@auth_token = Rails.application.credentials.btcpay[:auth_token]
|
||||||
|
end
|
||||||
|
|
||||||
|
def onchain_wallet_balance
|
||||||
|
res = get "stores/#{@store_id}/payment-methods/onchain/BTC/wallet"
|
||||||
|
|
||||||
|
{
|
||||||
|
balance: res["balance"].to_f,
|
||||||
|
unconfirmed_balance: res["unconfirmedBalance"].to_f,
|
||||||
|
confirmed_balance: res["confirmedBalance"].to_f
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def get(endpoint)
|
||||||
|
res = Faraday.get("#{@base_url}/#{endpoint}", {}, {
|
||||||
|
"Content-Type" => "application/json",
|
||||||
|
"Accept" => "application/json",
|
||||||
|
"Authorization" => "token #{@auth_token}"
|
||||||
|
})
|
||||||
|
|
||||||
|
JSON.parse(res.body)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -46,6 +46,14 @@ class Lndhub
|
|||||||
get "balance", user_token || auth_token
|
get "balance", user_token || auth_token
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def gettxs(user_token)
|
||||||
|
get "gettxs", user_token || auth_token
|
||||||
|
end
|
||||||
|
|
||||||
|
def getuserinvoices(user_token)
|
||||||
|
get "getuserinvoices", user_token || auth_token
|
||||||
|
end
|
||||||
|
|
||||||
def addinvoice(payload)
|
def addinvoice(payload)
|
||||||
invoice = post "addinvoice", {
|
invoice = post "addinvoice", {
|
||||||
amt: payload[:amount],
|
amt: payload[:amount],
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
<%= render MainSimpleComponent.new do %>
|
<%= render MainSimpleComponent.new do %>
|
||||||
<% if @donations.any? %>
|
<% if @donations.any? %>
|
||||||
<table class="w-full">
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="text-left">
|
<tr>
|
||||||
<th>User</th>
|
<th>User</th>
|
||||||
<th>Amount BTC</th>
|
<th class="text-right">Amount BTC</th>
|
||||||
<th>in EUR</th>
|
<th class="text-right">in EUR</th>
|
||||||
<th>in USD</th>
|
<th class="text-right">in USD</th>
|
||||||
<th>Public name</th>
|
<th class="pl-2">Public name</th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th colspan="3"></th>
|
<th colspan="3"></th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
<% @donations.each do |donation| %>
|
<% @donations.each do |donation| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= donation.user.address %></td>
|
<td><%= donation.user.address %></td>
|
||||||
<td><%= sats_to_btc donation.amount_sats %> BTC</td>
|
<td class="text-right"><%= sats_to_btc donation.amount_sats %></td>
|
||||||
<td><% if donation.amount_eur.present? %><%= number_to_currency donation.amount_eur / 100, unit: "" %><% end %></td>
|
<td class="text-right"><% if donation.amount_eur.present? %><%= number_to_currency donation.amount_eur / 100, unit: "" %><% end %></td>
|
||||||
<td><% if donation.amount_usd.present? %><%= number_to_currency donation.amount_usd / 100, unit: "" %><% end %></td>
|
<td class="text-right"><% if donation.amount_usd.present? %><%= number_to_currency donation.amount_usd / 100, unit: "" %><% end %></td>
|
||||||
<td><%= donation.public_name %></td>
|
<td class="pl-2"><%= donation.public_name %></td>
|
||||||
<td><%= donation.paid_at ? donation.paid_at.strftime("%Y-%m-%d") : "" %></td>
|
<td><%= donation.paid_at ? donation.paid_at.strftime("%Y-%m-%d") : "" %></td>
|
||||||
<td><%= link_to 'Show', admin_donation_path(donation), class: 'btn btn-sm btn-gray' %></td>
|
<td><%= link_to 'Show', admin_donation_path(donation), class: 'btn btn-sm btn-gray' %></td>
|
||||||
<td><%= link_to 'Edit', edit_admin_donation_path(donation), class: 'btn btn-sm btn-gray' %></td>
|
<td><%= link_to 'Edit', edit_admin_donation_path(donation), class: 'btn btn-sm btn-gray' %></td>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<h3>Accepted (<%= @invitations_used.length %>)</h3>
|
<h3>Accepted (<%= @invitations_used.length %>)</h3>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="text-left">
|
<tr>
|
||||||
<th>Token</th>
|
<th>Token</th>
|
||||||
<th>Accepted</th>
|
<th>Accepted</th>
|
||||||
<th>Invited user</th>
|
<th>Invited user</th>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="text-left">
|
<tr>
|
||||||
<th>UID</th>
|
<th>UID</th>
|
||||||
<th>E-Mail</th>
|
<th>E-Mail</th>
|
||||||
<th>Admin</th>
|
<th>Admin</th>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
Your Kosmos account and password currently give you access to these
|
Your Kosmos account and password currently give you access to these
|
||||||
services:
|
services:
|
||||||
</p>
|
</p>
|
||||||
<div class="grid services mt-12">
|
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6 services mt-12">
|
||||||
<div>
|
<div>
|
||||||
<h3 class="mb-3.5">
|
<h3 class="mb-3.5">
|
||||||
<%= link_to "Chat", "https://wiki.kosmos.org/Services:Chat", class: "ks-text-link" %>
|
<%= link_to "Chat", "https://wiki.kosmos.org/Services:Chat", class: "ks-text-link" %>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h3 class="mb-3.5">
|
<h3 class="mb-3.5">
|
||||||
<span class="text-yellow-500">🗲</span>
|
<%= render partial: "icons/zap", locals: { custom_class: "text-amber-500 h-4 w-4 inline" } %>
|
||||||
<%= link_to "Lightning Wallet", wallet_path, class: "ks-text-link" %>
|
<%= link_to "Lightning Wallet", wallet_path, class: "ks-text-link" %>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="text-gray-500">
|
<p class="text-gray-500">
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link-2"><path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path><line x1="8" y1="12" x2="16" y2="12"></line></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link-2 <%= custom_class %>"><path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path><line x1="8" y1="12" x2="16" y2="12"></line></svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 376 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link <%= custom_class %>"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 392 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-zap"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-zap <%= custom_class %>"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon></svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 303 B |
@@ -8,7 +8,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<table class="mt-12">
|
<table class="mt-12">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="text-left">
|
<tr>
|
||||||
<th>URL</th>
|
<th>URL</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<h3>Accepted Invitations</h3>
|
<h3>Accepted Invitations</h3>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="text-left">
|
<tr>
|
||||||
<th class="hidden md:block">ID</th>
|
<th class="hidden md:block">ID</th>
|
||||||
<th>Accepted</th>
|
<th>Accepted</th>
|
||||||
<th>Invited user</th>
|
<th>Invited user</th>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
<%= csp_meta_tag %>
|
<%= csp_meta_tag %>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link href="https://assets.kosmos.org/fonts/open-sans/open-sans.css" rel="stylesheet">
|
<link href="https://assets.kosmos.org/fonts/open-sans/open-sans.css" rel="stylesheet">
|
||||||
<%= stylesheet_link_tag 'legacy', "data-turbo-track": "reload" %>
|
|
||||||
<%= stylesheet_link_tag 'application', "data-turbo-track": "reload" %>
|
<%= stylesheet_link_tag 'application', "data-turbo-track": "reload" %>
|
||||||
<%= javascript_importmap_tags %>
|
<%= javascript_importmap_tags %>
|
||||||
</head>
|
</head>
|
||||||
@@ -18,7 +17,7 @@
|
|||||||
<div class="flex items-center justify-between h-16 px-4 sm:px-0">
|
<div class="flex items-center justify-between h-16 px-4 sm:px-0">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<div class="ks-site-icon flex-shrink-0">
|
<div class="ks-site-icon flex-shrink-0">
|
||||||
<%= render partial: "shared/icons/comet" %>
|
<%= render partial: "shared/icons/comet", locals: { custom_class: "inline-block align-top w-auto h-7" } %>
|
||||||
</div>
|
</div>
|
||||||
<% if user_signed_in? && current_user.confirmed? %>
|
<% if user_signed_in? && current_user.confirmed? %>
|
||||||
<div class="hidden md:block">
|
<div class="hidden md:block">
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<svg id="icon-comet" width="65.364" height="55.773" enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 65.364 55.773" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><g id="layer1" transform="translate(28.868 20.259)" fill="#fff"><path id="path2" d="m22.81-9.2546-0.0137-0.0072c-0.0445-0.0196-0.0895-0.04052-0.13335-0.06078l-23.822-10.937s2.0034 9.219 2.914 11.778c0 0-27.292-8.1582-30.623-8.9354 1.0916 4.2618 20.006 40.848 20.006 40.848 3.8225 7.7608 12.677 12.083 21.912 12.083 12.949 0 23.446-10.497 23.446-23.446 6.6e-4 -9.4655-5.609-17.62-13.685-21.323z" fill="#fff" stroke-width=".65365"/></g></svg>
|
<svg id="icon-comet" class="<%= custom_class %>" width="65.364" height="55.773" enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 65.364 55.773" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><g id="layer1" transform="translate(28.868 20.259)" fill="#fff"><path id="path2" d="m22.81-9.2546-0.0137-0.0072c-0.0445-0.0196-0.0895-0.04052-0.13335-0.06078l-23.822-10.937s2.0034 9.219 2.914 11.778c0 0-27.292-8.1582-30.623-8.9354 1.0916 4.2618 20.006 40.848 20.006 40.848 3.8225 7.7608 12.677 12.083 21.912 12.083 12.949 0 23.446-10.497 23.446-23.446 6.6e-4 -9.4655-5.609-17.62-13.685-21.323z" fill="#fff" stroke-width=".65365"/></g></svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 627 B After Width: | Height: | Size: 655 B |
@@ -1,22 +1,14 @@
|
|||||||
<%= render HeaderComponent.new(title: "Wallet") %>
|
<%= render HeaderComponent.new(title: "Wallet") %>
|
||||||
|
|
||||||
<%= render MainSimpleComponent.new do %>
|
<%= render MainSimpleComponent.new do %>
|
||||||
<section class="w-full grid grid-cols-1 md:grid-cols-12 md:mb-0">
|
<%= render WalletSummaryComponent.new(balance: @balance) %>
|
||||||
<div class="md:col-span-8">
|
|
||||||
<p>
|
<section>
|
||||||
Send and receive sats via the Bitcoin Lightning Network.
|
<div class="border-b border-gray-200">
|
||||||
</p>
|
<nav class="-mb-px flex" aria-label="Tabs">
|
||||||
</div>
|
<%= link_to "Info", wallet_path, class: "border-indigo-500 text-indigo-600 w-1/2 py-4 px-1 text-center border-b-2", "aria-current": "page" %>
|
||||||
<div class="md:col-span-4 mt-4 md:mt-0">
|
<%= link_to "Transactions", wallet_transactions_path, class: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 w-1/2 py-4 px-1 text-center border-b-2" %>
|
||||||
<p class="font-mono md:text-right mb-0 p-4 border border-gray-300 rounded-lg overflow-hidden">
|
</nav>
|
||||||
<% if @balance %>
|
|
||||||
<span class="text-xl"><%= number_with_delimiter @balance %> sats</span><br>
|
|
||||||
<span class="text-sm text-gray-500">Available balance</span>
|
|
||||||
<% else %>
|
|
||||||
<span class="text-xl">n/a sats</span><br>
|
|
||||||
<span class="text-sm text-gray-500">Balance unavailable</span>
|
|
||||||
<% end %>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
57
app/views/wallet/transactions.html.erb
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<%= render HeaderComponent.new(title: "Wallet") %>
|
||||||
|
|
||||||
|
<%= render MainSimpleComponent.new do %>
|
||||||
|
<%= render WalletSummaryComponent.new(balance: @balance) %>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<div class="border-b border-gray-200">
|
||||||
|
<nav class="-mb-px flex" aria-label="Tabs">
|
||||||
|
<%= link_to "Info", wallet_path, class: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 w-1/2 py-4 px-1 text-center border-b-2" %>
|
||||||
|
<%= link_to "Transactions", wallet_transactions_path, class: "border-indigo-500 text-indigo-600 w-1/2 py-4 px-1 text-center border-b-2", "aria-current": "page" %>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h3 class="hidden">Transactions</h3>
|
||||||
|
|
||||||
|
<% if @transactions.any? %>
|
||||||
|
<ul class="list-none">
|
||||||
|
<% @transactions.each do |tx| %>
|
||||||
|
<li class="py-4 md:py-4 grid gap-y-1 gap-x-2 grid-cols-4 border-b border-dotted border-gray-300">
|
||||||
|
<h3 class="col-span-2 md:col-span-3 mb-0">
|
||||||
|
<% if tx["type"] == "bitcoind_tx" %>
|
||||||
|
<span class="inline-block">
|
||||||
|
<%= render partial: "icons/link-2", locals: { custom_class: "text-emerald-500 h-4 w-4 mr-0.5" } %>
|
||||||
|
</span>
|
||||||
|
<% else %>
|
||||||
|
<span class="inline-block">
|
||||||
|
<%= render partial: "icons/zap", locals: { custom_class: "text-amber-500 h-4 w-4 mr-0.5" } %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
<%= tx["title"] %>
|
||||||
|
</h3>
|
||||||
|
<p class="col-span-2 md:col-span-1 mb-0 text-right">
|
||||||
|
<span class="text-xl font-mono <%= tx["received"] ? "text-emerald-600" : "" %>">
|
||||||
|
<%= tx["received"] ? "+" : "" %><%= number_with_delimiter tx["amount_sats"] %>
|
||||||
|
<span class="hidden md:inline">sats</span>
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
<p class="col-span-4 md:col-span-3 mb-0 text-gray-500">
|
||||||
|
<%= tx["description"].present? ? tx["description"] : raw("<span class='text-gray-400'>No memo</span>") %>
|
||||||
|
</p>
|
||||||
|
<p class="col-span-4 md:col-span-1 md:text-right mb-0">
|
||||||
|
<span class="col-span-2 md:col-span-1 text-sm text-gray-500">
|
||||||
|
<%= tx["datetime"].strftime("%B %e, %H:%M") %>
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% else %>
|
||||||
|
<p class="text-gray-500">
|
||||||
|
No transactions yet. As soon as you start receiving sats, you will find some entries here.
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</section>
|
||||||
|
<% end %>
|
||||||
@@ -1 +1 @@
|
|||||||
PRI1laGy6XiLpsII0ixFOTCpzzDbrRpIQ7GJ2flvA+UEEiPVQQ4e/pt6ZjumaZ/geTBHCRZklLtS1u6HjucVKHGSR4K/lE1q7u6nfi/wAvwGQdCTJeKf8PetdlsiVZg2OW4Wi2YF7qtb1ipGS/uRlOeLP8JOwp5BNVS1J6tvNX4T5gA7rrB4Cvtfwp1dwLWODHiXbeZK7SN2j7V3NPGZl0LbNg2jquC4DzQOBhMOlwu1IAgOAcqKbHh9tDabpVOcOD5pNSaVaoBO01P8ObbX8x0S0Ug7BPkM5nnyJTQdNH7LHKvtNmrUEk7+fd+VZR6WqEp6SFBoAA7XxvOLy9dIOqvXbAYnrNZX7iI4IpgZWRNIQ7G1qSBjpyPLKC7+nSPmvd4IcgCHVUBdYp0+yYDxLzwuuhPVtyAY4JAIdZY1mhYxx7BzGNiMc3p8AlMS6hPeO9lVQZykViBGnTjR+iah9OQYAihX9FYywtBkNvMXLiYqsVZmv6em9Uk/ivKSIsaFwNwrelCI5H4Q/+/hKFJ1JaMjbYheXCJgcGgfhiC+fIHig/8y8rXd9lWGa1T+PrpA8akcq/K8I6gbxYxpLWcy5Vnz/SyaMurLPVfCq4cD/JfpLSfy0HophaiycZ7D6dr43rnHsPfrt6kveDOgWUK9d7CqHxsWdXbCpJeBoh8/1usIsGsmyhfwHq0dEpRx78bR2EJeM4LOAuQgf69/5rFJydIbXq76l1BftTls1Pgh--OI8c/RQGQ30wT1Ff--M/ltnmdl+FRdlNliTb79lg==
|
oDf4FcihlyfHQuf9SUwfr+UVA0kXoECtHV3vEwtBp2TktCWkWz7SPbSZ2cLT0+EknOKhuI9xutrs311YDU2EzqZba4fZ0+a6/ohVH4jUbk1XfiHZWBp4zh+9TZ5m5Tp2RxcXpdcWPY38mP4zHWFzobTOR/brLjuemozvh8MiBSPY4NN5NR6rbFo87auK6fvYO8ik/1Qwf6pQMoVDjcTh2983po1RU/gSevUmaYsmTTHcQ5T9O9wMIBc101iZyKhkAZG46a6eNYok8yqRm18AHWr+De2j7LlBaqYSz/BZA385RWhhqoeONArwyo3Az30Bv74VttUSJAPurkRg2wDF9t8A+cvf8CeYkZ6u398JLSJbZZ6YdQS5T4IcrnONRXtp3d/m+yw+XEzpluK3MvFbV02AhZk/xzkGK6xonhaTSh1ek9hXoYrUTBzu8HBzXwKjJMnvrAodldu++/rMwLsgVmFHqXC3dydVogatLev8z6ziuGkmeMAR1d9kzGBHM3FWgsWLD7j0Ug7MTMyNWioI3r6J2QTnxkyJGh3pKBlq8Fb/Q0ypERxOfSZVQQh2gB79RMEDIemdCmN5mCU3ojsxqAAip4v9C1BZMWPtom1sHLYQSd9Bh6i0nncrNEtZXcxe5Z8JCWQolHvvfoIF2rfJh2oXYLxNx5n/1fzaoSqBdLBgvsAMA0ZWfV1wa/5V/DCa9vaJjumzHYKcfCCYbVz9PjN9OUSfwrE3nWZu8Y0awsNgmeRQwI10j2+oYYSBp040I05Vj5FM7nCgHLpdupctwaH2/VlIq83OVI6VlbzxYEay7+R5ANmpiJ+vC466DzLv8LAeFOqh/XeNeOITUm9EzhGSgf98yuDc7vsi3gmc2g7atgQ3gpSje6vEfhigm3ukydaGfA==--IYQBMD+Tar1g+srm--01E5mujYFWvcpT8Qd9HxiA==
|
||||||
@@ -1 +0,0 @@
|
|||||||
2a8a17892dd9f41ea50c61310c83240b
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
zdpQvlbfqXzaExLzw2LGZkXj97HH42jWZFSTlINpf/HlFr6NubPxLkVxeGsittJj5rm8yL+V21zPxp30Z7Q7R45qyCKFtevtVeqb+u1nZ/FsVfkwb/7wDW9scurgXw==--SB6C0aaNf8qPdteG--9hP+6tpsMnyiAVVvAIq+7w==
|
|
||||||
@@ -1 +1 @@
|
|||||||
xgPOFd8315z7lFtTR5/nD6WDBM2M6Grt/pmkCPdaqlw0WAmFKzbiRGFsXoUQ02JNzvT1/FVtBSsAcyK1Pdr1QQztlWC+/ywaflloMBS4//D8IEXvEgCK6uff5gcf1A==--WbFrw9advCJ4mqsK--HTVHZqO0ddG1toFpY0KKgQ==
|
IIjYiPSeZeMFhH8i8v8akXN4JrtGU+OsMQ8GAao/gVdesggriCBAQ8z+Vd0cmTf1SKYeT3OQDgygEekupr325P4eD9fZ+yi56EA/UMXQXMDVZAvZw7iwvKaOXpqisbWdJnomr1GXrHyR415Ce/Fxft3fgXDwMHJW2u+dDJgpE09uORnB9GXycFwHQmoIdXo=--iQ/Vcm0VcwHgUkwQ--tKHQW/45gM/s/NplqGPaxw==
|
||||||
@@ -63,4 +63,7 @@ Rails.application.configure do
|
|||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
# Base URL to be used by email template link helpers
|
# Base URL to be used by email template link helpers
|
||||||
config.action_mailer.default_url_options = { host: "localhost:3000", protocol: "http" }
|
config.action_mailer.default_url_options = { host: "localhost:3000", protocol: "http" }
|
||||||
|
|
||||||
|
# Allow requests from any IP
|
||||||
|
config.web_console.whiny_requests = false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ authorizations: &AUTHORIZATIONS
|
|||||||
## Environment
|
## Environment
|
||||||
|
|
||||||
development:
|
development:
|
||||||
host: 192.168.56.5
|
host: <%= ENV["LDAP_HOST"] || "localhost" %>
|
||||||
port: 389
|
port: <%= ENV["LDAP_PORT"] || "389" %>
|
||||||
attribute: cn
|
attribute: cn
|
||||||
base: ou=kosmos.org,cn=users,dc=kosmos,dc=org
|
base: ou=kosmos.org,cn=users,dc=kosmos,dc=org
|
||||||
admin_user: "cn=Directory Manager"
|
admin_user: "cn=Directory Manager"
|
||||||
admin_password: localpass
|
admin_password: <%= ENV["LDAP_ADMIN_PASSWORD"] %>
|
||||||
# ssl: false
|
ssl: <%= ENV["LDAP_USE_TLS"] || "false" %>
|
||||||
# <<: *AUTHORIZATIONS
|
# <<: *AUTHORIZATIONS
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@@ -46,11 +46,11 @@ test:
|
|||||||
# <<: *AUTHORIZATIONS
|
# <<: *AUTHORIZATIONS
|
||||||
|
|
||||||
production:
|
production:
|
||||||
host: ldap.kosmos.org
|
host: ldap.kosmos.local
|
||||||
port: 636
|
port: 389
|
||||||
attribute: cn
|
attribute: cn
|
||||||
base: ou=kosmos.org,cn=users,dc=kosmos,dc=org
|
base: ou=kosmos.org,cn=users,dc=kosmos,dc=org
|
||||||
admin_user: <%= Rails.application.credentials.ldap[:username] rescue nil %>
|
admin_user: <%= Rails.application.credentials.ldap[:username] rescue nil %>
|
||||||
admin_password: <%= Rails.application.credentials.ldap[:password] rescue nil %>
|
admin_password: <%= Rails.application.credentials.ldap[:password] rescue nil %>
|
||||||
ssl: simple_tls
|
# ssl: false
|
||||||
# <<: *AUTHORIZATIONS
|
# <<: *AUTHORIZATIONS
|
||||||
|
|||||||
@@ -20,10 +20,15 @@ Rails.application.routes.draw do
|
|||||||
resources :donations
|
resources :donations
|
||||||
|
|
||||||
get 'wallet', to: 'wallet#index'
|
get 'wallet', to: 'wallet#index'
|
||||||
|
get 'wallet/transactions', to: 'wallet#transactions'
|
||||||
|
|
||||||
get 'lnurlpay/:address', to: 'lnurlpay#index', constraints: { address: /[^\/]+/}
|
get 'lnurlpay/:address', to: 'lnurlpay#index', constraints: { address: /[^\/]+/}
|
||||||
get 'lnurlpay/:address/invoice', to: 'lnurlpay#invoice', constraints: { address: /[^\/]+/}
|
get 'lnurlpay/:address/invoice', to: 'lnurlpay#invoice', constraints: { address: /[^\/]+/}
|
||||||
|
|
||||||
|
namespace :api do
|
||||||
|
get 'kredits/onchain_btc_balance', to: 'kredits#onchain_btc_balance'
|
||||||
|
end
|
||||||
|
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
root to: 'dashboard#index'
|
root to: 'dashboard#index'
|
||||||
get 'invitations', to: 'invitations#index'
|
get 'invitations', to: 'invitations#index'
|
||||||
|
|||||||
24
docker-compose.yml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
services:
|
||||||
|
ldap:
|
||||||
|
image: 4teamwork/389ds:latest
|
||||||
|
volumes:
|
||||||
|
- ./tmp/389ds:/data
|
||||||
|
environment:
|
||||||
|
DS_DM_PASSWORD: passthebutter
|
||||||
|
SUFFIX_NAME: "dc=kosmos,dc=org"
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
tty: true
|
||||||
|
command: bash -c "rm -f tmp/pids/server.pid && bin/dev"
|
||||||
|
volumes:
|
||||||
|
- .:/akkounts
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
RAILS_ENV: development
|
||||||
|
LDAP_HOST: ldap
|
||||||
|
LDAP_PORT: 3389
|
||||||
|
LDAP_ADMIN_PASSWORD: passthebutter
|
||||||
|
LDAP_USE_TLS: "false"
|
||||||
|
depends_on:
|
||||||
|
- ldap
|
||||||
8
docker/entrypoint.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Remove a potentially pre-existing server.pid for Rails.
|
||||||
|
rm -f /myapp/tmp/pids/server.pid
|
||||||
|
|
||||||
|
# Then exec the container's main process (what's set as CMD in the Dockerfile).
|
||||||
|
exec "$@"
|
||||||
@@ -5,4 +5,20 @@ namespace :lndhub do
|
|||||||
CreateLndhubWalletJob.perform_later(user)
|
CreateLndhubWalletJob.perform_later(user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "List wallet balances"
|
||||||
|
task :balances => :environment do |t, args|
|
||||||
|
sum = 0
|
||||||
|
User.all.each do |user|
|
||||||
|
lndhub = Lndhub.new
|
||||||
|
auth_token = lndhub.authenticate(user)
|
||||||
|
data = lndhub.balance(auth_token)
|
||||||
|
balance = data["BTC"]["AvailableBalance"] rescue nil
|
||||||
|
if balance && balance > 0
|
||||||
|
sum += balance
|
||||||
|
puts "#{user.address}: #{balance} sats"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
puts "--\nSum of user balances: #{sum} sats"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
20
package.json
@@ -2,20 +2,18 @@
|
|||||||
"name": "akkounts",
|
"name": "akkounts",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tailwindcss/forms": "^0.4.0",
|
"@tailwindcss/forms": "^0.5.3",
|
||||||
"autoprefixer": "^10.4.2",
|
"autoprefixer": "^10.4.13",
|
||||||
"postcss": "^8.4.6",
|
"postcss": "^8.4.19",
|
||||||
"postcss-flexbugs-fixes": "^5.0.2",
|
"postcss-flexbugs-fixes": "^5.0.2",
|
||||||
"postcss-import": "^14.0.2",
|
"postcss-import": "^15.0.1",
|
||||||
"postcss-nested": "^5.0.6",
|
"postcss-nested": "^6.0.0",
|
||||||
"postcss-preset-env": "^7.3.1",
|
"postcss-preset-env": "^7.8.3",
|
||||||
"sass": "^1.49.7",
|
"tailwindcss": "^3.2.4"
|
||||||
"tailwindcss": "^3.0.22"
|
|
||||||
},
|
},
|
||||||
"version": "0.3.0",
|
"version": "0.4.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:css:sass": "sass ./app/assets/stylesheets/legacy.sass.scss ./app/assets/builds/legacy.css --no-source-map --load-path=node_modules",
|
|
||||||
"build:css:tailwind": "tailwindcss --postcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css",
|
"build:css:tailwind": "tailwindcss --postcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css",
|
||||||
"build:css": "yarn run build:css:sass && yarn run build:css:tailwind"
|
"build:css": "yarn run build:css:tailwind"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
spec/components/wallet_summary_component_spec.rb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
RSpec.describe WalletSummaryComponent, type: :component do
|
||||||
|
it "renders the balance as a human-readable number" do
|
||||||
|
expect(
|
||||||
|
render_inline(described_class.new(balance: 2301000)) {}.css("section").to_html
|
||||||
|
).to include(
|
||||||
|
"2,301,000 sats"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,6 +10,8 @@ require 'capybara'
|
|||||||
require 'devise'
|
require 'devise'
|
||||||
require 'support/controller_macros'
|
require 'support/controller_macros'
|
||||||
require 'support/database_cleaner'
|
require 'support/database_cleaner'
|
||||||
|
require "view_component/test_helpers"
|
||||||
|
require "capybara/rspec"
|
||||||
|
|
||||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||||
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
||||||
@@ -70,5 +72,8 @@ RSpec.configure do |config|
|
|||||||
config.include Warden::Test::Helpers
|
config.include Warden::Test::Helpers
|
||||||
config.include FactoryBot::Syntax::Methods
|
config.include FactoryBot::Syntax::Methods
|
||||||
config.include ActiveJob::TestHelper, type: :job
|
config.include ActiveJob::TestHelper, type: :job
|
||||||
|
config.include ViewComponent::TestHelpers, type: :component
|
||||||
|
config.include Capybara::RSpecMatchers, type: :component
|
||||||
|
|
||||||
config.extend ControllerMacros, :type => :controller
|
config.extend ControllerMacros, :type => :controller
|
||||||
end
|
end
|
||||||
|
|||||||
43
spec/requests/api/kredits_spec.rb
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
require 'webmock/rspec'
|
||||||
|
|
||||||
|
RSpec.describe "/api/kredits", type: :request do
|
||||||
|
|
||||||
|
describe "GET /onchain_btc_balance" do
|
||||||
|
before do
|
||||||
|
stub_request(:get, "http://btcpay.example.com/api/v1/stores/123456/payment-methods/onchain/BTC/wallet")
|
||||||
|
.to_return(status: 200, headers: {}, body: {
|
||||||
|
balance: 0.91108606,
|
||||||
|
unconfirmedBalance: 0,
|
||||||
|
confirmedBalance: 0.91108606
|
||||||
|
}.to_json)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns a formatted result for the onchain wallet balance" do
|
||||||
|
get api_kredits_onchain_btc_balance_path
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:ok)
|
||||||
|
|
||||||
|
res = JSON.parse(response.body)
|
||||||
|
expect(res["balance"]).to eq(0.91108606)
|
||||||
|
expect(res["unconfirmed_balance"]).to eq(0)
|
||||||
|
expect(res["confirmed_balance"]).to eq(0.91108606)
|
||||||
|
end
|
||||||
|
|
||||||
|
context "upstream request error" do
|
||||||
|
before do
|
||||||
|
stub_request(:get, "http://btcpay.example.com/api/v1/stores/123456/payment-methods/onchain/BTC/wallet")
|
||||||
|
.to_return(status: 500, headers: {}, body: "")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns a formatted error" do
|
||||||
|
get api_kredits_onchain_btc_balance_path
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:server_error)
|
||||||
|
|
||||||
|
res = JSON.parse(response.body)
|
||||||
|
expect(res["error"]).not_to be_nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||