launcher: accept json session files and print a deprecation warning in the console (issue #101)
This commit is contained in:
parent
2a319b85fb
commit
a941ac621b
3 changed files with 8 additions and 3 deletions
|
|
@ -63,10 +63,15 @@ module.exports = {
|
|||
},
|
||||
|
||||
sessionOpen: function(data,clientId) {
|
||||
|
||||
var file = data.file || (function(){try {return fs.readFileSync(data.path,'utf8')} catch(err) {return false}})(),
|
||||
error = file===false&&data.path?'Session file "' + data.path + '" not found.':false,
|
||||
session
|
||||
|
||||
if (data.path && data.path.split('.').pop() == 'js') {
|
||||
console.warn(`Warning: support for .js session files is deprecated, please use the .json extension instead`)
|
||||
}
|
||||
|
||||
try {
|
||||
session = vm.runInNewContext(file)
|
||||
} catch(err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue