client options
This commit is contained in:
parent
e1eb6b5df1
commit
ec7147a9de
8 changed files with 38 additions and 32 deletions
|
|
@ -70,6 +70,7 @@ module.exports = function(options={}) {
|
|||
|
||||
if (process.platform !== 'darwin') {
|
||||
// already registered in app menu on macOs
|
||||
// ISSUE seems to bind ctrl+z as well (FR keyboard ?)
|
||||
shortcut.register(window,'CmdOrCtrl+W',function(){
|
||||
window.close()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ function openClient() {
|
|||
|
||||
var app = require('./electron-app')
|
||||
var address = settings.read('appAddresses')[0]
|
||||
address += settings.read('urlOptions')
|
||||
|
||||
var launch = ()=>{
|
||||
var win = require('./electron-window')({address:address, shortcuts:true, fullscreen: settings.read('fullScreen')})
|
||||
|
|
|
|||
|
|
@ -37,28 +37,18 @@ module.exports = {
|
|||
},
|
||||
'm':{alias:'midi',type:'array',describe:'midi router settings'},
|
||||
'd':{alias:'debug',type:'boolean',describe:'log received osc messages in the console'},
|
||||
'n':{alias:'no-gui',type:'boolean',describe:'disable default gui',
|
||||
check: (n,argv)=>{
|
||||
return (!n || !argv.g) ?
|
||||
true : 'no-gui and gui-only can\'s be enabled simultaneously'
|
||||
}
|
||||
},
|
||||
'n':{alias:'no-gui',type:'boolean',describe:'disable default gui'},
|
||||
't':{alias:'theme',type:'array',describe:'theme name or path (mutliple values allowed)'},
|
||||
'url-options':{type:'array',describe:'url options (opt=value pairs)',
|
||||
check: (u, argv)=>{
|
||||
return (!u || !argv.n) ?
|
||||
true : 'url options can\'t be passed in no-gui mode'
|
||||
'client-options':{type:'array',describe:'client options (opt=value pairs)',
|
||||
check: (o)=>{
|
||||
return o.some(item=>!item.match(/^[^=]*=[^=]*$/)) ?
|
||||
'Options must be key=value pairs' : true
|
||||
}
|
||||
},
|
||||
'disable-vsync':{type:'boolean',describe:'disable gui\'s vertical synchronization', restart: true},
|
||||
// 'disable-gpu':{type:'boolean',describe:'disable hardware acceleration', restart: true},
|
||||
'force-gpu':{type:'boolean',describe:'ignore chrome\'s gpu blacklist', restart: true},
|
||||
'read-only':{type:'boolean',describe:'disable session editing and session history changes',
|
||||
check: (r, argv)=>{
|
||||
return (!r || !argv.b) ?
|
||||
true : 'blank session can\'t be started in read-only mode'
|
||||
}
|
||||
},
|
||||
'read-only':{type:'boolean',describe:'disable session editing and session history changes'},
|
||||
'remote-saving':{type:'string',describe:'disable remote session saving for hosts that don\'t match the regular expresion',
|
||||
check: (r, argv)=>{
|
||||
var msg = true
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ var urlparser = require('url'),
|
|||
fs = require('fs'),
|
||||
send = require('send'),
|
||||
http = require('http'),
|
||||
replaceStream = require('replacestream'),
|
||||
server = http.createServer(httpRoute),
|
||||
Ipc = require('./ipc/server'),
|
||||
ipc = new Ipc(server),
|
||||
|
|
@ -19,14 +20,19 @@ function httpRoute(req, res) {
|
|||
res.sendFile = (path)=>{
|
||||
var fpath = path.split('?')[0]
|
||||
if (!fs.existsSync(fpath)) throw `File "${fpath}" not found.`
|
||||
send(req, fpath).pipe(res)
|
||||
return send(req, fpath).pipe(res)
|
||||
}
|
||||
|
||||
var url = req.url
|
||||
|
||||
if (url === '/' || url.indexOf('/?') === 0) {
|
||||
|
||||
res.sendFile(path.resolve(__dirname + '/../client/index.html'))
|
||||
fs.createReadStream(path.resolve(__dirname + '/../client/index.html'))
|
||||
.pipe(replaceStream('</body>', `<script>window.ENV=${JSON.stringify(settings.read('clientOptions'))}</script></body>`))
|
||||
.pipe(res);
|
||||
|
||||
// res.sendFile(path.resolve(__dirname + '/../client/index.html'))
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,15 @@ var makeDefaultConfig = function(argv){
|
|||
fullScreen: argv['fullscreen'] || false,
|
||||
noGui: argv['no-gui'] || false,
|
||||
guiOnly: typeof argv['gui-only'] == 'string' ? argv['gui-only'].length ? argv['gui-only'] : true : false,
|
||||
urlOptions: argv['url-options'] ? '?' + argv['url-options'].join('&') : '',
|
||||
clientOptions: argv['client-options'] ? (function(){
|
||||
var opts = {}
|
||||
for (var o of argv['client-options']) {
|
||||
if (!o.includes('=')) continue
|
||||
var [k, v] = o.split('=')
|
||||
opts[k] = v
|
||||
}
|
||||
return opts
|
||||
})() : false,
|
||||
noVsync: argv['disable-vsync'] || false,
|
||||
noGpu: argv['disable-gpu'] || false,
|
||||
forceGpu: argv['force-gpu'] || false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue