diff --git a/Makefile b/Makefile
index 982b1dc0..07aa2729 100755
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/onionr/onionrcommands/parser/arguments.py b/onionr/onionrcommands/parser/arguments.py
index 03924e90..589a5722 100644
--- a/onionr/onionrcommands/parser/arguments.py
+++ b/onionr/onionrcommands/parser/arguments.py
@@ -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 .
+'''
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
diff --git a/onionr/onionrcommands/resetplugins.py b/onionr/onionrcommands/resetplugins.py
new file mode 100644
index 00000000..09add244
--- /dev/null
+++ b/onionr/onionrcommands/resetplugins.py
@@ -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 .
+'''
+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)
\ No newline at end of file
diff --git a/onionr/static-data/default-plugins/pms/main.py b/onionr/static-data/default-plugins/pms/main.py
index df26ad1e..5fafaa4b 100755
--- a/onionr/static-data/default-plugins/pms/main.py
+++ b/onionr/static-data/default-plugins/pms/main.py
@@ -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'])