mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-26 07:49:48 -05:00
Fix indenting
This commit is contained in:
parent
36de1951e7
commit
befc253d4b
@ -95,8 +95,8 @@ def get_version():
|
|||||||
Returns the version of OnionShare that is running.
|
Returns the version of OnionShare that is running.
|
||||||
"""
|
"""
|
||||||
with open(get_resource_path('version.txt')) as f:
|
with open(get_resource_path('version.txt')) as f:
|
||||||
version = f.read().strip()
|
version = f.read().strip()
|
||||||
return version
|
return version
|
||||||
|
|
||||||
|
|
||||||
def constant_time_compare(val1, val2):
|
def constant_time_compare(val1, val2):
|
||||||
@ -136,8 +136,8 @@ def build_slug():
|
|||||||
Returns a random string made from two words from the wordlist, such as "deter-trig".
|
Returns a random string made from two words from the wordlist, such as "deter-trig".
|
||||||
"""
|
"""
|
||||||
with open(get_resource_path('wordlist.txt')) as f:
|
with open(get_resource_path('wordlist.txt')) as f:
|
||||||
wordlist = f.read().split('\n')
|
wordlist = f.read().split('\n')
|
||||||
wordlist.remove('')
|
wordlist.remove('')
|
||||||
|
|
||||||
r = SystemRandom()
|
r = SystemRandom()
|
||||||
return '-'.join(r.choice(wordlist) for x in range(2))
|
return '-'.join(r.choice(wordlist) for x in range(2))
|
||||||
|
@ -179,7 +179,7 @@ class Onion(object):
|
|||||||
else:
|
else:
|
||||||
# Linux and Mac can use unix sockets
|
# Linux and Mac can use unix sockets
|
||||||
with open(common.get_resource_path('torrc_template')) as f:
|
with open(common.get_resource_path('torrc_template')) as f:
|
||||||
torrc_template = f.read()
|
torrc_template = f.read()
|
||||||
self.tor_control_port = None
|
self.tor_control_port = None
|
||||||
self.tor_control_socket = os.path.join(self.tor_data_directory.name, 'control_socket')
|
self.tor_control_socket = os.path.join(self.tor_data_directory.name, 'control_socket')
|
||||||
self.tor_cookie_auth_file = os.path.join(self.tor_data_directory.name, 'cookie')
|
self.tor_cookie_auth_file = os.path.join(self.tor_data_directory.name, 'cookie')
|
||||||
@ -194,7 +194,7 @@ class Onion(object):
|
|||||||
torrc_template = torrc_template.replace('{{geo_ipv6_file}}', self.tor_geo_ipv6_file_path)
|
torrc_template = torrc_template.replace('{{geo_ipv6_file}}', self.tor_geo_ipv6_file_path)
|
||||||
torrc_template = torrc_template.replace('{{socks_port}}', str(self.tor_socks_port))
|
torrc_template = torrc_template.replace('{{socks_port}}', str(self.tor_socks_port))
|
||||||
with open(self.tor_torrc, 'w') as f:
|
with open(self.tor_torrc, 'w') as f:
|
||||||
f.write(torrc_template)
|
f.write(torrc_template)
|
||||||
|
|
||||||
# Execute a tor subprocess
|
# Execute a tor subprocess
|
||||||
start_ts = time.time()
|
start_ts = time.time()
|
||||||
|
@ -86,8 +86,8 @@ class Settings(object):
|
|||||||
if os.path.exists(self.filename):
|
if os.path.exists(self.filename):
|
||||||
try:
|
try:
|
||||||
with open(self.filename, 'r') as f:
|
with open(self.filename, 'r') as f:
|
||||||
self._settings = json.loads(f.read())
|
self._settings = json.loads(f.read())
|
||||||
self.fill_in_defaults()
|
self.fill_in_defaults()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ def load_strings(common, default="en"):
|
|||||||
lang, ext = os.path.splitext(filename)
|
lang, ext = os.path.splitext(filename)
|
||||||
if abs_filename.endswith('.json'):
|
if abs_filename.endswith('.json'):
|
||||||
with open(abs_filename, encoding='utf-8') as f:
|
with open(abs_filename, encoding='utf-8') as f:
|
||||||
lang_json = f.read()
|
lang_json = f.read()
|
||||||
translations[lang] = json.loads(lang_json)
|
translations[lang] = json.loads(lang_json)
|
||||||
|
|
||||||
strings = translations[default]
|
strings = translations[default]
|
||||||
lc, enc = locale.getdefaultlocale()
|
lc, enc = locale.getdefaultlocale()
|
||||||
|
Loading…
Reference in New Issue
Block a user