Add ability to enable Thunderhub SSO
This commit is contained in:
parent
aef0e015d1
commit
fcaf1c5ee8
|
@ -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)
|
||||
|
|
|
@ -22,3 +22,12 @@ NO_VERSION_CHECK=true
|
|||
# Account Configs
|
||||
# -----------
|
||||
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"
|
|
@ -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":
|
||||
|
|
|
@ -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
|
||||
#==================================
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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');
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user