added restart button to ui
parent
a7a5f88142
commit
4187aba570
|
@ -27,6 +27,7 @@ from serializeddata import SerializedData
|
|||
from onionrutils import mnemonickeys
|
||||
from onionrutils import bytesconverter
|
||||
from utils import reconstructhash
|
||||
from onionrcommands import restartonionr
|
||||
|
||||
pub_key = onionrcrypto.pub_key.replace('=', '')
|
||||
|
||||
|
@ -91,6 +92,11 @@ class PrivateEndpoints:
|
|||
def shutdown():
|
||||
return apiutils.shutdown.shutdown(client_api)
|
||||
|
||||
@private_endpoints_bp.route('/restartclean')
|
||||
def restart_clean():
|
||||
restartonionr.restart()
|
||||
return Response("bye")
|
||||
|
||||
@private_endpoints_bp.route('/getstats')
|
||||
def getStats():
|
||||
# returns node stats
|
||||
|
|
|
@ -35,6 +35,7 @@ def restart():
|
|||
daemonlaunch.kill_daemon()
|
||||
while localcommand.local_command('ping', maxWait=8) == 'pong!':
|
||||
time.sleep(0.3)
|
||||
time.sleep(4)
|
||||
subprocess.Popen([SCRIPT_NAME, 'start'])
|
||||
|
||||
restart.onionr_help = 'Gracefully restart Onionr'
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
Onionr
|
||||
</title>
|
||||
<link rel='shortcut icon' type='image/ico' href='/shared/images/favicon.ico'>
|
||||
<link rel="stylesheet" href="/private/main.css">
|
||||
<link rel="stylesheet" href="/shared/fontawesome-free-5.10.2/css/all.min.css">
|
||||
<link rel='stylesheet' href='/shared/main/PNotifyBrightTheme.css'>
|
||||
<link rel="stylesheet" href="/shared/main/bulma.min.css">
|
||||
|
@ -100,7 +101,9 @@
|
|||
</a>
|
||||
</p>
|
||||
<p class="control">
|
||||
<a class="button is-link" id='refreshStats'>Refresh Stats</a>
|
||||
<a class="button is-warning is-outlined" id='restartNode'>
|
||||
Restart
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -120,7 +123,7 @@
|
|||
<div class="card">
|
||||
<header class="card-header">
|
||||
<p class="card-header-title">
|
||||
Onionr
|
||||
Onionr Sites
|
||||
</p>
|
||||
</header>
|
||||
<div class="card-content">
|
||||
|
@ -147,6 +150,13 @@
|
|||
<p class="card-header-title">
|
||||
Statistics
|
||||
</p>
|
||||
<div class="field">
|
||||
<div class="is-pulled-right">
|
||||
<a class="button is-link" id='refreshStats'>
|
||||
Refresh Stats
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
|
|
|
@ -1,13 +1,3 @@
|
|||
.configEditor{
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.saveConfig{
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
|
||||
.idLink{
|
||||
-webkit-touch-callout: none; /* iOS Safari */
|
||||
-webkit-user-select: none; /* Safari */
|
||||
|
@ -16,3 +6,6 @@
|
|||
user-select: none; /* Non-prefixed version, currently
|
||||
supported by Chrome and Opera */
|
||||
}
|
||||
#refreshStats{
|
||||
margin: 5px;
|
||||
}
|
|
@ -1,5 +1,26 @@
|
|||
/*
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
This file handles the mail interface
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
shutdownBtn = document.getElementById('shutdownNode')
|
||||
refreshStatsBtn = document.getElementById('refreshStats')
|
||||
restartBtn = document.getElementById('restartNode')
|
||||
|
||||
shutdownBtn.onclick = function(){
|
||||
if (! nowebpass){
|
||||
httpGet('shutdownclean')
|
||||
|
@ -7,6 +28,17 @@ shutdownBtn.onclick = function(){
|
|||
}
|
||||
}
|
||||
|
||||
restartBtn.onclick = function(){
|
||||
if (! nowebpass){
|
||||
fetch('/restartclean', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
}})
|
||||
PNotify.notice('Node is restarting')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
refreshStatsBtn.onclick = function(){
|
||||
getStats()
|
||||
}
|
Loading…
Reference in New Issue