mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
deluge: Allow to set a download directory
- add directory selection form to the app configuration page - add debian-deluged user to the freedombox-share group - storage: new validator parameter check-creatable (because deluged is able to create subdirectories) Signed-off-by: Veiko Aasa <veiko17@disroot.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
e217a4c87e
commit
8e698987de
8 files changed
+195
-17
No files matched your search
@@ -60,14 +60,18 @@ def is_module_enabled(name):
|
||||
class DirectoryValidator:
|
||||
username = None
|
||||
check_writable = False
|
||||
check_creatable = False
|
||||
add_user_to_share_group = False
|
||||
service_to_restart = None
|
||||
|
||||
def __init__(self, username=None, check_writable=None):
|
||||
def __init__(self, username=None, check_writable=None,
|
||||
check_creatable=None):
|
||||
if username is not None:
|
||||
self.username = username
|
||||
if check_writable is not None:
|
||||
self.check_writable = check_writable
|
||||
if check_creatable is not None:
|
||||
self.check_creatable = check_creatable
|
||||
|
||||
def __call__(self, value):
|
||||
"""Validate a directory."""
|
||||
@@ -75,7 +79,9 @@ class DirectoryValidator:
|
||||
raise ValidationError(_('Invalid directory name.'), 'invalid')
|
||||
|
||||
command = ['validate-directory', '--path', value]
|
||||
if self.check_writable:
|
||||
if self.check_creatable:
|
||||
command.append('--check-creatable')
|
||||
elif self.check_writable:
|
||||
command.append('--check-writable')
|
||||
|
||||
if self.username:
|
||||
|
||||
Reference in new issue
Block a user