- removed simplecache for now
* fixed existingRand bytes check in announce in onionrdaemontools * moved openhome to its own file * slight comment and boilerplate changes + added more readme files for subdirectories
This commit is contained in:
parent
737719cb54
commit
268325c07d
28 changed files with 126 additions and 129 deletions
25
onionr/onionrcommands/README.md
Normal file
25
onionr/onionrcommands/README.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
# onionrcommands
|
||||
|
||||
This module contains handlers/functions for Onionr cli interface commands.
|
||||
|
||||
## Files
|
||||
|
||||
__init__.py: stores the command references (aside from plugins) and help info.
|
||||
|
||||
banblocks.py: command handler for manually removing blocks from one's node
|
||||
|
||||
daemonlaunch.py: command to run Onionr (start the api servers, tor and communicator)
|
||||
|
||||
exportblocks.py: command to export an onionr block to the export folder. Exported blocks can be manually shared outside of the Onionr network
|
||||
|
||||
filecommands.py commands to insert and fetch files from the Onionr network
|
||||
|
||||
keyadders.py: commands to add an onionr user key or transport address
|
||||
|
||||
onionrstatistics.py: commands to print out various information about one's Onionr node
|
||||
|
||||
openwebinterface.py: command to open the web interface (useful because it requires a randomly generated token)
|
||||
|
||||
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
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
import webbrowser, sys
|
||||
import logger
|
||||
from . import pubkeymanager, onionrstatistics, daemonlaunch, filecommands, plugincommands, keyadders, banblocks, exportblocks
|
||||
from . import pubkeymanager, onionrstatistics, daemonlaunch, filecommands, plugincommands, keyadders
|
||||
from . import banblocks, exportblocks, openwebinterface
|
||||
|
||||
def show_help(o_inst, command):
|
||||
|
||||
|
@ -39,16 +40,6 @@ def show_help(o_inst, command):
|
|||
for command, helpmessage in helpmenu.items():
|
||||
o_inst.showHelp(command)
|
||||
|
||||
def open_home(o_inst):
|
||||
try:
|
||||
url = o_inst.onionrUtils.getClientAPIServer()
|
||||
except FileNotFoundError:
|
||||
logger.error('Onionr seems to not be running (could not get api host)')
|
||||
else:
|
||||
url = 'http://%s/#%s' % (url, o_inst.onionrCore.config.get('client.webpassword'))
|
||||
print('If Onionr does not open automatically, use this URL:', url)
|
||||
webbrowser.open_new_tab(url)
|
||||
|
||||
def get_commands(onionr_inst):
|
||||
return {'': onionr_inst.showHelpSuggestion,
|
||||
'help': onionr_inst.showHelp,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
'''
|
||||
Onionr - P2P Anonymous Storage Network
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
This file contains the command for banning blocks from the node
|
||||
'''
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
'''
|
||||
Onionr - P2P Anonymous Storage Network
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
launch the api server and communicator
|
||||
'''
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
'''
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
This file handles the commands for adding and getting files from the Onionr network
|
||||
'''
|
||||
'''
|
||||
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 base64, sys, os
|
||||
import logger
|
||||
from onionrblockapi import Block
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
'''
|
||||
Onionr - P2P Anonymous Storage Network
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
add keys (transport and pubkey)
|
||||
'''
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
'''
|
||||
Onionr - P2P Anonymous Storage Network
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
This module defines commands to show stats/details about the local node
|
||||
'''
|
||||
|
|
30
onionr/onionrcommands/openwebinterface.py
Normal file
30
onionr/onionrcommands/openwebinterface.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
'''
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
Open the web interface properly into a web browser
|
||||
'''
|
||||
'''
|
||||
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 webbrowser
|
||||
import logger
|
||||
def open_home(o_inst):
|
||||
try:
|
||||
url = o_inst.onionrUtils.getClientAPIServer()
|
||||
except FileNotFoundError:
|
||||
logger.error('Onionr seems to not be running (could not get api host)')
|
||||
else:
|
||||
url = 'http://%s/#%s' % (url, o_inst.onionrCore.config.get('client.webpassword'))
|
||||
print('If Onionr does not open automatically, use this URL:', url)
|
||||
webbrowser.open_new_tab(url)
|
|
@ -1,5 +1,5 @@
|
|||
'''
|
||||
Onionr - P2P Anonymous Storage Network
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
plugin CLI commands
|
||||
'''
|
||||
|
@ -30,7 +30,6 @@ def enable_plugin(o_inst):
|
|||
logger.info('%s %s <plugin>' % (sys.argv[0], sys.argv[1]))
|
||||
|
||||
def disable_plugin(o_inst):
|
||||
|
||||
if len(sys.argv) >= 3:
|
||||
plugin_name = sys.argv[2]
|
||||
logger.info('Disabling plugin "%s"...' % plugin_name)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'''
|
||||
Onionr - P2P Anonymous Storage Network
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
This module defines ID-related CLI commands
|
||||
This module defines user ID-related CLI commands
|
||||
'''
|
||||
'''
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
@ -51,7 +51,7 @@ def change_ID(o_inst):
|
|||
try:
|
||||
key = sys.argv[2]
|
||||
except IndexError:
|
||||
logger.error('Specify pubkey to use')
|
||||
logger.warn('Specify pubkey to use')
|
||||
else:
|
||||
if o_inst.onionrUtils.validatePubKey(key):
|
||||
if key in o_inst.onionrCore._crypto.keyManager.getPubkeyList():
|
||||
|
@ -60,9 +60,9 @@ def change_ID(o_inst):
|
|||
logger.info('Set active key to: %s' % (key,))
|
||||
logger.info('Restart Onionr if it is running.')
|
||||
else:
|
||||
logger.error('That key does not exist')
|
||||
logger.warn('That key does not exist')
|
||||
else:
|
||||
logger.error('Invalid key %s' % (key,))
|
||||
logger.warn('Invalid key %s' % (key,))
|
||||
|
||||
def friend_command(o_inst):
|
||||
friend = ''
|
||||
|
@ -86,7 +86,8 @@ def friend_command(o_inst):
|
|||
raise onionrexceptions.KeyNotKnown
|
||||
friend = onionrusers.OnionrUser(o_inst.onionrCore, friend)
|
||||
except IndexError:
|
||||
logger.error('Friend ID is required.')
|
||||
logger.warn('Friend ID is required.')
|
||||
action = 'error' # set to 'error' so that the finally block does not process anything
|
||||
except onionrexceptions.KeyNotKnown:
|
||||
o_inst.onionrCore.addPeer(friend)
|
||||
friend = onionrusers.OnionrUser(o_inst.onionrCore, friend)
|
||||
|
@ -94,7 +95,7 @@ def friend_command(o_inst):
|
|||
if action == 'add':
|
||||
friend.setTrust(1)
|
||||
logger.info('Added %s as friend.' % (friend.publicKey,))
|
||||
else:
|
||||
elif action == 'remove':
|
||||
friend.setTrust(0)
|
||||
logger.info('Removed %s as friend.' % (friend.publicKey,))
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue