diff --git a/src/httpapi/miscclientapi/endpoints.py b/src/httpapi/miscclientapi/endpoints.py index 4ada89bc..7baf6c6e 100644 --- a/src/httpapi/miscclientapi/endpoints.py +++ b/src/httpapi/miscclientapi/endpoints.py @@ -145,4 +145,6 @@ class PrivateEndpoints: @private_endpoints_bp.route('/gettoraddress') def get_tor_address(): """Return public Tor v3 Onion address for this node""" + if not config.get('general.security_level', 0): + abort(404) return Response(get_tor()[0]) diff --git a/static-data/www/shared/main/loadTransport.js b/static-data/www/shared/main/loadTransport.js index 4e5e2b6c..d6d62910 100644 --- a/static-data/www/shared/main/loadTransport.js +++ b/static-data/www/shared/main/loadTransport.js @@ -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 +*/ fetch('/gettoraddress', { headers: { "token": webpass @@ -5,6 +23,11 @@ fetch('/gettoraddress', { .then((resp) => resp.text()) .then(function(resp) { let torBoxes = document.getElementsByClassName('myTor') + if (!resp.endsWith('.onion')){ + Array.from(torBoxes).forEach(element => { + element.parentElement.parentElement.remove() + }) + } Array.from(torBoxes).forEach(element => { element.value = resp })