fixed so that JUCI works with vanilla rpcd by changing a call to session access to...
authorReidar Cederqvist <reidar.cederqvist@gmail.com>
Tue, 17 May 2016 15:24:00 +0000 (17:24 +0200)
committerSukru Senli <sukru.senli@inteno.se>
Tue, 28 Jun 2016 15:51:20 +0000 (17:51 +0200)
juci/src/js/rpc.js
plugins/juci-broadcom-ethernet/access.json
plugins/juci-broadcom-wl/access.json
plugins/juci-diagnostics/access.json
plugins/juci-natalie-dect/access.json
plugins/juci-netmode/access.json
plugins/juci-network-netifd/access.json
plugins/juci-sysupgrade/access.json
plugins/juci-usb/access.json

index 42847f0..8323121 100644 (file)
@@ -34,7 +34,7 @@
        var gettext = function(text){ return text; }; 
        
        var default_calls = [
-               "session.access", 
+               "session.list",
                "session.login", 
                "local.features", 
                "local.set_rpc_host"
@@ -85,9 +85,6 @@
 
                RPC_QUERY_IDS[jsonrpc_obj.id] = RPC_CACHE[key];
 
-               console.log("sending ");
-               console.log(jsonrpc_obj);
-
                ws.send(JSON.stringify(jsonrpc_obj));
 
                return RPC_CACHE[key].deferred.promise(); 
                                return deferred.promise(); 
                        }
 
-                       METHODS.session.access({
-                               "scope": "ubus" 
-                       }).done(function(result){
+                       METHODS.session.list().done(function(result){
                        if(!("username" in (result.data||{}))) {
                                        // username must be returned in the response. If it is not returned then rpcd is of wrong version. 
                                        //alert(gettext("You have been logged out due to inactivity")); 
                                        });
                                        deferred.resolve();
                                }).fail(function(){
-                                       console.log("ubus list failed");
                                        deferred.reject();
                                });
                        }).fail(function(emsg) {
                        var deferred = $.Deferred();
                        if(DEBUG_MODE)console.log("Init WS -> "+host);
                        host = host.replace(/^http/, 'ws');
-                       console.log("connecting to " + host);
+                       if(DEBUG_MODE)console.log("connecting to " + host);
                        try {
                                var ws = new WebSocket(host, "ubus-json");
                        } catch (exc) {
                        }
 
                        ws.onopen = function(ev) {
-                               console.log("Connected " + ws.readyState);
+                               if(DEBUG_MODE)console.log("Connected " + ws.readyState);
                                deferred.resolve(ws);
                        };
                        // response_should look like this:
                                        console.log("Warning: invalid json response recved: " + response_event.data);
                                        return;
                                }
-                               console.log("recved: ");
-                               console.log(response_obj);
 
                                if (response_obj.id && !response_obj.method) {
                                        var query_deferred = RPC_QUERY_IDS[response_obj.id];
                                                        default: return gettext("RPC error #")+call_result[0]+": "+call_result[1];
                                                        }
                                                }
-                                               if(DEBUG_MODE)console.log("RPC succeeded ("+object+"."+method+"), but returned error: "+_errstr(call_result[0]));
+                                               if(DEBUG_MODE)console.log("RPC succeeded "+ JSON.stringify(call_result) +", but returned error: "+_errstr(call_result[0]));
                                                query_deferred.deferred.reject(_errstr(call_result[0]));
                                                return;
                                        }
index f8bcd9a..a7b976e 100644 (file)
@@ -33,7 +33,8 @@
                        "uci": [
                                "layer2_interface_ethernet",
                                "ports"
-                       ]
+                       ],
+                       "owsd": [ "hotplug.switch" ]
                }, 
                "write": {
                        "uci": [
index 83f49d1..d12121c 100644 (file)
                                "hosts", 
                                "wireless",
                                "boardpanel"
+                       ],
+                       "owsd": [
+                               "wps",
+                               "wifi-repeater-success"
                        ]
                }
        }, 
index 7a7cb7f..7748ab1 100644 (file)
@@ -14,7 +14,8 @@
                        },
                        "uci": [
                                "speedtest"     
-                       ]
+                       ],
+                       "owsd": [ "juci.utils.speedtest" ]
                },
                "write": {
                        "uci": [
index b34f450..dd7c8a0 100644 (file)
@@ -12,7 +12,8 @@
                        },
                        "uci": [
                                "dect"
-                       ]
+                       ],
+                       "owsd": [ "ubus.object.add" ]
                },
                "write": {
                        "uci": [
index 540053a..ea52725 100644 (file)
@@ -14,7 +14,8 @@
                        }, 
                        "uci": [
                                "netmode"
-                       ]
+                       ],
+                       "owsd": [ "wifi-repeater-success" ]
                }, 
                "write": {
                        "uci": [
index 15dbfcd..e2d30d7 100644 (file)
                        "uci": [
                                "layer2_interface_ethernet", 
                                "network"
+                       ],
+                       "owsd": [
+                               "client",
+                               "network.interface"
                        ]
                }, 
                "write": {
index 76f011d..db7dcf8 100644 (file)
@@ -11,7 +11,8 @@
                                        /*"clean"*/
                                ]
                        }, 
-                       "uci": [ "system" ]
+                       "uci": [ "system" ],
+                       "owsd": { "sysupgrade-test"]
                }, 
                "write": {
                        "uci": [ "system" ],
index 4062b20..8705734 100644 (file)
                                        "run"
                                        /*"list"*/
                                ]
-                       }
+                       },
+                       "owsd": [
+                               "usb.device.add",
+                               "hotplug.usb"
+                       ]
                }
        }
 }