Merge branch 'master' into pr-log-hints-negative-feedback
|
@ -27,6 +27,8 @@ module.exports = BlogController =
|
|||
data = data.trim()
|
||||
try
|
||||
data = JSON.parse(data)
|
||||
if settings.cdn?.web?.host?
|
||||
data?.content = data?.content?.replace(/src="([^"]+)"/g, "src='#{settings.cdn?.web?.host}$1'");
|
||||
catch err
|
||||
logger.err err:err, data:data, "error parsing data from data"
|
||||
res.render "blog/blog_holder", data
|
||||
|
|
|
@ -512,6 +512,11 @@ module.exports = ProjectEntityHandler =
|
|||
return callback(e)
|
||||
type = sanitizeTypeOfElement type
|
||||
|
||||
if path.resolve("/", element.name) isnt "/#{element.name}" or element.name.match("/")
|
||||
e = new Error("invalid element name")
|
||||
logger.err project_id:project._id, folder_id:folder_id, element:element, type:type, "failed trying to insert element as name was invalid"
|
||||
return callback(e)
|
||||
|
||||
if !folder_id?
|
||||
folder_id = project.rootFolder[0]._id
|
||||
ProjectEntityHandler._countElements project, (err, count)->
|
||||
|
|
|
@ -32,8 +32,8 @@ module.exports = ReferencesController =
|
|||
|
||||
_handleIndexResponse: (req, res, projectId, shouldBroadcast, data) ->
|
||||
if !data? or !data.keys?
|
||||
return res.send()
|
||||
else if shouldBroadcast
|
||||
return res.json({projectId, keys: []})
|
||||
if shouldBroadcast
|
||||
logger.log {projectId}, "emitting new references keys to connected clients"
|
||||
EditorRealTimeController.emitToRoom projectId, 'references:keys:updated', data.keys
|
||||
return res.json data
|
||||
|
|
|
@ -101,19 +101,19 @@ if app.get('env') == 'production'
|
|||
logger.info "Production Enviroment"
|
||||
app.enable('view cache')
|
||||
|
||||
|
||||
|
||||
app.use (req, res, next)->
|
||||
metrics.inc "http-request"
|
||||
crawlerLogger.log(req)
|
||||
next()
|
||||
|
||||
app.use (req, res, next) ->
|
||||
if !Settings.editorIsOpen
|
||||
webRouter.use (req, res, next) ->
|
||||
if Settings.editorIsOpen
|
||||
next()
|
||||
else if req.url.indexOf("/admin") == 0
|
||||
next()
|
||||
else
|
||||
res.status(503)
|
||||
res.render("general/closed", {title:"maintenance"})
|
||||
else
|
||||
next()
|
||||
|
||||
apiRouter.get "/status", (req, res)->
|
||||
res.send("web sharelatex is alive")
|
||||
|
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 175 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 696 B After Width: | Height: | Size: 593 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 632 KiB After Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 138 KiB |
Before Width: | Height: | Size: 349 KiB After Width: | Height: | Size: 329 KiB |
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 914 B After Width: | Height: | Size: 594 B |
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 111 B |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 9.5 KiB |
|
@ -134,9 +134,10 @@ describe "ReferencesController", ->
|
|||
@res.sendStatus.calledWith(400).should.equal false
|
||||
done()
|
||||
|
||||
it 'should close the response', (done) ->
|
||||
it 'should send a response with an empty keys list', (done) ->
|
||||
@call () =>
|
||||
@res.send.called.should.equal true
|
||||
@res.json.called.should.equal true
|
||||
@res.json.calledWith({projectId: @projectId, keys: []}).should.equal true
|
||||
done()
|
||||
|
||||
describe 'index', ->
|
||||
|
|