don't show tor transport box if there is none

master
Kevin 2020-06-25 03:29:27 -05:00
parent 1bf365aff4
commit 1aea6c3362
2 changed files with 25 additions and 0 deletions

View File

@ -145,4 +145,6 @@ class PrivateEndpoints:
@private_endpoints_bp.route('/gettoraddress') @private_endpoints_bp.route('/gettoraddress')
def get_tor_address(): def get_tor_address():
"""Return public Tor v3 Onion address for this node""" """Return public Tor v3 Onion address for this node"""
if not config.get('general.security_level', 0):
abort(404)
return Response(get_tor()[0]) return Response(get_tor()[0])

View File

@ -1,3 +1,21 @@
/*
Onionr - Private P2P Communication
Show transport addresses
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/>
*/
fetch('/gettoraddress', { fetch('/gettoraddress', {
headers: { headers: {
"token": webpass "token": webpass
@ -5,6 +23,11 @@ fetch('/gettoraddress', {
.then((resp) => resp.text()) .then((resp) => resp.text())
.then(function(resp) { .then(function(resp) {
let torBoxes = document.getElementsByClassName('myTor') let torBoxes = document.getElementsByClassName('myTor')
if (!resp.endsWith('.onion')){
Array.from(torBoxes).forEach(element => {
element.parentElement.parentElement.remove()
})
}
Array.from(torBoxes).forEach(element => { Array.from(torBoxes).forEach(element => {
element.value = resp element.value = resp
}) })