mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-05 09:25:37 -05:00
Add downloads_dir to settings, make it default to ~/Downloads
This commit is contained in:
parent
18ac830a9e
commit
383ccb94fc
@ -86,6 +86,7 @@ def main(cwd=None):
|
||||
|
||||
|
||||
settings = Settings(config)
|
||||
settings.load()
|
||||
|
||||
# Start the Onion object
|
||||
onion = Onion()
|
||||
@ -122,7 +123,6 @@ def main(cwd=None):
|
||||
print('')
|
||||
|
||||
# Start OnionShare http service in new thread
|
||||
settings.load()
|
||||
t = threading.Thread(target=web.start, args=(app.port, app.stay_open, settings.get('slug')))
|
||||
t.daemon = True
|
||||
t.start()
|
||||
|
@ -70,7 +70,8 @@ class Settings(object):
|
||||
'save_private_key': False,
|
||||
'private_key': '',
|
||||
'slug': '',
|
||||
'hidservauth_string': ''
|
||||
'hidservauth_string': '',
|
||||
'downloads_dir': self.build_default_downloads_dir()
|
||||
}
|
||||
self._settings = {}
|
||||
self.fill_in_defaults()
|
||||
@ -97,6 +98,14 @@ class Settings(object):
|
||||
else:
|
||||
return os.path.expanduser('~/.config/onionshare/onionshare.json')
|
||||
|
||||
def build_default_downloads_dir(self):
|
||||
"""
|
||||
Returns the path of the default Downloads directory for receive mode.
|
||||
"""
|
||||
# TODO: Test in Windows, though it looks like it should work
|
||||
# https://docs.python.org/3/library/os.path.html#os.path.expanduser
|
||||
return os.path.expanduser('~/Downloads')
|
||||
|
||||
def load(self):
|
||||
"""
|
||||
Load the settings from file.
|
||||
|
Loading…
x
Reference in New Issue
Block a user