diff --git a/example.js b/example.js index 219a8fc..e516377 100644 --- a/example.js +++ b/example.js @@ -7,13 +7,19 @@ OBJY.define({ authable: true }) +OBJY.define({ + name: "object", + pluralName: "objects" +}) + +OBJY.client('spoo'); + +OBJY.object({name: "hello"}).add(); + var P = SPOO.REST({ port: 80, OBJY, - scriptContext: { - objects: function(){console.log(',,,')} - }, extensions: [{ route: '/:entity/:id/property/:propName/call', authable: true, diff --git a/interface/rest.js b/interface/rest.js index 72e6c1a..cf7ac4d 100644 --- a/interface/rest.js +++ b/interface/rest.js @@ -519,9 +519,13 @@ Platform = function(SPOO, OBJY, options) { } var _context = { - done: done + done: done, + OBJY: OBJY }; + OBJY.client=function(){}; + OBJY.useUser=function(){}; + Object.assign(_context, options.scriptContext || {}); var script = new vm.Script(script); @@ -533,7 +537,6 @@ Platform = function(SPOO, OBJY, options) { }); - router.route(['/client/:client/application']) .post(checkAuthentication, function(req, res) { @@ -930,7 +933,6 @@ Platform = function(SPOO, OBJY, options) { redis.get('cnt_' + req.body.username, function(err, result) { - if (result !== null) { if (parseInt(result) >= (options.maxUserSessions || defaultMaxUserSessions)) { res.status(401) diff --git a/package.json b/package.json index 93f9d74..66a0fc4 100644 --- a/package.json +++ b/package.json @@ -48,5 +48,5 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "version": "0.9.952" + "version": "0.9.953" }