added reset plugins command

master
Kevin Froman 2019-08-29 04:25:21 -05:00
parent dcc42575c3
commit 03649756f5
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
4 changed files with 61 additions and 5 deletions

View File

@ -36,5 +36,5 @@ reset:
plugins-reset:
@echo "Resetting plugins..."
rm -rf onionr/$(ONIONR_HOME)/plugins/ | true > /dev/null 2>&1
@./onionr.sh reset-plugins | true > /dev/null 2>&1
@./onionr.sh version | grep -v "Failed" --color=always

View File

@ -1,9 +1,29 @@
'''
Onionr - Private P2P Communication
Sets CLI arguments for Onionr
'''
'''
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/>.
'''
from .. import onionrstatistics, version, daemonlaunch, keyadders, openwebinterface
from .. import banblocks # Command to blacklist a block by its hash
from .. import filecommands # commands to share files with onionr
from .. import exportblocks # commands to export blocks
from .. import pubkeymanager # commands to add or change id
from .. import resettor # command to reset the tor data directory
from .. import resetplugins # command to reinstall default plugins
import onionrexceptions
from onionrutils import importnewblocks # func to import new blocks
import onionrevents as events
@ -25,7 +45,8 @@ def get_arguments():
('importblocks', 'import-blocks', 'import-block'): importnewblocks.import_new_blocks,
('addid', 'add-id'): pubkeymanager.add_ID,
('changeid', 'change-id'): pubkeymanager.change_ID,
('resettor', 'reset-tor'): resettor.reset_tor
('resettor', 'reset-tor'): resettor.reset_tor,
('resetplugins', 'reset-plugins'): resetplugins.reset
}
return args

View File

@ -0,0 +1,35 @@
'''
Onionr - Private P2P Communication
Reset default plugins from source
'''
'''
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
import shutil
from utils import identifyhome
from setup import setup_default_plugins
import logger
def reset():
"""Reinstalls Onionr default plugins"""
home = identifyhome.identify_home()
plugin_dir = home + '/plugins/'
if not os.path.exists(home): return
if os.path.exists(plugin_dir): shutil.rmtree(plugin_dir)
setup_default_plugins()
logger.info('Default plugins have been reset.', terminal=True)

View File

@ -38,15 +38,15 @@ import sentboxdb, mailapi, loadinbox # import after path insert
flask_blueprint = mailapi.flask_blueprint
security_whitelist = ['staticfiles.mail', 'staticfiles.mailindex']
def add_deleted(keyStore, bHash):
def add_deleted(keyStore, b_hash):
existing = keyStore.get('deleted_mail')
bHash = reconstructhash.reconstruct_hash(bHash)
bHash = reconstructhash.reconstruct_hash(b_hash)
if existing is None:
existing = []
else:
if bHash in existing:
return
keyStore.put('deleted_mail', existing.append(bHash))
keyStore.put('deleted_mail', existing.append(b_hash))
def on_insertblock(api, data={}):
meta = json.loads(data['meta'])