Skip to content

Commit

Permalink
update validation to use proper package types
Browse files Browse the repository at this point in the history
  • Loading branch information
quartzjer committed Jan 16, 2012
1 parent 87ac7c1 commit 2e63656
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Ops/registry.js
Expand Up @@ -76,8 +76,11 @@ exports.app = function(app)
app.get('/registry/add/:id', function(req, res) {
logger.info("registry trying to add "+req.params.id);
if(!regIndex[req.params.id]) return res.send("not found", 404);
if(!verify(regIndex[req.params.id])) return res.send("invalid app", 500);
exports.install({name:req.params.id}, function(){ res.send(true); });
if(!verify(regIndex[req.params.id])) return res.send("invalid package", 500);
exports.install({name:req.params.id}, function(err){
if(err) return res.send(err, 500);
res.send(true);
});
});
app.get('/registry/apps', function(req, res) {
res.send(exports.getApps());
Expand Down Expand Up @@ -187,8 +190,9 @@ function verify(pkg)
{
if(!pkg) return false;
if(!pkg.repository) return false;
if(!pkg.repository.static) return false;
if(pkg.repository.static === true || pkg.repository.static === "true") return true;
if(pkg.repository.type == 'app') return true;
if(pkg.repository.type == 'connector') return true;
if(pkg.repository.type == 'collection') return true;
return false;
}

Expand Down

0 comments on commit 2e63656

Please sign in to comment.