add LNbits as IP2TOR option

This commit is contained in:
rootzoll
2020-07-14 22:56:20 +02:00
parent ec36d3da92
commit 7fd8361983
2 changed files with 13 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ from blitzpy import RaspiBlitzConfig
# constants for standard services # constants for standard services
LND_REST_API = "LND-REST-API" LND_REST_API = "LND-REST-API"
LND_GRPC_API = "LND-GRPC-API" LND_GRPC_API = "LND-GRPC-API"
LNBITS = "LNBITS"
# load config # load config
cfg = RaspiBlitzConfig() cfg = RaspiBlitzConfig()
@@ -241,6 +242,7 @@ your RaspiBlitz behind TOR.
# check for which standard services already a active bridge exists # check for which standard services already a active bridge exists
lnd_rest_api=False lnd_rest_api=False
lnd_grpc_api=False lnd_grpc_api=False
lnbits=False
try: try:
if os.path.isfile(SUBSCRIPTIONS_FILE): if os.path.isfile(SUBSCRIPTIONS_FILE):
os.system("sudo chown admin:admin {0}".format(SUBSCRIPTIONS_FILE)) os.system("sudo chown admin:admin {0}".format(SUBSCRIPTIONS_FILE))
@@ -249,6 +251,7 @@ your RaspiBlitz behind TOR.
if not sub['active']: next if not sub['active']: next
if sub['active'] and sub['name'] == LND_REST_API: lnd_rest_api=True if sub['active'] and sub['name'] == LND_REST_API: lnd_rest_api=True
if sub['active'] and sub['name'] == LND_GRPC_API: lnd_grpc_api=True if sub['active'] and sub['name'] == LND_GRPC_API: lnd_grpc_api=True
if sub['active'] and sub['name'] == LNBITS: lnbits=True
except Exception as e: except Exception as e:
print(e) print(e)
@@ -256,6 +259,8 @@ your RaspiBlitz behind TOR.
choices = [] choices = []
choices.append( ("REST","LND REST API {0}".format("--> ALREADY BRIDGED" if lnd_rest_api else "")) ) choices.append( ("REST","LND REST API {0}".format("--> ALREADY BRIDGED" if lnd_rest_api else "")) )
choices.append( ("GRPC","LND gRPC API {0}".format("--> ALREADY BRIDGED" if lnd_grpc_api else "")) ) choices.append( ("GRPC","LND gRPC API {0}".format("--> ALREADY BRIDGED" if lnd_grpc_api else "")) )
if cfg.lnbits:
choices.append( ("LNBITS","LNbits {0}".format("--> ALREADY BRIDGED" if lnd_grpc_api else "")) )
choices.append( ("SELF","Create a custom IP2TOR Bridge") ) choices.append( ("SELF","Create a custom IP2TOR Bridge") )
d = Dialog(dialog="dialog",autowidgetsize=True) d = Dialog(dialog="dialog",autowidgetsize=True)
@@ -281,6 +286,11 @@ your RaspiBlitz behind TOR.
servicename=LND_GRPC_API servicename=LND_GRPC_API
torAddress = subprocess.run(['sudo', 'cat', '/mnt/hdd/tor/lndrpc10009/hostname'], stdout=subprocess.PIPE).stdout.decode('utf-8').strip() torAddress = subprocess.run(['sudo', 'cat', '/mnt/hdd/tor/lndrpc10009/hostname'], stdout=subprocess.PIPE).stdout.decode('utf-8').strip()
torPort=10009 torPort=10009
if tag == "LNBITS":
# get TOR address for LNBits
servicename=LNBITS
torAddress = subprocess.run(['sudo', 'cat', '/mnt/hdd/tor/lnbits/hostname'], stdout=subprocess.PIPE).stdout.decode('utf-8').strip()
torPort=443
if tag == "SELF": if tag == "SELF":
servicename="CUSTOM" servicename="CUSTOM"
try: try:

View File

@@ -41,7 +41,7 @@ ${toraddress}"
IP2TOR+LetsEncrypt: https://${ip2torDomain}:${ip2torPort} IP2TOR+LetsEncrypt: https://${ip2torDomain}:${ip2torPort}
SHA1 Fingerprint: ${sslFingerprintTOR}" SHA1 Fingerprint: ${sslFingerprintTOR}"
elif [ ${#ip2torIP} -gt 0 ]; then elif [ ${#ip2torIP} -gt 0 ]; then
text="${text} text="${text}\n
IP2TOR: https://${ip2torIP}:${ip2torPort} IP2TOR: https://${ip2torIP}:${ip2torPort}
SHA1 ${sslFingerprintTOR} SHA1 ${sslFingerprintTOR}
go MAINMENU > SUBSCRIBE and add LetsEncrypt HTTPS Domain" go MAINMENU > SUBSCRIBE and add LetsEncrypt HTTPS Domain"
@@ -51,7 +51,7 @@ To enable easy reachablity with normal brower from the outside
consider adding a IP2TOR Bridge (MAINMENU > SUBSCRIBE)." consider adding a IP2TOR Bridge (MAINMENU > SUBSCRIBE)."
fi fi
whiptail --title " LNbits " --msgbox "${text}" 14 69 whiptail --title " LNbits " --msgbox "${text}" 15 69
/home/admin/config.scripts/blitz.lcd.sh hide /home/admin/config.scripts/blitz.lcd.sh hide
echo "please wait ..." echo "please wait ..."
@@ -182,7 +182,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# get the github code" echo "# get the github code"
sudo rm -r /home/lnbits/lnbits 2>/dev/null sudo rm -r /home/lnbits/lnbits 2>/dev/null
cd /home/lnbits cd /home/lnbits
sudo -u lnbits git clone https://github.com/arcbtc/lnbits.git sudo -u lnbits git clone https://github.com/lnbits/lnbits.git
cd /home/lnbits/lnbits cd /home/lnbits/lnbits
sudo -u lnbits git checkout tags/raspiblitz sudo -u lnbits git checkout tags/raspiblitz