mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-10 19:58:52 -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 = Settings(config)
|
||||||
|
settings.load()
|
||||||
|
|
||||||
# Start the Onion object
|
# Start the Onion object
|
||||||
onion = Onion()
|
onion = Onion()
|
||||||
@ -122,7 +123,6 @@ def main(cwd=None):
|
|||||||
print('')
|
print('')
|
||||||
|
|
||||||
# Start OnionShare http service in new thread
|
# 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 = threading.Thread(target=web.start, args=(app.port, app.stay_open, settings.get('slug')))
|
||||||
t.daemon = True
|
t.daemon = True
|
||||||
t.start()
|
t.start()
|
||||||
|
@ -70,7 +70,8 @@ class Settings(object):
|
|||||||
'save_private_key': False,
|
'save_private_key': False,
|
||||||
'private_key': '',
|
'private_key': '',
|
||||||
'slug': '',
|
'slug': '',
|
||||||
'hidservauth_string': ''
|
'hidservauth_string': '',
|
||||||
|
'downloads_dir': self.build_default_downloads_dir()
|
||||||
}
|
}
|
||||||
self._settings = {}
|
self._settings = {}
|
||||||
self.fill_in_defaults()
|
self.fill_in_defaults()
|
||||||
@ -97,6 +98,14 @@ class Settings(object):
|
|||||||
else:
|
else:
|
||||||
return os.path.expanduser('~/.config/onionshare/onionshare.json')
|
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):
|
def load(self):
|
||||||
"""
|
"""
|
||||||
Load the settings from file.
|
Load the settings from file.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user