diff --git a/Gemfile b/Gemfile index 1c6b262..a0f169c 100644 --- a/Gemfile +++ b/Gemfile @@ -33,6 +33,9 @@ gem 'devise' gem 'devise_ldap_authenticatable' gem 'net-ldap' +# Utilities +gem "rqrcode", "~> 2.0" + # HTTP requests gem 'faraday' diff --git a/Gemfile.lock b/Gemfile.lock index 3fdce23..7608227 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,6 +73,7 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) + chunky_png (1.4.0) concurrent-ruby (1.1.9) connection_pool (2.2.5) crack (0.4.5) @@ -213,6 +214,10 @@ GEM actionpack (>= 5.0) railties (>= 5.0) rexml (3.2.5) + rqrcode (2.1.0) + chunky_png (~> 1.0) + rqrcode_core (~> 1.0) + rqrcode_core (1.2.0) rspec-core (3.10.1) rspec-support (~> 3.10.0) rspec-expectations (3.10.1) @@ -321,6 +326,7 @@ DEPENDENCIES pg (~> 1.2.3) puma (~> 4.1) rails (~> 6.0.3, >= 6.0.3.4) + rqrcode (~> 2.0) rspec-rails sass-rails (>= 6) sidekiq diff --git a/app/controllers/wallet_controller.rb b/app/controllers/wallet_controller.rb new file mode 100644 index 0000000..231ecae --- /dev/null +++ b/app/controllers/wallet_controller.rb @@ -0,0 +1,21 @@ +require "rqrcode" + +class WalletController < ApplicationController + before_action :require_user_signed_in + + def index + @current_section = :wallet + + @wallet_url = "lndhub://#{current_user.ln_login}:#{current_user.ln_password}@https://lndhub.kosmos.org" + + qrcode = RQRCode::QRCode.new(@wallet_url) + @svg = qrcode.as_svg( + color: "000", + shape_rendering: "crispEdges", + module_size: 6, + standalone: true, + use_path: true + ) + end + +end diff --git a/app/helpers/wallet_helper.rb b/app/helpers/wallet_helper.rb new file mode 100644 index 0000000..9bd2230 --- /dev/null +++ b/app/helpers/wallet_helper.rb @@ -0,0 +1,2 @@ +module WalletHelper +end diff --git a/app/views/shared/_main_nav.html.erb b/app/views/shared/_main_nav.html.erb index bd2a872..0da9406 100644 --- a/app/views/shared/_main_nav.html.erb +++ b/app/views/shared/_main_nav.html.erb @@ -13,6 +13,10 @@ <%= link_to "Donations", donations_path, class: @current_section == :contributions ? "active" : nil %> +
+ Send and receive BTC via the Lightning Network. +
++ You can connect Blue Wallet (Android or iOS) to your Kosmos bitcoin wallet. +
++ Show setup code + +
+ +