Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Workspace(options, events) {
options = _.defaults({}, options, {
'id': null,
'secret': uuid.v4(),
'name': 'codebox',
'public': true,
'root': "./",
'maxUsers': 100
});
// Public ID of workspace (ok to share)
this.id = options.id || crc.hex32(crc.crc32(options.root));
// Secret token used for securing cookies, sessions ...
this.secret = options.secret;
// Name
this.name = options.name;
// Public
this.public = options.public;
// Base folder
this.root = options.root;
// Mapping of users
this._users = {};
this.maxUsers = options.maxUsers;
.then(function(installedAddons) {
var revision = pkg.version+"-"+crc.hex32(crc.crc32(_.map(installedAddons, function(addon, addonName) {
return addonName+":"+addon.infos.version;
}).sort().join("-")));
if (options.dev) revision = revision+"-"+startTime;
// Clear manifest
return manifest.clear(revision);
})
.then(function() {
// Packages
'packages': {
// Path to store all packages for the user
'root': undefined,
// Path to default packages
'defaults': path.resolve(__dirname, "../../packages"),
// Packages to install when booting
'install': {}
}
}, _.defaults);
// Unique id for workspace
options.id = options.id || crc.hex32(crc.crc32(options.root))
return options;
};
function _createEtag(req) {
return (crc.hex32(crc.crc32(req._value)));
}
function hash(str) {
return crc.hex32(crc.crc32(str));
}