Successfully launched vanilla minecraft, however much code cleanup is pending.

This commit is contained in:
Daniel Scalzi
2017-04-29 20:33:32 -04:00
parent b01f652d8c
commit d4caf1ad22
6 changed files with 128 additions and 52 deletions

37
app/assets/js/library.js Normal file
View File

@@ -0,0 +1,37 @@
exports.mojangFriendlyOS = function(){
const opSys = process.platform
if (opSys === 'darwin') {
return 'osx';
} else if (opSys === 'win32'){
return 'windows';
} else if (opSys === 'linux'){
return 'linux';
} else {
return 'unknown_os';
}
}
exports.validateRules = function(rules){
if(rules == null) return true
let result = true
rules.forEach(function(rule){
const action = rule['action']
const osProp = rule['os']
if(action != null){
if(osProp != null){
const osName = osProp['name']
const osMoj = exports.mojangFriendlyOS()
if(action === 'allow'){
result = osName === osMoj
return
} else if(action === 'disallow'){
result = osName !== osMoj
return
}
}
}
})
return result
}