main: add --remote-saving for limiting clients remote session saving rights
This commit is contained in:
parent
c83414daf0
commit
7875344e0e
5 changed files with 12 additions and 2 deletions
|
|
@ -32,6 +32,7 @@ Below are the available command-line options. Note that when running without any
|
|||
| |`--disable-vsync` | disable gui's vertical synchronization |
|
||||
| |`--disable-gpu` | disable hardware acceleration |
|
||||
| |`--read-only` | disable session editing and session history changes |
|
||||
| |`--remote-saving` | disable remote session saving for hosts that don\'t match the regular expresion |
|
||||
| |`--instance-name` | used to differenciate multiple instances in a zeroconf network |
|
||||
| |`--fullscreen` | launch in fullscreen mode (only affects the default gui, F11 to exit) |
|
||||
|
||||
|
|
|
|||
|
|
@ -116,6 +116,10 @@ module.exports = {
|
|||
|
||||
sessionSetPath: function(data, clientId) {
|
||||
|
||||
if (settings.read('remoteSaving') && !RegExp(settings.read('remoteSaving')).test(ipc.clients[clientId].address)) {
|
||||
return
|
||||
}
|
||||
|
||||
ipc.clients[clientId].sessionPath = ''
|
||||
fs.lstat(data.path, (err, stats)=>{
|
||||
if (err || !stats.isFile()) return
|
||||
|
|
|
|||
|
|
@ -6,11 +6,14 @@ var hearbeatInterval = 25000,
|
|||
|
||||
class Socket extends EventEmitter {
|
||||
|
||||
constructor(ws, id) {
|
||||
constructor(ws, id, address) {
|
||||
|
||||
super()
|
||||
|
||||
this.id = id
|
||||
|
||||
this.address = address.indexOf('::ffff:') === 0 ? address.replace('::ffff:', '') : address
|
||||
|
||||
this.socket = null
|
||||
|
||||
this.sessionPath = ''
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class Ipc extends EventEmitter {
|
|||
|
||||
if (!this.clients[id]) {
|
||||
|
||||
var client = new Client(socket, id)
|
||||
var client = new Client(socket, id, req.connection.remoteAddress)
|
||||
this.clients[id] = client
|
||||
|
||||
this.emit('connection', client)
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ var options = {
|
|||
true : 'blank session can\'t be started in read-only mode'
|
||||
}
|
||||
},
|
||||
'remote-saving':{type:'string',describe:'disable remote session saving for hosts that don\'t match the regular expresion'},
|
||||
'instance-name':{type:'string',describe:'used to differenciate multiple instances in a zeroconf network'},
|
||||
'fullscreen':{type:'boolean', describe:'launch in fullscreen mode (only affects the default gui, F11 to exit)'}
|
||||
}
|
||||
|
|
@ -144,6 +145,7 @@ var makeDefaultConfig = function(argv){
|
|||
noVsync: argv['disable-vsync'] || false,
|
||||
noGpu: argv['disable-gpu'] || false,
|
||||
readOnly: argv['read-only'] || false,
|
||||
remoteSaving: argv['remote-saving'] || false,
|
||||
midi: argv['midi'],
|
||||
stateFile: (function(){
|
||||
if (!argv['state']) return false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue