22 lines
613 B
Ruby
22 lines
613 B
Ruby
class Admin::LightningController < Admin::BaseController
|
|
before_action :check_feature_enabled
|
|
|
|
def index
|
|
@current_section = :lightning
|
|
|
|
@users = User.pluck(:cn, :ou, :lndhub_username)
|
|
@accounts = LndhubAccount.with_balances.order(balance: :desc).to_a
|
|
|
|
@ln = {}
|
|
@ln[:current_balance] = LndhubAccount.current.joins(:ledgers).sum("account_ledgers.amount")
|
|
@ln[:users_with_sats] = @accounts.length
|
|
end
|
|
|
|
def check_feature_enabled
|
|
if !Setting.lndhub_admin_enabled?
|
|
flash[:alert] = "Lightning Admin UI not enabled"
|
|
redirect_to admin_root_path and return
|
|
end
|
|
end
|
|
end
|