mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
transmission: Read configuration as super user
Due to permission restrictions on the configuration file (due to stored password), it is not possible to read it as plinth user. Read it using sudo instead.
This commit is contained in:
1 parent
522db2ce4c
commit
afdea208ec
4 files changed
+11
-8
No files matched your search
@@ -47,8 +47,6 @@ description = [
|
||||
|
||||
service = None
|
||||
|
||||
TRANSMISSION_CONFIG = '/etc/transmission-daemon/settings.json'
|
||||
|
||||
|
||||
def init():
|
||||
"""Intialize the Transmission module."""
|
||||
|
||||
@@ -42,7 +42,8 @@ class TransmissionServiceView(views.ServiceView):
|
||||
|
||||
def get_initial(self):
|
||||
"""Get the current settings from Transmission server."""
|
||||
configuration = open(transmission.TRANSMISSION_CONFIG, 'r').read()
|
||||
configuration = actions.superuser_run(
|
||||
'transmission', ['get-configuration'])
|
||||
status = json.loads(configuration)
|
||||
status = {key.translate(str.maketrans({'-': '_'})): value
|
||||
for key, value in status.items()}
|
||||
|
||||
Reference in new issue
Block a user