change api path

This commit is contained in:
Ersun Warncke 2018-09-25 06:45:27 -04:00
parent f0c0834b0f
commit eeed857dd9
3 changed files with 3 additions and 3 deletions

View file

@ -101,7 +101,7 @@ module.exports = TokenAccessHandler =
checkV1Access: (token, callback=(err, allow, redirect)->) -> checkV1Access: (token, callback=(err, allow, redirect)->) ->
return callback(null, true) unless Settings.apis?.v1? return callback(null, true) unless Settings.apis?.v1?
V1Api.request { url: "/api/v1/sharelatex/docs/#{token}/read" }, (err, response, body) -> V1Api.request { url: "/api/v1/sharelatex/docs/#{token}/is_published" }, (err, response, body) ->
return callback err if err? return callback err if err?
callback null, false, body.published_path if body.allow == false callback null, false, body.published_path if body.allow == false
callback null, true callback null, true

View file

@ -82,7 +82,7 @@ module.exports = MockV1Api =
console.error "error starting MockV1Api:", error.message console.error "error starting MockV1Api:", error.message
process.exit(1) process.exit(1)
app.get '/api/v1/sharelatex/docs/:token/read', (req, res, next) => app.get '/api/v1/sharelatex/docs/:token/is_published', (req, res, next) =>
res.json { allow: true } res.json { allow: true }
MockV1Api.run() MockV1Api.run()

View file

@ -459,7 +459,7 @@ describe "TokenAccessHandler", ->
@TokenAccessHandler.checkV1Access @token, @callback @TokenAccessHandler.checkV1Access @token, @callback
it 'should check api', -> it 'should check api', ->
expect(@V1Api.request.calledWith { url: "/api/v1/sharelatex/docs/#{@token}/read" }).to.equal true expect(@V1Api.request.calledWith { url: "/api/v1/sharelatex/docs/#{@token}/is_published" }).to.equal true
it 'should callback with true', -> it 'should callback with true', ->
expect(@callback.calledWith null, true).to.equal true expect(@callback.calledWith null, true).to.equal true