mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-29 00:37:12 -04:00
Renamed hs to onion
This commit is contained in:
parent
f926d15721
commit
eb4c8df105
3 changed files with 16 additions and 16 deletions
|
@ -40,10 +40,10 @@ class HSDirError(Exception):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class HS(object):
|
class Onion(object):
|
||||||
"""
|
"""
|
||||||
HS is an abstraction layer for connecting to the Tor control port and
|
Onion is an abstraction layer for connecting to the Tor control port and
|
||||||
creating onion services. Onionshare supports creating onion services
|
creating onion services. OnionShare supports creating onion services
|
||||||
using two methods:
|
using two methods:
|
||||||
|
|
||||||
- Modifying the Tor configuration through the control port is the old
|
- Modifying the Tor configuration through the control port is the old
|
|
@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os, sys, time, argparse, shutil, socket, threading
|
import os, sys, time, argparse, shutil, socket, threading
|
||||||
|
|
||||||
from . import strings, helpers, web, hs
|
from . import strings, helpers, web, onion
|
||||||
|
|
||||||
class OnionShare(object):
|
class OnionShare(object):
|
||||||
"""
|
"""
|
||||||
|
@ -29,7 +29,7 @@ class OnionShare(object):
|
||||||
"""
|
"""
|
||||||
def __init__(self, debug=False, local_only=False, stay_open=False, transparent_torification=False):
|
def __init__(self, debug=False, local_only=False, stay_open=False, transparent_torification=False):
|
||||||
self.port = None
|
self.port = None
|
||||||
self.hs = None
|
self.onion = None
|
||||||
self.hidserv_dir = None
|
self.hidserv_dir = None
|
||||||
self.onion_host = None
|
self.onion_host = None
|
||||||
|
|
||||||
|
@ -75,10 +75,10 @@ class OnionShare(object):
|
||||||
self.onion_host = '127.0.0.1:{0:d}'.format(self.port)
|
self.onion_host = '127.0.0.1:{0:d}'.format(self.port)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.hs:
|
if not self.onion:
|
||||||
self.hs = hs.HS(self.transparent_torification)
|
self.onion = onion.Onion(self.transparent_torification)
|
||||||
|
|
||||||
self.onion_host = self.hs.start(self.port)
|
self.onion_host = self.onion.start(self.port)
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
"""
|
"""
|
||||||
|
@ -92,9 +92,9 @@ class OnionShare(object):
|
||||||
shutil.rmtree(filename)
|
shutil.rmtree(filename)
|
||||||
self.cleanup_filenames = []
|
self.cleanup_filenames = []
|
||||||
|
|
||||||
# call hs's cleanup
|
# cleanup the onion
|
||||||
if self.hs:
|
if self.onion:
|
||||||
self.hs.cleanup()
|
self.onion.cleanup()
|
||||||
|
|
||||||
|
|
||||||
def main(cwd=None):
|
def main(cwd=None):
|
||||||
|
@ -142,9 +142,9 @@ def main(cwd=None):
|
||||||
app = OnionShare(debug, local_only, stay_open, transparent_torification)
|
app = OnionShare(debug, local_only, stay_open, transparent_torification)
|
||||||
app.choose_port()
|
app.choose_port()
|
||||||
app.start_onion_service()
|
app.start_onion_service()
|
||||||
except hs.NoTor as e:
|
except onion.NoTor as e:
|
||||||
sys.exit(e.args[0])
|
sys.exit(e.args[0])
|
||||||
except hs.HSDirError as e:
|
except onion.HSDirError as e:
|
||||||
sys.exit(e.args[0])
|
sys.exit(e.args[0])
|
||||||
|
|
||||||
# prepare files to share
|
# prepare files to share
|
||||||
|
@ -166,7 +166,7 @@ def main(cwd=None):
|
||||||
try: # Trap Ctrl-C
|
try: # Trap Ctrl-C
|
||||||
# wait for hs, only if using old version of tor
|
# wait for hs, only if using old version of tor
|
||||||
if not app.local_only:
|
if not app.local_only:
|
||||||
ready = app.hs.wait_for_hs(app.onion_host)
|
ready = app.onion.wait_for_hs(app.onion_host)
|
||||||
if not ready:
|
if not ready:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -151,7 +151,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||||
self.app.choose_port()
|
self.app.choose_port()
|
||||||
try:
|
try:
|
||||||
self.app.start_onion_service(gui=True)
|
self.app.start_onion_service(gui=True)
|
||||||
except onionshare.hs.NoTor as e:
|
except onionshare.onion.NoTor as e:
|
||||||
alert(e.args[0], QtWidgets.QMessageBox.Warning)
|
alert(e.args[0], QtWidgets.QMessageBox.Warning)
|
||||||
self.server_status.stop_server()
|
self.server_status.stop_server()
|
||||||
self.status_bar.clearMessage()
|
self.status_bar.clearMessage()
|
||||||
|
@ -172,7 +172,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||||
# wait for hs
|
# wait for hs
|
||||||
if not self.app.local_only:
|
if not self.app.local_only:
|
||||||
self.status_bar.showMessage(strings._('gui_starting_server3', True))
|
self.status_bar.showMessage(strings._('gui_starting_server3', True))
|
||||||
self.app.hs.wait_for_hs(self.app.onion_host)
|
self.app.onion.wait_for_hs(self.app.onion_host)
|
||||||
|
|
||||||
# done
|
# done
|
||||||
self.start_server_finished.emit()
|
self.start_server_finished.emit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue