improved block list syncing, added forgotten stats.js file
This commit is contained in:
parent
0e6ab04996
commit
1ebed8d606
12 changed files with 100 additions and 94 deletions
|
@ -2,8 +2,8 @@
|
|||
"general" : {
|
||||
"dev_mode" : true,
|
||||
"display_header" : false,
|
||||
"minimum_block_pow": 3,
|
||||
"minimum_send_pow": 3,
|
||||
"minimum_block_pow": 1,
|
||||
"minimum_send_pow": 1,
|
||||
"socket_servers": false,
|
||||
"security_level": 0,
|
||||
"max_block_age": 2678400,
|
||||
|
|
|
@ -5,20 +5,27 @@
|
|||
<title>
|
||||
Onionr
|
||||
</title>
|
||||
<link rel='stylesheet' href='/shared/style/modal.css'>
|
||||
<link rel='stylesheet' href='/shared/main/style.css'>
|
||||
</head>
|
||||
<body>
|
||||
<div id="shutdownNotice" class='overlay'>
|
||||
<div>
|
||||
<p>Your node will shutdown. Thank you for using Onionr.</p>
|
||||
</div>
|
||||
</div>
|
||||
<img class='logo' src='/shared/onionr-icon.png' alt='onionr logo'>
|
||||
<span class='logoText'>Onionr Web Control Panel</span>
|
||||
<div class='content'>
|
||||
<a href='shutdown'>Shutdown node</a>
|
||||
<button id='shutdownNode'>Shutdown Node</button>
|
||||
<h2>Stats</h2>
|
||||
<p>Uptime: <span id='uptime'></span></p>
|
||||
<p>Stored Blocks: <span id='storedBlocks'></span></p>
|
||||
<p>Connected nodes:</p>
|
||||
<pre id='connectedNodes'></pre>
|
||||
</div>
|
||||
<script src='/shared/misc.js'></script>
|
||||
<script src='/shared/main/stats.js'></script>
|
||||
<script src='/shared/panel.js'></script>
|
||||
</body>
|
||||
<script src='/shared/misc.js'></script>
|
||||
<script src='/shared/main/stats.js'></script>
|
||||
</html>
|
|
@ -17,14 +17,11 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
uptimeDisplay = document.getElementById('uptime')
|
||||
connectedDisplay = document.getElementById('connectedNodes')
|
||||
storedBlockDisplay = document.getElementById('storedBlocks')
|
||||
|
||||
pass = window.location.hash.replace('#', '')
|
||||
|
||||
stats = JSON.parse(httpGet('getstats', pass))
|
||||
stats = JSON.parse(httpGet('getstats', webpass))
|
||||
uptimeDisplay.innerText = stats['uptime'] + ' seconds'
|
||||
connectedDisplay.innerText = stats['connectedNodes']
|
||||
storedBlockDisplay.innerText = stats['blockCount']
|
|
@ -124,3 +124,17 @@ body{
|
|||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
/*https://stackoverflow.com/a/16778646*/
|
||||
.overlay {
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
width:100%;
|
||||
opacity: 0.9;
|
||||
height:100%;
|
||||
text-align:center;
|
||||
z-index: 1000;
|
||||
background-color: black;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,16 @@
|
|||
function httpGet(theUrl, webpass) {
|
||||
webpass = document.location.hash.replace('#', '')
|
||||
if (typeof webpass == "undefined"){
|
||||
webpass = localStorage['webpass']
|
||||
}
|
||||
else{
|
||||
localStorage['webpass'] = webpass
|
||||
document.location.hash = ''
|
||||
}
|
||||
if (typeof webpass == "undefined" || webpass == ""){
|
||||
alert('Web password was not found in memory or URL')
|
||||
}
|
||||
|
||||
function httpGet(theUrl) {
|
||||
var xmlHttp = new XMLHttpRequest()
|
||||
xmlHttp.open( "GET", theUrl, false ) // false for synchronous request
|
||||
xmlHttp.setRequestHeader('token', webpass)
|
||||
|
@ -7,6 +19,10 @@ function httpGet(theUrl, webpass) {
|
|||
return xmlHttp.responseText
|
||||
}
|
||||
else{
|
||||
return "";
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
function overlay(overlayID) {
|
||||
el = document.getElementById(overlayID)
|
||||
el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible"
|
||||
}
|
||||
|
|
6
onionr/static-data/www/shared/panel.js
Normal file
6
onionr/static-data/www/shared/panel.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
shutdownBtn = document.getElementById('shutdownNode')
|
||||
|
||||
shutdownBtn.onclick = function(){
|
||||
httpGet('shutdownclean')
|
||||
overlay('shutdownNotice')
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue