add per-user routes and methods
This commit is contained in:
12
app.coffee
12
app.coffee
@@ -42,8 +42,8 @@ app.param 'project_id', (req, res, next, project_id) ->
|
||||
else
|
||||
next new Error("invalid project id")
|
||||
|
||||
app.param 'user_id', (req, res, next, project_id) ->
|
||||
if project_id?.match /^[a-zA-Z0-9_-]+$/
|
||||
app.param 'user_id', (req, res, next, user_id) ->
|
||||
if user_id?.match /^[0-9a-f]{24}$/
|
||||
next()
|
||||
else
|
||||
next new Error("invalid user id")
|
||||
@@ -63,6 +63,14 @@ app.get "/project/:project_id/sync/pdf", CompileController.syncFromPdf
|
||||
app.get "/project/:project_id/wordcount", CompileController.wordcount
|
||||
app.get "/project/:project_id/status", CompileController.status
|
||||
|
||||
# Per-user containers
|
||||
app.post "/project/:project_id/user/:user_id/compile", bodyParser.json(limit: "5mb"), CompileController.compile
|
||||
# app.delete "/project/:project_id/user/:user_id", CompileController.clearCache
|
||||
|
||||
app.get "/project/:project_id/user/:user_id/sync/code", CompileController.syncFromCode
|
||||
app.get "/project/:project_id/user/:user_id/sync/pdf", CompileController.syncFromPdf
|
||||
app.get "/project/:project_id/user/:user_id/wordcount", CompileController.wordcount
|
||||
|
||||
ForbidSymlinks = require "./app/js/StaticServerForbidSymlinks"
|
||||
|
||||
# create a static server which does not allow access to any symlinks
|
||||
|
||||
Reference in New Issue
Block a user