add ui to upload to IPFS node on box

This commit is contained in:
John Hess 2023-05-24 17:30:54 -05:00
parent 99089126c0
commit 54b3da996c
27 changed files with 78892 additions and 4 deletions

View file

@ -0,0 +1,43 @@
//set default remote Node
document.getElementById("remote_address").value = node.remote.address;
document.getElementById("remote_apiPort").value = node.remote.port;
document.getElementById("remote_gatewayPort").value = node.remote.gateway;
document.querySelector("#remote").querySelector("#labelAddress").className = "active"
document.querySelector("#remote").querySelector("#labelPort").className = "active"
document.querySelector("#remote").querySelector("#labelGateway").className = "active"
if (node.remote.protocol.toLowerCase() == "https" || node.remote.protocol.toLowerCase() == "http") {
changeProtocol("remote", node.remote.protocol.toLowerCase())
} else {
alert ("Configurations Invalid: Protocols accepted are HTTP or HTTPS only! Edit your config.js")
throw new Error();
}
//set default local node
document.querySelector("#local_address").value = node.local.address;
document.querySelector("#local_apiPort").value = node.local.port;
document.getElementById("local_gatewayPort").value = node.local.gateway;
document.querySelector("#local").querySelector("#labelAddress").className = "active"
document.querySelector("#local").querySelector("#labelPort").className = "active"
document.querySelector("#local").querySelector("#labelGateway").className = "active"
if (node.local.protocol.toLowerCase() == "https" || node.local.protocol.toLowerCase() == "http") {
changeProtocol("local", node.local.protocol.toLowerCase())
} else {
alert ("Configurations Invalid: Protocols accept are HTTP or HTTPS only! Edit your config.js")
throw new Error();
}
function changeProtocol (selectedNode, protocol) {
if (protocol == "https") {
node[selectedNode].protocol = "https"
document.querySelector("#"+selectedNode).querySelector("#http").className = "tab"
document.querySelector("#"+selectedNode).querySelector("#https").className += " active"
document.querySelector("input#remote_apiPort").value = 443;
document.querySelector("input#remote_apiPort").disabled = true;
}
if (protocol == "http") {
node[selectedNode].protocol = "http"
document.querySelector("#"+selectedNode).querySelector("#https").className = "tab"
document.querySelector("#"+selectedNode).querySelector("#http").className += " active"
}
}