work on mail settings
parent
56e86460d1
commit
6f0ef390a7
|
@ -42,7 +42,7 @@ def update_block_info(hash, key, data):
|
|||
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()
|
||||
|
|
|
@ -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:
|
||||
if config.get('mail.notificationSetting', True):
|
||||
notifier.notification_with_sound(title="Onionr Mail - New Message", message="From: %s\n\nSubject: %s" % (signer, metadata['subject']))
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -166,18 +166,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
Keep messages when blocks are deleted
|
||||
</div>
|
||||
<div class="column is-2">
|
||||
<div class="field">
|
||||
<input id="maintainMessagesSetting" type="checkbox"
|
||||
class="switch is-rounded">
|
||||
<label for="maintainMessagesSetting"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
Inbox notifications
|
||||
|
|
|
@ -14,4 +14,7 @@ fetch('/config/get/mail', {
|
|||
if (mailSettings.use_padding === false){
|
||||
document.getElementById('messagePaddingSetting').checked = false
|
||||
}
|
||||
if (mailSettings.notificationSetting === false){
|
||||
document.getElementById('notificationSetting').checked = false
|
||||
}
|
||||
})
|
|
@ -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'
|
||||
})
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue