diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-09-09 11:09:18 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-10 15:29:15 +0200 |
commit | 5dc61be74636c9c643f83ed146545db07c3b20cd (patch) | |
tree | 5c11cef148322e9ec56be897de13d28b382d0267 /modules/luci-base/htdocs | |
parent | 9cae3b9e67aef68cd579213bee1865ce1b815027 (diff) |
luci-base: replace luci/getHostname with generic file/read rpc operation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js b/modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js index b0b65974a8..f0a3ec579c 100644 --- a/modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js +++ b/modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js @@ -3,10 +3,12 @@ 'require form'; 'require network'; -var callHostname = rpc.declare({ - object: 'luci', - method: 'getHostname', - expect: { result: '' } +var callFileRead = rpc.declare({ + object: 'file', + method: 'read', + params: [ 'path' ], + expect: { data: '' }, + filter: function(value) { return value.trim() } }); return network.registerProtocol('dhcp', { @@ -20,7 +22,7 @@ return network.registerProtocol('dhcp', { o = s.taboption('general', form.Value, 'hostname', _('Hostname to send when requesting DHCP')); o.datatype = 'hostname'; o.load = function(section_id) { - return callHostname().then(L.bind(function(hostname) { + return callFileRead('/proc/sys/kernel/hostname').then(L.bind(function(hostname) { this.placeholder = hostname; return form.Value.prototype.load.apply(this, [section_id]); }, this)); |