menu-credentials.sh
1 #!/bin/bash 2 3 # shellcheck source=./Scripts/defaults.sh 4 . "$HOME"/RoninDojo/Scripts/defaults.sh 5 6 # shellcheck source=./Scripts/dojo-defaults.sh 7 . "$HOME"/RoninDojo/Scripts/dojo-defaults.sh 8 9 # shellcheck source=./Scripts/functions.sh 10 . "$HOME"/RoninDojo/Scripts/functions.sh 11 12 _load_user_conf 13 14 _ronin_ui_credentials() { 15 cd "${ronin_ui_path}" || exit 16 17 JWT_SECRET=$(grep JWT_SECRET .env|cut -d'=' -f2) 18 BACKEND_TOR=$(sudo cat "${install_dir_tor}"/hidden_service_ronin_backend/hostname) 19 20 export JWT_SECRET BACKEND_TOR 21 } 22 23 display_creds_dojo() { 24 _print_message "Samourai Dojo Credentials" 25 _print_message "WARNING: Do not share these onion addresses with anyone!" \ 26 "Maintenance Tool:" \ 27 "Tor Address = http://${tor_addr_dojo_api}/admin" \ 28 "Admin Key = $NODE_ADMIN_KEY" \ 29 "API Key = $NODE_API_KEY" 30 } 31 32 display_creds_fulcrum() { 33 if _is_fulcrum; then 34 _print_message "Fulcrum Credentials" 35 _print_message "Connect to Fulcrum over the Tor network:" \ 36 "Tor Address = http://${tor_addr_fulcrum}" \ 37 "Tor Port = ${tor_port_fulcrum}" \ 38 "" 39 _print_message "Connect to Fulcrum over your local network:" \ 40 "Local Access Domain = ronindojo.local" \ 41 "IP Address = ${ip_current} # fallback for when ronindojo.local doesn't work for you." \ 42 "Local Port = 50002" \ 43 "SSL = ENABLED" 44 _print_message "Check the RoninDojo Wiki for pairing information at https://wiki.ronindojo.io" 45 fi 46 } 47 48 display_creds_electrs() { 49 if _is_electrs; then 50 _print_message "Electrs Credentials" "Tor Address = ${tor_addr_electrs}" 51 _print_message "Electrs Credentials" "Tor Port = ${tor_port_electrs}" 52 _print_message "Check the RoninDojo Wiki for pairing information at https://wiki.ronindojo.io" 53 fi 54 } 55 56 display_creds_mempool() { 57 if _is_mempool ; then 58 _print_message "Mempool Space Visualizer Credentials" "Tor Address = http://${tor_addr_mempool}" 59 fi 60 } 61 62 display_creds_roninui() { 63 _ronin_ui_credentials && cd "$HOME" || exit 64 _print_message "Ronin UI Credentials" \ 65 "Local Access Domain = http://ronindojo.local" \ 66 "Local Access IP = http://${ip_current} # fallback for when ronindojo.local doesn't work for you." \ 67 "Tor Address = http://${BACKEND_TOR}" 68 } 69 70 display_creds_bitcoin() { 71 # shellcheck disable=SC2154 72 _print_message "Bitcoin Credentials" \ 73 "Bitcoin Daemon:" \ 74 "" \ 75 "Tor Address = http://${tor_addr_bitcoind}" \ 76 "RPC User = $BITCOIND_RPC_USER" \ 77 "RPC Password = $BITCOIND_RPC_PASSWORD" \ 78 "RPC IP = $BITCOIND_IP" \ 79 "RPC Port = $BITCOIND_RPC_PORT" \ 80 "" \ 81 "Bitcoin RPC Explorer (No username required):" \ 82 "Tor Address = http://${tor_addr_explorer}" 83 } 84 85 OPTIONS=(1 "Dojo" 86 2 "Indexer" 87 3 "Mempool" 88 4 "Ronin UI" 89 5 "Bitcoind" 90 6 "All Credentials" 91 7 "Go Back") 92 93 CHOICE=$(dialog --clear \ 94 --title "$TITLE" \ 95 --menu "$MENU" \ 96 "$HEIGHT" "$WIDTH" "$CHOICE_HEIGHT" \ 97 "${OPTIONS[@]}" \ 98 2>&1 >/dev/tty) 99 100 clear 101 case $CHOICE in 102 1) 103 display_creds_dojo 104 ;; 105 2) 106 if _is_fulcrum; then 107 display_creds_fulcrum 108 elif _is_electrs; then 109 display_creds_electrs 110 fi 111 ;; 112 3) 113 if _is_mempool ; then 114 display_creds_mempool 115 else 116 _print_message "Mempool Space Visualizer is not installed..." 117 _print_message "Install using the manage applications menu..." 118 fi 119 ;; 120 4) 121 display_creds_roninui 122 ;; 123 5) 124 display_creds_bitcoin 125 ;; 126 6) 127 _print_message "Displaying list of all available credentials in your RoninDojo..." 128 _sleep 5 --msg "Displaying in " 129 130 display_creds_dojo 131 display_creds_roninui 132 display_creds_bitcoin 133 display_creds_mempool 134 if _is_fulcrum; then 135 display_creds_fulcrum 136 elif _is_electrs; then 137 display_creds_electrs 138 fi 139 ;; 140 7) 141 ronin 142 exit 143 ;; 144 esac 145 146 _pause return 147 bash -c "${ronin_credentials_menu}" 148 exit