+ added tor data deletion command

* better support multiple tor versions in tor bootstrap (latest broke on manjaro before this)
* reduced interval for upload block timer to 5 seconds
* show message if inbox is empty in webui mail
master
Kevin Froman 2019-06-14 13:02:02 -05:00
parent faa79bb35c
commit f5b3406684
6 changed files with 43 additions and 8 deletions

View File

@ -118,7 +118,7 @@ class OnionrCommunicatorDaemon:
OnionrCommunicatorTimers(self, cooldownpeer.cooldown_peer, 30, myArgs=[self], requiresPeer=True) OnionrCommunicatorTimers(self, cooldownpeer.cooldown_peer, 30, myArgs=[self], requiresPeer=True)
# Timer to read the upload queue and upload the entries to peers # Timer to read the upload queue and upload the entries to peers
OnionrCommunicatorTimers(self, self.uploadBlock, 10, requiresPeer=True, maxThreads=1) OnionrCommunicatorTimers(self, self.uploadBlock, 5, requiresPeer=True, maxThreads=1)
# Timer to process the daemon command queue # Timer to process the daemon command queue
OnionrCommunicatorTimers(self, self.daemonCommands, 6, maxThreads=3) OnionrCommunicatorTimers(self, self.daemonCommands, 6, maxThreads=3)

View File

@ -144,15 +144,15 @@ HiddenServicePort 80 ''' + self.apiServerIP + ''':''' + str(self.hsPort)
# wait for tor to get to 100% bootstrap # wait for tor to get to 100% bootstrap
try: try:
for line in iter(tor.stdout.readline, b''): for line in iter(tor.stdout.readline, b''):
if 'Bootstrapped 100%: Done' in line.decode(): if 'bootstrapped 100' in line.decode().lower():
break break
elif 'Opening Socks listener' in line.decode(): elif 'opening socks listener' in line.decode().lower():
logger.debug(line.decode().replace('\n', '')) logger.debug(line.decode().replace('\n', ''))
else: else:
logger.fatal('Failed to start Tor. Maybe a stray instance of Tor used by Onionr is still running?') logger.fatal('Failed to start Tor. Maybe a stray instance of Tor used by Onionr is still running?')
return False return False
except KeyboardInterrupt: except KeyboardInterrupt:
logger.fatal('Got keyboard interrupt.', timestamp = False, level = logger.LEVEL_IMPORTANT) logger.fatal('Got keyboard interrupt. Onionr will exit soon.', timestamp = False, level = logger.LEVEL_IMPORTANT)
return False return False
logger.debug('Finished starting Tor.', timestamp=True) logger.debug('Finished starting Tor.', timestamp=True)

View File

@ -23,3 +23,5 @@ openwebinterface.py: command to open the web interface (useful because it requir
plugincommands.py: commands to enable/disable/reload plugins plugincommands.py: commands to enable/disable/reload plugins
pubkeymanager.py: commands to generate a new onionr user id, change the active id, or add/remove/list friends pubkeymanager.py: commands to generate a new onionr user id, change the active id, or add/remove/list friends
resettor.py: command to delete the Tor data directory

View File

@ -21,7 +21,7 @@
import webbrowser, sys import webbrowser, sys
import logger import logger
from . import pubkeymanager, onionrstatistics, daemonlaunch, filecommands, plugincommands, keyadders from . import pubkeymanager, onionrstatistics, daemonlaunch, filecommands, plugincommands, keyadders
from . import banblocks, exportblocks, openwebinterface from . import banblocks, exportblocks, openwebinterface, resettor
def show_help(o_inst, command): def show_help(o_inst, command):
@ -128,7 +128,9 @@ def get_commands(onionr_inst):
'friend': onionr_inst.friendCmd, 'friend': onionr_inst.friendCmd,
'addid': onionr_inst.addID, 'addid': onionr_inst.addID,
'add-id': onionr_inst.addID, 'add-id': onionr_inst.addID,
'change-id': onionr_inst.changeID 'change-id': onionr_inst.changeID,
'reset-tor': resettor.reset_tor
} }
cmd_help = { cmd_help = {
@ -159,5 +161,6 @@ cmd_help = {
'friend': '[add|remove] [public key/id]', 'friend': '[add|remove] [public key/id]',
'add-id': 'Generate a new ID (key pair)', 'add-id': 'Generate a new ID (key pair)',
'change-id': 'Change active ID', 'change-id': 'Change active ID',
'open-home': 'Open your node\'s home/info screen' 'open-home': 'Open your node\'s home/info screen',
'reset-tor': 'Delete the Tor data directory. Only do this if Tor never starts.'
} }

View File

@ -0,0 +1,29 @@
'''
Onionr - Private P2P Communication
Command to delete the Tor data directory if its safe to do so
'''
'''
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/>.
'''
import os, shutil
import logger, core
def reset_tor():
c = core.Core()
tor_dir = c.dataDir + 'tordata'
if os.path.exists(tor_dir):
if c._utils.localCommand('/ping') == 'pong!':
logger.warn('Cannot delete Tor data while Onionr is running')
else:
shutil.rmtree(tor_dir)

View File

@ -201,6 +201,7 @@ function getInbox(){
var requested = '' var requested = ''
for(var i = 0; i < pms.length; i++) { for(var i = 0; i < pms.length; i++) {
if (pms[i].trim().length == 0){ if (pms[i].trim().length == 0){
threadPart.innerText = 'No messages to show ¯\\_(ツ)_/¯'
continue continue
} }
else{ else{