summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources/luci.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources/luci.js')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/luci.js38
1 files changed, 25 insertions, 13 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js
index 83c2807d77..23853e2cc8 100644
--- a/modules/luci-base/htdocs/luci-static/resources/luci.js
+++ b/modules/luci-base/htdocs/luci-static/resources/luci.js
@@ -672,12 +672,12 @@
* if it is an object, it will be converted to JSON, in all other
* cases it is converted to a string.
*
- * @property {Object<string, string>} [header]
- * Specifies HTTP headers to set for the request.
- *
- * @property {function} [progress]
- * An optional request callback function which receives ProgressEvent
- * instances as sole argument during the HTTP request transfer.
+ * @property {Object<string, string>} [header]
+ * Specifies HTTP headers to set for the request.
+ *
+ * @property {function} [progress]
+ * An optional request callback function which receives ProgressEvent
+ * instances as sole argument during the HTTP request transfer.
*/
/**
@@ -982,12 +982,13 @@
if (!Poll.active())
return;
+ var res_json = null;
try {
- callback(res, res.json(), res.duration);
- }
- catch (err) {
- callback(res, null, res.duration);
+ res_json = res.json();
}
+ catch (err) {}
+
+ callback(res, res_json, res.duration);
});
};
@@ -2553,10 +2554,16 @@
rpcBaseURL = Session.getLocalData('rpcBaseURL');
if (rpcBaseURL == null) {
+ var msg = {
+ jsonrpc: '2.0',
+ id: 'init',
+ method: 'list',
+ params: undefined
+ };
var rpcFallbackURL = this.url('admin/ubus');
- rpcBaseURL = Request.get(env.ubuspath).then(function(res) {
- return (rpcBaseURL = (res.status == 400) ? env.ubuspath : rpcFallbackURL);
+ rpcBaseURL = Request.post(env.ubuspath, msg, { nobatch: true }).then(function(res) {
+ return (rpcBaseURL = res.status == 200 ? env.ubuspath : rpcFallbackURL);
}, function() {
return (rpcBaseURL = rpcFallbackURL);
}).then(function(url) {
@@ -2965,7 +2972,12 @@
}).filter(function(e) {
return (e[1] != null);
}).sort(function(a, b) {
- return (a[1] > b[1]);
+ if (a[1] < b[1])
+ return -1;
+ else if (a[1] > b[1])
+ return 1;
+ else
+ return 0;
}).map(function(e) {
return e[0];
});