diff --git a/rootfs/standard/usr/bin/mynode_startup.sh b/rootfs/standard/usr/bin/mynode_startup.sh index 832dfa9f..0f6209aa 100755 --- a/rootfs/standard/usr/bin/mynode_startup.sh +++ b/rootfs/standard/usr/bin/mynode_startup.sh @@ -408,6 +408,11 @@ fi if [ ! -f /mnt/hdd/mynode/thunderhub/thub_config.yaml ]; then cp -f /usr/share/mynode/thub_config.yaml /mnt/hdd/mynode/thunderhub/thub_config.yaml fi +THUNDERHUB_CONFIG_UPDATE_NUM=1 +if [ ! -f /mnt/hdd/mynode/thunderhub/update_settings_$THUNDERHUB_CONFIG_UPDATE_NUM ]; then + cp -f /usr/share/mynode/thunderhub.env /mnt/hdd/mynode/thunderhub/.env.local + cp -f /usr/share/mynode/thub_config.yaml /mnt/hdd/mynode/thunderhub/thub_config.yaml +fi if [ -f /mnt/hdd/mynode/thunderhub/thub_config.yaml ]; then if [ -f /home/bitcoin/.mynode/.hashedpw_bcrypt ]; then HASH_BCRYPT=$(cat /home/bitcoin/.mynode/.hashedpw_bcrypt) diff --git a/rootfs/standard/usr/share/mynode/thunderhub.env b/rootfs/standard/usr/share/mynode/thunderhub.env index ffac1b2a..5aee0fd0 100644 --- a/rootfs/standard/usr/share/mynode/thunderhub.env +++ b/rootfs/standard/usr/share/mynode/thunderhub.env @@ -21,4 +21,13 @@ NO_VERSION_CHECK=true # ----------- # Account Configs # ----------- -ACCOUNT_CONFIG_PATH='/mnt/hdd/mynode/thunderhub/thub_config.yaml' \ No newline at end of file +ACCOUNT_CONFIG_PATH='/mnt/hdd/mynode/thunderhub/thub_config.yaml' + +# ----------- +# SSO Account Configs +# ----------- +COOKIE_PATH = '/opt/mynode/thunderhub/.cookie' +SSO_SERVER_URL = '127.0.0.1:10009' +SSO_CERT_PATH = '/home/bitcoin/.lnd/tls.cert' +SSO_MACAROON_PATH = '/home/bitcoin/.lnd/data/chain/bitcoin/mainnet/' +#LOGOUT_URL = 'http://LogoutToThisUrl.com' # If not set it will logout to "/login" \ No newline at end of file diff --git a/rootfs/standard/var/www/mynode/api.py b/rootfs/standard/var/www/mynode/api.py index a4dd54c9..0b3ff2b9 100644 --- a/rootfs/standard/var/www/mynode/api.py +++ b/rootfs/standard/var/www/mynode/api.py @@ -96,6 +96,7 @@ def api_get_service_status(): data["status"], data["color"] = get_lnbits_status_and_color() elif service == "thunderhub": data["status"], data["color"] = get_thunderhub_status_and_color() + data["sso_token"] = get_thunderhub_sso_token() elif service == "ckbunker": data["status"], data["color"] = get_ckbunker_status_and_color() elif service == "sphinxrelay": diff --git a/rootfs/standard/var/www/mynode/device_info.py b/rootfs/standard/var/www/mynode/device_info.py index 467c8417..64c20d60 100644 --- a/rootfs/standard/var/www/mynode/device_info.py +++ b/rootfs/standard/var/www/mynode/device_info.py @@ -1166,6 +1166,13 @@ def get_btcrpcexplorer_sso_token(): return get_file_contents("/opt/mynode/btc-rpc-explorer/token") +#================================== +# Thunderhub Functions +#================================== +def get_thunderhub_sso_token(): + return get_file_contents("/opt/mynode/thunderhub/.cookie") + + #================================== # QR Code Functions #================================== diff --git a/rootfs/standard/var/www/mynode/mynode.py b/rootfs/standard/var/www/mynode/mynode.py index 40ce6925..c73aceae 100644 --- a/rootfs/standard/var/www/mynode/mynode.py +++ b/rootfs/standard/var/www/mynode/mynode.py @@ -576,6 +576,7 @@ def index(): "thunderhub_status_color": thunderhub_status_color, "thunderhub_status": thunderhub_status, "thunderhub_enabled": is_thunderhub_enabled(), + "thunderhub_sso_token": get_thunderhub_sso_token(), "ckbunker_status_color": ckbunker_status_color, "ckbunker_status": ckbunker_status, "ckbunker_enabled": is_ckbunker_enabled(), diff --git a/rootfs/standard/var/www/mynode/templates/main.html b/rootfs/standard/var/www/mynode/templates/main.html index eb723323..5ca2daec 100644 --- a/rootfs/standard/var/www/mynode/templates/main.html +++ b/rootfs/standard/var/www/mynode/templates/main.html @@ -73,6 +73,7 @@ var lnd_ready = {% if lnd_ready %}true{% else %}false{% endif %}; var btcrpcexplorer_ready = {% if btcrpcexplorer_ready %}true{% else %}false{% endif %}; var btcrpcexplorer_sso_token = "{{btcrpcexplorer_sso_token}}"; + var thunderhub_sso_token = "{{thunderhub_sso_token}}"; var is_installing_docker_images = {% if is_installing_docker_images %}true{% else %}false{% endif %}; function update_page() { // Update Bitcoin Info @@ -201,6 +202,9 @@ $.getJSON("/api/get_service_status?service=thunderhub", function( data ) { update_status("thunderhub_status", data); update_status_icon("thunderhub_status_icon", data); + if ("sso_token" in data && data["sso_token"] != null) { + thunderhub_sso_token = data["sso_token"] + } }); $.getJSON("/api/get_service_status?service=ckbunker", function( data ) { update_status("ckbunker_status", data); @@ -295,7 +299,9 @@ if (location.protocol == "https:") { port="3031" } + // Swap to use SSO (make optional? - needing password is safer) url = location.protocol+'//'+location.hostname+':'+port + //url = location.protocol+'//'+location.hostname+':'+port+'/sso?'+'token='+thunderhub_sso_token window.open(url,'_blank'); })