mirror of
https://github.com/openwrt/luci
synced 2025-01-08 12:08:04 +08:00
treewide: declare rpc calls with const
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
This commit is contained in:
parent
2ffaab3fca
commit
e1d8f0e6f9
@ -27,31 +27,31 @@ var pkg = {
|
||||
},
|
||||
};
|
||||
|
||||
var getFileUrlFilesizes = rpc.declare({
|
||||
const getFileUrlFilesizes = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getFileUrlFilesizes",
|
||||
params: ["name", "url"],
|
||||
});
|
||||
|
||||
var getInitList = rpc.declare({
|
||||
const getInitList = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getInitList",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var getInitStatus = rpc.declare({
|
||||
const getInitStatus = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getInitStatus",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var getPlatformSupport = rpc.declare({
|
||||
const getPlatformSupport = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getPlatformSupport",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var _setInitAction = rpc.declare({
|
||||
const _setInitAction = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "setInitAction",
|
||||
params: ["name", "action"],
|
||||
|
@ -8,7 +8,7 @@
|
||||
'require validation';
|
||||
'require view';
|
||||
|
||||
var callServiceList = rpc.declare({
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
|
@ -4,7 +4,7 @@
|
||||
'require form';
|
||||
'require poll';
|
||||
|
||||
var callApingerStatus = rpc.declare({
|
||||
const callApingerStatus = rpc.declare({
|
||||
object: 'apinger',
|
||||
method: 'status',
|
||||
expect: { },
|
||||
|
@ -9,17 +9,17 @@
|
||||
'require dom';
|
||||
'require fs';
|
||||
|
||||
let callPackagelist = rpc.declare({
|
||||
const callPackagelist = rpc.declare({
|
||||
object: 'rpc-sys',
|
||||
method: 'packagelist',
|
||||
});
|
||||
|
||||
let callSystemBoard = rpc.declare({
|
||||
const callSystemBoard = rpc.declare({
|
||||
object: 'system',
|
||||
method: 'board',
|
||||
});
|
||||
|
||||
let callUpgradeStart = rpc.declare({
|
||||
const callUpgradeStart = rpc.declare({
|
||||
object: 'rpc-sys',
|
||||
method: 'upgrade_start',
|
||||
params: ['keep'],
|
||||
|
@ -8,7 +8,7 @@
|
||||
'require rpc';
|
||||
'require view';
|
||||
|
||||
var callServiceList = rpc.declare({
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
|
@ -63,7 +63,7 @@ These are the changes you need in the `rpc.js` file.
|
||||
Declare the RPC call
|
||||
|
||||
```js
|
||||
var load_sample_yaml = rpc.declare({
|
||||
const load_sample_yaml = rpc.declare({
|
||||
object: 'luci.example',
|
||||
method: 'get_yaml_file_sample'
|
||||
});
|
||||
|
@ -15,7 +15,7 @@ in that directory will be the value for the object key in the declared map.
|
||||
Permissions to make these calls must be granted in /usr/share/rpcd/acl.d
|
||||
via a file named the same as the application package name (luci-app-example)
|
||||
*/
|
||||
var load_sample2 = rpc.declare({
|
||||
const load_sample2 = rpc.declare({
|
||||
object: 'luci.example',
|
||||
method: 'get_sample2'
|
||||
});
|
||||
|
@ -15,7 +15,7 @@ in that directory will be the value for the object key in the declared map.
|
||||
Permissions to make these calls must be granted in /usr/share/rpcd/acl.d
|
||||
via a file named the same as the application package name (luci-app-example)
|
||||
*/
|
||||
var load_sample2 = rpc.declare({
|
||||
const load_sample2 = rpc.declare({
|
||||
object: 'luci.example',
|
||||
method: 'get_sample2'
|
||||
});
|
||||
|
@ -15,13 +15,13 @@ in that directory will be the value for the object key in the declared map.
|
||||
Permissions to make these calls must be granted in /usr/share/rpcd/acl.d
|
||||
via a file named the same as the application package name (luci-app-example)
|
||||
*/
|
||||
var load_sample1 = rpc.declare({
|
||||
const load_sample1 = rpc.declare({
|
||||
object: 'luci.example',
|
||||
method: 'get_sample1'
|
||||
});
|
||||
// Out of the box, this one will be blocked by the framework because there is
|
||||
// no ACL granting permission.
|
||||
var load_sample3 = rpc.declare({
|
||||
const load_sample3 = rpc.declare({
|
||||
object: 'luci.example',
|
||||
method: 'get_sample3'
|
||||
});
|
||||
|
@ -138,7 +138,7 @@ function defOpts(s, opts, params) {
|
||||
}
|
||||
}
|
||||
|
||||
var callServiceList = rpc.declare({
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
|
@ -91,7 +91,7 @@ function defOpts(s, opts, params) {
|
||||
}
|
||||
}
|
||||
|
||||
var callServiceList = rpc.declare({
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
|
@ -43,37 +43,37 @@ var pkg = {
|
||||
},
|
||||
};
|
||||
|
||||
var getInitList = rpc.declare({
|
||||
const getInitList = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getInitList",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var getInitStatus = rpc.declare({
|
||||
const getInitStatus = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getInitStatus",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var getPlatformSupport = rpc.declare({
|
||||
const getPlatformSupport = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getPlatformSupport",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var getProviders = rpc.declare({
|
||||
const getProviders = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getProviders",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var getRuntime = rpc.declare({
|
||||
const getRuntime = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getRuntime",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var _setInitAction = rpc.declare({
|
||||
const _setInitAction = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "setInitAction",
|
||||
params: ["name", "action"],
|
||||
|
@ -5,7 +5,7 @@
|
||||
'require rpc';
|
||||
'require poll';
|
||||
|
||||
var callKeepalivedStatus = rpc.declare({
|
||||
const callKeepalivedStatus = rpc.declare({
|
||||
object: 'keepalived',
|
||||
method: 'dump',
|
||||
expect: { },
|
||||
|
@ -3,7 +3,7 @@
|
||||
'require uci';
|
||||
'require rpc';
|
||||
|
||||
var callKeepalivedStatus = rpc.declare({
|
||||
const callKeepalivedStatus = rpc.declare({
|
||||
object: 'keepalived',
|
||||
method: 'dump',
|
||||
expect: { },
|
||||
|
@ -4,7 +4,7 @@
|
||||
'require uci';
|
||||
'require form';
|
||||
|
||||
var callUSB = rpc.declare({
|
||||
const callUSB = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getUSBDevices',
|
||||
expect: { 'ports': [] }
|
||||
|
@ -4,7 +4,7 @@
|
||||
'require form';
|
||||
'require poll';
|
||||
|
||||
var callLibreswanStatus = rpc.declare({
|
||||
const callLibreswanStatus = rpc.declare({
|
||||
object: 'libreswan',
|
||||
method: 'status',
|
||||
expect: { },
|
||||
|
@ -13,7 +13,7 @@
|
||||
'require uci';
|
||||
'require tools.widgets as widgets';
|
||||
|
||||
var callInitList = rpc.declare({
|
||||
const callInitList = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getInitList',
|
||||
params: [ 'name' ],
|
||||
@ -25,7 +25,7 @@ var callInitList = rpc.declare({
|
||||
}
|
||||
});
|
||||
|
||||
var callInitAction = rpc.declare({
|
||||
const callInitAction = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'setInitAction',
|
||||
params: [ 'name', 'action' ],
|
||||
|
@ -12,7 +12,7 @@
|
||||
'require dom';
|
||||
'require poll';
|
||||
|
||||
var callLLDPStatus = rpc.declare({
|
||||
const callLLDPStatus = rpc.declare({
|
||||
object: 'luci.lldpd',
|
||||
method: 'getStatus',
|
||||
expect: {}
|
||||
|
@ -3,7 +3,7 @@
|
||||
'require view';
|
||||
'require rpc';
|
||||
|
||||
var callMwan3Status = rpc.declare({
|
||||
const callMwan3Status = rpc.declare({
|
||||
object: 'mwan3',
|
||||
method: 'status',
|
||||
expect: { },
|
||||
|
@ -2,7 +2,7 @@
|
||||
'require baseclass';
|
||||
'require rpc';
|
||||
|
||||
var callMwan3Status = rpc.declare({
|
||||
const callMwan3Status = rpc.declare({
|
||||
object: 'mwan3',
|
||||
method: 'status',
|
||||
expect: { },
|
||||
|
@ -5,7 +5,7 @@
|
||||
'require view';
|
||||
'require tools.widgets as widgets';
|
||||
|
||||
var callServiceList = rpc.declare({
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
|
@ -7,7 +7,7 @@
|
||||
'require rpc';
|
||||
'require dom';
|
||||
|
||||
var callNetworkRrdnsLookup = rpc.declare({
|
||||
const callNetworkRrdnsLookup = rpc.declare({
|
||||
object: 'network.rrdns',
|
||||
method: 'lookup',
|
||||
params: [ 'addrs', 'timeout', 'limit' ],
|
||||
|
@ -3,13 +3,13 @@
|
||||
'require view';
|
||||
'require poll';
|
||||
|
||||
var getOlsrd4Services = rpc.declare({
|
||||
const getOlsrd4Services = rpc.declare({
|
||||
object: 'olsr-services',
|
||||
method: 'services4',
|
||||
expect: {}
|
||||
});
|
||||
|
||||
var getOlsrd6Services = rpc.declare({
|
||||
const getOlsrd6Services = rpc.declare({
|
||||
object: 'olsr-services',
|
||||
method: 'services6',
|
||||
expect: {}
|
||||
|
@ -87,7 +87,7 @@ var css = ' \
|
||||
|
||||
var isReadonlyView = !L.hasViewPermission() || null;
|
||||
|
||||
var callMountPoints = rpc.declare({
|
||||
const callMountPoints = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getMountPoints',
|
||||
expect: { result: [] }
|
||||
|
@ -32,37 +32,37 @@ var pkg = {
|
||||
},
|
||||
};
|
||||
|
||||
var getGateways = rpc.declare({
|
||||
const getGateways = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getGateways",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var getInitList = rpc.declare({
|
||||
const getInitList = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getInitList",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var getInitStatus = rpc.declare({
|
||||
const getInitStatus = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getInitStatus",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var getInterfaces = rpc.declare({
|
||||
const getInterfaces = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getInterfaces",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var getPlatformSupport = rpc.declare({
|
||||
const getPlatformSupport = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "getPlatformSupport",
|
||||
params: ["name"],
|
||||
});
|
||||
|
||||
var _setInitAction = rpc.declare({
|
||||
const _setInitAction = rpc.declare({
|
||||
object: "luci." + pkg.Name,
|
||||
method: "setInitAction",
|
||||
params: ["name", "action"],
|
||||
|
@ -5,7 +5,7 @@
|
||||
'require tools.widgets as widgets';
|
||||
'require view';
|
||||
|
||||
var callHostHints = rpc.declare({
|
||||
const callHostHints = rpc.declare({
|
||||
object: 'luci-rpc',
|
||||
method: 'getHostHints',
|
||||
expect: { '': {} }
|
||||
|
@ -27,7 +27,7 @@
|
||||
'require ui';
|
||||
|
||||
var conf = 'smartdns';
|
||||
var callServiceList = rpc.declare({
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
|
@ -6,7 +6,7 @@
|
||||
'require uci';
|
||||
'require view';
|
||||
|
||||
var getCompileTimeOptions = rpc.declare({
|
||||
const getCompileTimeOptions = rpc.declare({
|
||||
object: 'luci.squid',
|
||||
method: 'getCompileTimeOptions',
|
||||
expect: { options: [] }
|
||||
|
@ -4,7 +4,7 @@
|
||||
'require rpc';
|
||||
'require uci';
|
||||
|
||||
var callTorHsList = rpc.declare({
|
||||
const callTorHsList = rpc.declare({
|
||||
object: 'tor-hs-rpc',
|
||||
method: 'list-hs',
|
||||
});
|
||||
|
@ -6,7 +6,7 @@
|
||||
'require form';
|
||||
'require tools.widgets as widgets';
|
||||
|
||||
var callServiceList = rpc.declare({
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: [ 'name' ],
|
||||
|
@ -170,7 +170,7 @@ function collectWlanAPInfos(compactconnectioninfo_table_entries, wlanAPInfos) {
|
||||
}
|
||||
};
|
||||
|
||||
var callNetworkRrdnsLookup = rpc.declare({
|
||||
const callNetworkRrdnsLookup = rpc.declare({
|
||||
object: 'network.rrdns',
|
||||
method: 'lookup',
|
||||
params: [ 'addrs', 'timeout', 'limit' ],
|
||||
|
@ -5,7 +5,7 @@
|
||||
'require uci';
|
||||
'require view';
|
||||
|
||||
var callServiceList = rpc.declare({
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
|
@ -11,7 +11,7 @@
|
||||
var RefreshIfaces = "";
|
||||
var RefreshTabs = ['s', 't', '5', 'h', 'd', 'm', 'y'];
|
||||
|
||||
var callServiceList = rpc.declare({
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: [ 'name' ],
|
||||
|
@ -5,7 +5,7 @@
|
||||
'require rpc';
|
||||
'require tools.widgets as widgets';
|
||||
|
||||
var callServiceList = rpc.declare({
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
|
Loading…
Reference in New Issue
Block a user