mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-25 06:21:04 +00:00
scaffolding project size
This commit is contained in:
parent
8ddfbb99de
commit
099d0fef2f
3 changed files with 25 additions and 0 deletions
|
@ -85,6 +85,8 @@ app.post "/project/:project_id/public/:public_file_id", keyBuilder.publicFileKey
|
|||
app.put "/project/:project_id/public/:public_file_id", keyBuilder.publicFileKey, express.bodyParser(), fileController.copyFile
|
||||
app.del "/project/:project_id/public/:public_file_id", keyBuilder.publicFileKey, fileController.deleteFile
|
||||
|
||||
app.get "project/:project_id/size", keyBuilder.publicProjectKey, projectController.projectSize
|
||||
|
||||
app.get "/heapdump", (req, res)->
|
||||
require('heapdump').writeSnapshot '/tmp/' + Date.now() + '.filestore.heapsnapshot', (err, filename)->
|
||||
res.send filename
|
||||
|
|
|
@ -42,4 +42,9 @@ module.exports =
|
|||
opts = req.query
|
||||
next()
|
||||
|
||||
publicProjectKey: (req, res, next)->
|
||||
{project_id} = req.params
|
||||
req.project_id = project_id
|
||||
req.bucket = settings.filestore.stores.user_files
|
||||
next()
|
||||
|
||||
|
|
18
services/filestore/app/coffee/ProjectController.coffee
Normal file
18
services/filestore/app/coffee/ProjectController.coffee
Normal file
|
@ -0,0 +1,18 @@
|
|||
settings = require("settings-sharelatex")
|
||||
logger = require("logger-sharelatex")
|
||||
metrics = require("metrics-sharelatex")
|
||||
Errors = require('./Errors')
|
||||
|
||||
|
||||
module.exports = projectController =
|
||||
|
||||
projectSize: (req, res)->
|
||||
metrics.inc "projectSize"
|
||||
{project_id, bucket} = req
|
||||
logger.log project_id:project_id, bucket:bucket, "reciving request to project size"
|
||||
FileHandler.getFile bucket, project_id, req, (err)->
|
||||
if err?
|
||||
logger.log err: err, project_id: project_id, bucket: bucket, "error inserting file"
|
||||
res.send 500
|
||||
else
|
||||
res.send 200
|
Loading…
Reference in a new issue