sessions: drop support for .js sessions files

This commit is contained in:
jean-emmanuel 2018-04-06 17:40:24 +02:00
parent 1bde63ebcc
commit 7ac6bdefd4
3 changed files with 10 additions and 7 deletions

View file

@ -1,5 +1,12 @@
# Changelog
## 0.29.0
- beaking changes
- dropped supported for `.js` sessions (deprecated in 0.20.0)
- bug fixes
- zeroconf: unpublish when shutting down
## 0.28.3
- bug fixes

View file

@ -68,15 +68,11 @@ 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,
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)
session = JSON.parse(file)
} catch(err) {
error = err
}

View file

@ -164,7 +164,7 @@ var SessionManager = class SessionManager {
browse() {
upload('.json, .js', (path, result)=>{
upload('.json', (path, result)=>{
ipc.send('sessionOpen',{file:result,path:path})
}, ()=>{
new Popup({title:icon('exclamation-triangle')+'  Error', content: 'Failed to upload session file.', closable:true})