diff --git a/onionr/httpapi/security/client.py b/onionr/httpapi/security/client.py index 48359378..e2726b4a 100644 --- a/onionr/httpapi/security/client.py +++ b/onionr/httpapi/security/client.py @@ -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 \ No newline at end of file diff --git a/onionr/onionrcommands/daemonlaunch.py b/onionr/onionrcommands/daemonlaunch.py index d623c80f..b6d5802a 100755 --- a/onionr/onionrcommands/daemonlaunch.py +++ b/onionr/onionrcommands/daemonlaunch.py @@ -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 \ No newline at end of file + pass + +start.onionr_help = "Start Onionr node (public and clients API servers)" \ No newline at end of file diff --git a/onionr/onionrcommands/exportblocks.py b/onionr/onionrcommands/exportblocks.py index c1e3b624..72564e00 100755 --- a/onionr/onionrcommands/exportblocks.py +++ b/onionr/onionrcommands/exportblocks.py @@ -38,4 +38,6 @@ def export_block(): sys.exit(1) else: bHash = sys.argv[2] - doExport(bHash) \ No newline at end of file + doExport(bHash) + +export_block.onionr_help = ": Export an Onionr block to a file. Export directory is in the Onionr data directory under block-export/" diff --git a/onionr/onionrcommands/filecommands.py b/onionr/onionrcommands/filecommands.py index 6ac0383a..19631d16 100755 --- a/onionr/onionrcommands/filecommands.py +++ b/onionr/onionrcommands/filecommands.py @@ -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 ' % sys.argv[0], timestamp = False, terminal=True) +add_file.onionr_help = " 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 \ No newline at end of file + +get_file.onionr_help = " : Download a file from the onionr network." diff --git a/onionr/onionrcommands/keyadders.py b/onionr/onionrcommands/keyadders.py index 8d08b61b..5c15103e 100755 --- a/onionr/onionrcommands/keyadders.py +++ b/onionr/onionrcommands/keyadders.py @@ -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) \ No newline at end of file + logger.warn("Unable to add address.", terminal=True) + +add_address.onionr_help = "Adds a node transport address to the local node list" diff --git a/onionr/onionrcommands/openwebinterface.py b/onionr/onionrcommands/openwebinterface.py index c4752b5d..24689ce0 100755 --- a/onionr/onionrcommands/openwebinterface.py +++ b/onionr/onionrcommands/openwebinterface.py @@ -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) \ No newline at end of file + webbrowser.open_new_tab(url) + +open_home.onionr_help = "Opens the Onionr web UI in the default browser. Node must be running." diff --git a/onionr/onionrcommands/pubkeymanager.py b/onionr/onionrcommands/pubkeymanager.py index 4c9ee77d..5fcf2871 100755 --- a/onionr/onionrcommands/pubkeymanager.py +++ b/onionr/onionrcommands/pubkeymanager.py @@ -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 = ": 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 = " - Generates and stores an Onionr vanity address (see https://github.com/trezor/python-mnemonic/blob/master/mnemonic/wordlist/english.txt)" \ No newline at end of file +add_vanity.onionr_help = " - Generates and stores an Onionr vanity address (see https://github.com/trezor/python-mnemonic/blob/master/mnemonic/wordlist/english.txt)" diff --git a/onionr/onionrcommands/resetplugins.py b/onionr/onionrcommands/resetplugins.py index 68cc7dcd..c7ebe192 100644 --- a/onionr/onionrcommands/resetplugins.py +++ b/onionr/onionrcommands/resetplugins.py @@ -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." \ No newline at end of file +reset.onionr_help = "reinstalls default Onionr plugins (e.g. mail). Should be done after git pulls or plugin modification." diff --git a/onionr/onionrcommands/resettor.py b/onionr/onionrcommands/resettor.py index a3712c33..bb9166e8 100755 --- a/onionr/onionrcommands/resettor.py +++ b/onionr/onionrcommands/resettor.py @@ -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." diff --git a/onionr/onionrcommands/softreset.py b/onionr/onionrcommands/softreset.py index 2ef12e4e..913d6950 100644 --- a/onionr/onionrcommands/softreset.py +++ b/onionr/onionrcommands/softreset.py @@ -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." \ No newline at end of file +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." diff --git a/onionr/onionrutils/importnewblocks.py b/onionr/onionrutils/importnewblocks.py index 20270af9..4ba614fb 100644 --- a/onionr/onionrutils/importnewblocks.py +++ b/onionr/onionrutils/importnewblocks.py @@ -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" diff --git a/onionr/static-data/www/board/board.js b/onionr/static-data/www/board/board.js index 270541bb..f5fa4bf1 100755 --- a/onionr/static-data/www/board/board.js +++ b/onionr/static-data/www/board/board.js @@ -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]) } diff --git a/onionr/static-data/www/board/index.html b/onionr/static-data/www/board/index.html index a5da4787..beb47def 100755 --- a/onionr/static-data/www/board/index.html +++ b/onionr/static-data/www/board/index.html @@ -14,9 +14,12 @@ + + + @@ -117,7 +120,7 @@

- +
@@ -144,6 +147,7 @@ Message
+ user icon
Date
diff --git a/onionr/static-data/www/board/theme.css b/onionr/static-data/www/board/theme.css index be1c1ccd..8d6cd8df 100755 --- a/onionr/static-data/www/board/theme.css +++ b/onionr/static-data/www/board/theme.css @@ -3,4 +3,4 @@ word-wrap:break-word; word-break:break-word; white-space: pre-wrap; -} \ No newline at end of file +} diff --git a/onionr/static-data/www/shared/sites.js b/onionr/static-data/www/shared/sites.js index b318fffc..6aedcf87 100755 --- a/onionr/static-data/www/shared/sites.js +++ b/onionr/static-data/www/shared/sites.js @@ -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{