added more help messages

This commit is contained in:
Kevin Froman 2019-09-21 00:06:49 -05:00
parent ccc30f68d6
commit 586ce58894
15 changed files with 47 additions and 15 deletions

View File

@ -63,5 +63,5 @@ class ClientAPISecurity:
if request.endpoint == 'siteapi.site':
resp.headers['Content-Security-Policy'] = "default-src 'none'; style-src data: 'unsafe-inline'; img-src data:"
else:
resp.headers['Content-Security-Policy'] = "default-src 'none'; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self'; media-src 'none'; frame-src 'none'; font-src 'self'; connect-src 'self'"
resp.headers['Content-Security-Policy'] = "default-src 'none'; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; media-src 'none'; frame-src 'none'; font-src 'self'; connect-src 'self'"
return resp

View File

@ -133,6 +133,8 @@ def kill_daemon():
logger.error('Failed to shutdown daemon: ' + str(e), error = e, timestamp = False, terminal=True)
return
kill_daemon.onionr_help = "Gracefully stops the Onionr API servers"
def start(input: bool = False, override: bool = False):
"""If no lock file, make one and start onionr, error if there is and its not overridden"""
if os.path.exists('.onionr-lock') and not override:
@ -147,4 +149,6 @@ def start(input: bool = False, override: bool = False):
try:
os.remove('.onionr-lock')
except FileNotFoundError:
pass
pass
start.onionr_help = "Start Onionr node (public and clients API servers)"

View File

@ -38,4 +38,6 @@ def export_block():
sys.exit(1)
else:
bHash = sys.argv[2]
doExport(bHash)
doExport(bHash)
export_block.onionr_help = "<block hash>: Export an Onionr block to a file. Export directory is in the Onionr data directory under block-export/"

View File

@ -34,6 +34,8 @@ def _get_dir(path: str)->str:
def add_html(singleBlock=True, blockType='html'):
add_file(singleBlock, blockType)
add_html.onionr_help = "Adds an HTML file into Onionr. Does not currently include dependant resources"
def add_file(singleBlock=False, blockType='bin'):
'''
Adds a file to the onionr network
@ -56,6 +58,8 @@ def add_file(singleBlock=False, blockType='bin'):
else:
logger.error('%s add-file <filename>' % sys.argv[0], timestamp = False, terminal=True)
add_file.onionr_help = "<file path> Add a file into the Onionr network"
def get_file():
'''
Get a file from onionr blocks
@ -81,4 +85,5 @@ def get_file():
myFile.write(base64.b64decode(Block(bHash).bcontent))
except onionrexceptions.NoDataAvailable:
logger.error('That block is not available. Trying again later may work.', terminal=True)
return
get_file.onionr_help = "<file path> <block hash>: Download a file from the onionr network."

View File

@ -32,4 +32,6 @@ def add_address():
if keydb.addkeys.add_address(newAddress):
logger.info("Successfully added address.", terminal=True)
else:
logger.warn("Unable to add address.", terminal=True)
logger.warn("Unable to add address.", terminal=True)
add_address.onionr_help = "Adds a node transport address to the local node list"

View File

@ -29,4 +29,6 @@ def open_home():
else:
url = 'http://%s/#%s' % (url, config.get('client.webpassword'))
logger.info('If Onionr does not open automatically, use this URL: ' + url, terminal=True)
webbrowser.open_new_tab(url)
webbrowser.open_new_tab(url)
open_home.onionr_help = "Opens the Onionr web UI in the default browser. Node must be running."

View File

@ -67,6 +67,8 @@ def add_ID():
return
logger.info('Added ID: %s' % (bytesconverter.bytes_to_str(newID),), terminal=True)
add_ID.onionr_help = "If the first argument is true, Onionr will show a deterministic generation prompt. Otherwise it will generate & save a new random key pair."
def change_ID():
key_manager = keymanager.KeyManager()
try:
@ -87,6 +89,8 @@ def change_ID():
else:
logger.warn('Invalid key %s' % (key,), terminal=True)
change_ID.onionr_help = "<pubkey>: Switches Onionr to use a different user ID key. You should immediately restart Onionr if it is running."
def add_vanity():
key_manager = keymanager.KeyManager()
tell = lambda tell: logger.info(tell, terminal=True)
@ -113,4 +117,4 @@ def add_vanity():
key_manager.addKey(b32_pub, unpaddedbase32.b32encode(vanity[1]))
except KeyboardInterrupt:
pass
add_vanity.onionr_help = "<space separated bip32 words> - Generates and stores an Onionr vanity address (see https://github.com/trezor/python-mnemonic/blob/master/mnemonic/wordlist/english.txt)"
add_vanity.onionr_help = "<space separated bip32 words> - Generates and stores an Onionr vanity address (see https://github.com/trezor/python-mnemonic/blob/master/mnemonic/wordlist/english.txt)"

View File

@ -34,4 +34,4 @@ def reset():
setup_default_plugins()
logger.info('Default plugins have been reset.', terminal=True)
reset.onionr_help = "reinstalls default Onionr plugins (e.g. mail). Should be done after git pulls or plugin modification."
reset.onionr_help = "reinstalls default Onionr plugins (e.g. mail). Should be done after git pulls or plugin modification."

View File

@ -34,5 +34,9 @@ def __delete(directory):
def reset_tor():
__delete('tordata')
reset_tor.onionr_help = "Deletes Onionr's Tor data directory. Only do this as a last resort if you have serious Tor issues."
def reset_tor_key_pair():
__delete('hs')
reset_tor_key_pair.onionr_help = "Delete's your Tor node address permanently. Note that through fingerprinting attackers may be able to know that your any new generated node address belongs to the same node as the deleted one."

View File

@ -43,4 +43,4 @@ def soft_reset():
onionrevents.event('softreset')
logger.info("Soft reset Onionr", terminal=True)
soft_reset.onionr_help = "Deletes Onionr blocks and their associated metadata, except for any exported block files."
soft_reset.onionr_help = "Deletes Onionr blocks and their associated metadata, except for any exported block files. Does NOT delete data on other nodes in the network."

View File

@ -47,3 +47,5 @@ def import_new_blocks(scanDir=''):
logger.warn('Failed to verify hash for %s' % block, terminal=True)
if not exist:
logger.info('No blocks found to import', terminal=True)
import_new_blocks.onionr_help = f"Scans the Onionr data directory under {filepaths.block_data_location} for new block files (.dat, .db not supported) to import"

View File

@ -89,6 +89,7 @@ function appendMessages(msg, blockHash, beforeHash){
// Clone the new row and insert it into the table
var clone = document.importNode(template.content, true)
var div = clone.querySelectorAll("div")
var identicon = clone.querySelectorAll("img")
div[0].setAttribute('data-bl', blockHash)
div[2].textContent = msg['content']
@ -96,6 +97,10 @@ function appendMessages(msg, blockHash, beforeHash){
div[3].textContent = msg['meta']['signer'].substr(0, 5)
setHumanReadableIDOnPost(div[3], msg['meta']['signer'])
div[3].title = msg['meta']['signer']
identicon[0].src = "data:image/svg+xml;base64," + userIcon(msg['meta']['signer'])
}
else{
identicon[0].remove()
}
div[4].textContent = msgDate
@ -110,8 +115,6 @@ function appendMessages(msg, blockHash, beforeHash){
feed.prepend(clone)
}
else{
//feed.insertAfter(clone, beforeEl)
console.log(clone)
beforeEl.insertAdjacentElement("beforebegin", clone.children[0])
}

View File

@ -14,9 +14,12 @@
<link rel='stylesheet' href='/shared/main/bulma.min.css'>
<link rel="stylesheet" href='/shared/main/styles-new.css'>
<link rel="stylesheet" href="theme.css">
<script defer src="/shared/base32.js"></script>
<script defer src="/shared/identicon.js"></script>
<script defer src='/shared/node_modules/pnotify/dist/iife/PNotify.js'></script>
<script defer src='/shared/node_modules/pnotify/dist/iife/PNotifyButtons.js'></script>
<script defer src='/shared/navbar.js'></script>
<script defer src="/shared/useridenticons.js"></script>
<script defer src='/shared/misc.js'></script>
<script defer src='sethumanreadable.js'></script>
<script defer src='board.js'></script>
@ -117,7 +120,7 @@
</p>
</div>
<input type="checkbox" class="checkbox" id="refreshCheckbox" checked>
<label for="refreshCheckbox">Auto Refresh Feed</label>
<label for="refreshCheckbox">Auto refresh feed</label>
<br>
<input type="checkbox" class="checkbox" id="postAnon" checked>
<label for="postAnon">Sign posts</label>
@ -144,6 +147,7 @@
Message
</div>
<div class="column cAuthor is-narrow"></div>
<img class="identicon image is-48x48" alt="user icon" src="/shared/images/anon.svg">
<div class="column is-narrow cMsgDate">
Date
</div>

View File

@ -3,4 +3,4 @@
word-wrap:break-word;
word-break:break-word;
white-space: pre-wrap;
}
}

View File

@ -8,8 +8,8 @@ function checkHex(str) {
document.getElementById('openSite').onclick = function(){
var hash = document.getElementById('siteViewer').value
if (checkHex(hash) && hash.length == 64){
if (hash.length == 0){ return }
if (checkHex(hash) && hash.length >= 50){
window.location.href = '/site/' + hash
}
else{