luci-app-transmission: fix service running check
authorJo-Philipp Wich <jo@mein.io>
Tue, 5 May 2020 22:27:10 +0000 (00:27 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 5 May 2020 22:27:42 +0000 (00:27 +0200)
Fixes: #3950
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
applications/luci-app-transmission/htdocs/luci-static/resources/view/transmission.js

index aecb4ecaa7699c447c5c6806800064eb8db05d30..f2c42ddba56a37709a5a41414559e79be98444f4 100644 (file)
@@ -10,7 +10,7 @@ var callServiceList = rpc.declare({
        object: 'service',
        method: 'list',
        params: [ 'name' ],
-       expect: { '': {} }
+       expect: { 'transmission': {} }
 });
 
 function setFlagBool(o) {
@@ -29,11 +29,7 @@ return view.extend({
        render: function(res) {
                var port = uci.get_first('transmission', 'transmission', 'rpc_port') || '9091';
 
-               var instances = {};
-               try {
-                       instances = res[0]['transmission']['instances'];
-               } catch (e) {}
-               var running = instances.length > 0;
+               var running = Object.keys(res[0].instances || {}).length > 0;
 
                var webinstalled = res[1] || !!uci.get_first('transmission', 'transmission', 'web_home');