diff --git a/src/coredb/blockmetadb/updateblockinfo.py b/src/coredb/blockmetadb/updateblockinfo.py index 3fdc4033..516201f9 100644 --- a/src/coredb/blockmetadb/updateblockinfo.py +++ b/src/coredb/blockmetadb/updateblockinfo.py @@ -35,14 +35,14 @@ def update_block_info(hash, key, data): dateClaimed - timestamp claimed inside the block, only as trustworthy as the block author is expire - expire date for a block ''' - if key not in ('dateReceived', 'decrypted', 'dataType', 'dataFound', + if key not in ('dateReceived', 'decrypted', 'dataType', 'dataFound', 'dataSaved', 'sig', 'author', 'dateClaimed', 'expire'): raise ValueError('Key must be in the allowed list') conn = sqlite3.connect(dbfiles.block_meta_db, timeout=onionrvalues.DATABASE_LOCK_TIMEOUT) c = conn.cursor() args = (data, hash) - # Unfortunately, not really possible + # Unfortunately, not really possible to prepare this statement c.execute("UPDATE hashes SET " + key + " = ? where hash = ?;", args) conn.commit() conn.close() diff --git a/static-data/default-plugins/pms/main.py b/static-data/default-plugins/pms/main.py index f1984707..da2e0b2e 100755 --- a/static-data/default-plugins/pms/main.py +++ b/static-data/default-plugins/pms/main.py @@ -10,6 +10,7 @@ import json from onionrusers import contactmanager from utils import reconstructhash from onionrutils import bytesconverter +import config import notifier """ This program is free software: you can redistribute it and/or modify @@ -72,4 +73,5 @@ def on_processblocks(api, data=None): signer = signer[:5] if data['block'].decrypted: - notifier.notification_with_sound(title="Onionr Mail - New Message", message="From: %s\n\nSubject: %s" % (signer, metadata['subject'])) + if config.get('mail.notificationSetting', True): + notifier.notification_with_sound(title="Onionr Mail - New Message", message="From: %s\n\nSubject: %s" % (signer, metadata['subject'])) diff --git a/static-data/default_config.json b/static-data/default_config.json index cca630e0..38d09d2b 100755 --- a/static-data/default_config.json +++ b/static-data/default_config.json @@ -10,15 +10,15 @@ }, "general": { "announce_node": true, - "dev_mode": false, + "dev_mode": true, "display_header": true, "hide_created_blocks": true, - "insert_deniable_blocks": true, + "insert_deniable_blocks": false, "max_block_age": 2678400, - "minimum_block_pow": 5, - "minimum_send_pow": 5, + "minimum_block_pow": 4, + "minimum_send_pow": 4, "public_key": "", - "random_bind_ip": true, + "random_bind_ip": false, "security_level": 0, "show_notifications": true, "socket_servers": false, @@ -33,12 +33,12 @@ }, "file": { "output": true, - "remove_on_exit": true + "remove_on_exit": false }, "verbosity": "default" }, "onboarding": { - "done": false + "done": true }, "peers": { "max_connect": 1000, @@ -58,11 +58,11 @@ "tor": { "bridge_fingerprint": "", "bridge_ip": "", - "existing_control_password": "", - "existing_control_port": 0, - "existing_socks_port": 0, + "existing_control_password": "testt", + "existing_control_port": 1338, + "existing_socks_port": 1337, "use_bridge": false, - "use_existing_tor": false, + "use_existing_tor": true, "v3onions": true }, "transports": { diff --git a/static-data/www/mail/index.html b/static-data/www/mail/index.html index 2d58e42e..be643865 100755 --- a/static-data/www/mail/index.html +++ b/static-data/www/mail/index.html @@ -166,18 +166,6 @@ -
-
- Keep messages when blocks are deleted -
-
-
- - -
-
-
Inbox notifications diff --git a/static-data/www/mail/loadsettings.js b/static-data/www/mail/loadsettings.js index ef8fa4de..ac9db054 100644 --- a/static-data/www/mail/loadsettings.js +++ b/static-data/www/mail/loadsettings.js @@ -12,6 +12,9 @@ fetch('/config/get/mail', { document.getElementById('forwardSecrecySetting').checked = false } if (mailSettings.use_padding === false){ - document.getElementById('messagePaddingSetting').checked = false + document.getElementById('messagePaddingSetting').checked = false + } + if (mailSettings.notificationSetting === false){ + document.getElementById('notificationSetting').checked = false } }) \ No newline at end of file diff --git a/static-data/www/mail/settings.js b/static-data/www/mail/settings.js index a938632f..c72bdeab 100644 --- a/static-data/www/mail/settings.js +++ b/static-data/www/mail/settings.js @@ -37,7 +37,7 @@ document.getElementById('forwardSecrecySetting').onchange = function(e){ notificationSetting.onchange = function(e){ - let notificationSettings = document.getElementsByClassName('notificationSetting') + var notificationSettings = document.getElementsByClassName('notificationSetting') if (e.target.checked){ for (i = 0; i < notificationSettings.length; i++){ notificationSettings[i].style.display = "flex" @@ -48,4 +48,19 @@ notificationSetting.onchange = function(e){ notificationSettings[i].style.display = "none" } } + var postData = JSON.stringify({"notificationSetting": e.target.checked}) + fetch('/config/set/mail', { + method: 'POST', + body: postData, + headers: { + "content-type": "application/json", + "token": webpass + }}) + .then((resp) => resp.text()) + .then(function(data) { + mailSettings['notificationSetting'] = notificationSetting.checked + PNotify.success({ + text: 'Successfully toggled default mail notifications' + }) + }) } \ No newline at end of file