mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Cleanup ephemeral hidden services
This commit is contained in:
parent
fd39f84bff
commit
a5aff46050
@ -36,6 +36,7 @@ class HS(object):
|
|||||||
|
|
||||||
# files and dirs to delete on shutdown
|
# files and dirs to delete on shutdown
|
||||||
self.cleanup_filenames = []
|
self.cleanup_filenames = []
|
||||||
|
self.service_id = None
|
||||||
|
|
||||||
# connect to the tor controlport
|
# connect to the tor controlport
|
||||||
self.c = None
|
self.c = None
|
||||||
@ -60,6 +61,7 @@ class HS(object):
|
|||||||
if self.supports_ephemeral:
|
if self.supports_ephemeral:
|
||||||
print strings._('using_ephemeral')
|
print strings._('using_ephemeral')
|
||||||
res = self.c.create_ephemeral_hidden_service({ 80: port }, await_publication = True)
|
res = self.c.create_ephemeral_hidden_service({ 80: port }, await_publication = True)
|
||||||
|
self.service_id = res.content()[0][2].split('=')[1]
|
||||||
onion_host = res.content()[0][2].split('=')[1] + '.onion'
|
onion_host = res.content()[0][2].split('=')[1] + '.onion'
|
||||||
return onion_host
|
return onion_host
|
||||||
|
|
||||||
@ -147,8 +149,11 @@ class HS(object):
|
|||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
if self.supports_ephemeral:
|
if self.supports_ephemeral:
|
||||||
# todo: cleanup the ephemeral hidden service
|
# cleanup the ephemeral hidden service
|
||||||
pass
|
if self.service_id:
|
||||||
|
self.c.remove_ephemeral_hidden_service(self.service_id)
|
||||||
|
self.service_id = None
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# cleanup hidden service
|
# cleanup hidden service
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user