diff options
Diffstat (limited to 'modules')
3 files changed, 9 insertions, 5 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/fs.js b/modules/luci-base/htdocs/luci-static/resources/fs.js index 6eb0390909..8a96ea87e2 100644 --- a/modules/luci-base/htdocs/luci-static/resources/fs.js +++ b/modules/luci-base/htdocs/luci-static/resources/fs.js @@ -50,7 +50,7 @@ callFileRead = rpc.declare({ callFileWrite = rpc.declare({ object: 'file', method: 'write', - params: [ 'path', 'data' ] + params: [ 'path', 'data', 'mode' ] }); callFileRemove = rpc.declare({ @@ -177,13 +177,17 @@ var FileSystem = L.Class.extend(/** @lends LuCI.fs.prototype */ { * The file data to write. If it is null, it will be set to an empty * string. * + * @param {number} [mode] + * The permissions to use on file creation. Default is 420 (0644). + * * @returns {Promise<number>} * Returns a promise resolving to `0` or rejecting with an error stating * the failure reason. */ - write: function(path, data) { + write: function(path, data, mode) { data = (data != null) ? String(data) : ''; - return callFileWrite(path, data).then(handleRpcReply.bind(this, { '': 0 })); + mode = (mode != null) ? mode : 420; // 0644 + return callFileWrite(path, data, mode).then(handleRpcReply.bind(this, { '': 0 })); }, /** diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js index d18246b6be..612c4a4f92 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js @@ -517,7 +517,7 @@ return L.view.extend({ o.forcewrite = true; o.rows = 30; o.load = function(section_id) { - return fs.read('/etc/sysupgrade.conf', ''); + return L.resolveDefault(fs.read('/etc/sysupgrade.conf'), ''); }; diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/sshkeys.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/sshkeys.js index 84a1d64878..05d41b0dde 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/sshkeys.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/sshkeys.js @@ -117,7 +117,7 @@ function renderKeys(keys) { } function saveKeys(keys) { - return fs.write('/etc/dropbear/authorized_keys', keys.join('\n') + '\n') + return fs.write('/etc/dropbear/authorized_keys', keys.join('\n') + '\n', 384 /* 0600 */) .then(renderKeys.bind(this, keys)) .catch(function(e) { L.ui.addNotification(null, E('p', e.message)) }) .finally(L.ui.hideModal); |