added option to disable plaintext blocks
This commit is contained in:
parent
71c9337ab7
commit
60f0ef0fef
@ -64,6 +64,7 @@ def insert_block(data: Union[str, bytes], header: str ='txt',
|
||||
if encryptType in ('asym', 'sym'):
|
||||
metadata['encryptType'] = encryptType
|
||||
else:
|
||||
if not config.get('general.store_plaintext_blocks', True): raise onionrexceptions.InvalidMetadata("Plaintext blocks are disabled, yet a plaintext block was being inserted")
|
||||
if not encryptType in ('', None):
|
||||
raise onionrexceptions.InvalidMetadata('encryptType must be asym or sym, or blank')
|
||||
|
||||
|
@ -39,5 +39,4 @@ def set_data(data)->str:
|
||||
else:
|
||||
raise onionrexceptions.DataExists("Data is already set for " + dataHash)
|
||||
|
||||
print(dataHash, nonce_hash)
|
||||
return dataHash
|
||||
|
@ -73,6 +73,8 @@ def validate_metadata(metadata, block_data) -> bool:
|
||||
elif i == 'encryptType':
|
||||
try:
|
||||
if not metadata[i] in ('asym', 'sym', ''): raise ValueError
|
||||
if not config.get('general.store_plaintext_blocks', True):
|
||||
break
|
||||
except ValueError:
|
||||
logger.warn('Invalid encryption mode')
|
||||
break
|
||||
|
@ -13,28 +13,8 @@
|
||||
"max_block_age": 2678400,
|
||||
"public_key": "",
|
||||
"random_bind_ip": false,
|
||||
"use_bootstrap_list": true
|
||||
},
|
||||
|
||||
"www": {
|
||||
"public": {
|
||||
"run": true,
|
||||
"path": "static-data/www/public/"
|
||||
},
|
||||
|
||||
"private": {
|
||||
"run": true,
|
||||
"path": "static-data/www/private/"
|
||||
},
|
||||
|
||||
"ui": {
|
||||
"run": true,
|
||||
"private": true
|
||||
}
|
||||
},
|
||||
|
||||
"client": {
|
||||
|
||||
"use_bootstrap_list": true,
|
||||
"store_plaintext_blocks": true
|
||||
},
|
||||
|
||||
"plugins": {
|
||||
|
@ -44,7 +44,7 @@ fetch('/flow/version', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
}})
|
||||
.then((resp) => resp.text()) // Transform the data into json
|
||||
.then((resp) => resp.text())
|
||||
.then(function(data) {
|
||||
document.getElementById('circlesVersion').innerText = data
|
||||
})
|
||||
|
35
static-data/www/board/detect-plaintext-storage.js
Normal file
35
static-data/www/board/detect-plaintext-storage.js
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
detect for Circles if plaintext insert/storage is enabled
|
||||
|
||||
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/>.
|
||||
*/
|
||||
plaintext_enabled = null
|
||||
|
||||
fetch('/config/get/general.store_plaintext_blocks', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"token": webpass
|
||||
}})
|
||||
.then((resp) => resp.text())
|
||||
.then(function(data) {
|
||||
plaintext_enabled = true
|
||||
if (data == "false"){
|
||||
plaintext_enabled = false
|
||||
PNotify.error({
|
||||
text: "Plaintext storage is disabled. You will not be able to see new posts or make posts yourself"
|
||||
})
|
||||
}
|
||||
})
|
@ -21,6 +21,7 @@
|
||||
<script defer src='/shared/navbar.js'></script>
|
||||
<script defer src="/shared/useridenticons.js"></script>
|
||||
<script defer src='/shared/misc.js'></script>
|
||||
<script defer src="detect-plaintext-storage.js"></script>
|
||||
<script defer src='sethumanreadable.js'></script>
|
||||
<script defer src='board.js'></script>
|
||||
<script defer src='autorefresh.js'></script>
|
||||
|
Loading…
Reference in New Issue
Block a user