mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Anon read-token: add an Authorization header to $http
This commit is contained in:
parent
a66cb15f48
commit
34d4d1360f
4 changed files with 6 additions and 1 deletions
|
@ -303,6 +303,7 @@ module.exports = ProjectController =
|
||||||
privilegeLevel: privilegeLevel
|
privilegeLevel: privilegeLevel
|
||||||
chatUrl: Settings.apis.chat.url
|
chatUrl: Settings.apis.chat.url
|
||||||
anonymous: anonymous
|
anonymous: anonymous
|
||||||
|
anonToken: req._anonToken
|
||||||
languages: Settings.languages
|
languages: Settings.languages
|
||||||
themes: THEME_LIST
|
themes: THEME_LIST
|
||||||
maxDocLength: Settings.max_doc_length
|
maxDocLength: Settings.max_doc_length
|
||||||
|
|
|
@ -61,6 +61,7 @@ module.exports = TokenAccessController =
|
||||||
"error adding user to project with readAndWrite token"
|
"error adding user to project with readAndWrite token"
|
||||||
return next(err)
|
return next(err)
|
||||||
req.params.Project_id = project._id.toString()
|
req.params.Project_id = project._id.toString()
|
||||||
|
req._anonToken = token
|
||||||
return ProjectController.loadEditor(req, res, next)
|
return ProjectController.loadEditor(req, res, next)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,7 @@ block requirejs
|
||||||
window.user = data.user;
|
window.user = data.user;
|
||||||
window.csrfToken = "!{csrfToken}";
|
window.csrfToken = "!{csrfToken}";
|
||||||
window.anonymous = #{anonymous};
|
window.anonymous = #{anonymous};
|
||||||
|
window.anonToken = "#{anonToken}";
|
||||||
window.maxDocLength = #{maxDocLength};
|
window.maxDocLength = #{maxDocLength};
|
||||||
window.trackChangesState = data.trackChangesState;
|
window.trackChangesState = data.trackChangesState;
|
||||||
window.showTrackChangesOnboarding = #{!!showTrackChangesOnboarding};
|
window.showTrackChangesOnboarding = #{!!showTrackChangesOnboarding};
|
||||||
|
|
|
@ -17,7 +17,9 @@ define [
|
||||||
"ErrorCatcher"
|
"ErrorCatcher"
|
||||||
"localStorage"
|
"localStorage"
|
||||||
"ngTagsInput"
|
"ngTagsInput"
|
||||||
]).config ($qProvider, sixpackProvider)->
|
]).config ($qProvider, sixpackProvider, $httpProvider)->
|
||||||
|
if window.anonToken
|
||||||
|
$httpProvider.defaults.headers.common['Authorization'] = window.anonToken
|
||||||
$qProvider.errorOnUnhandledRejections(false)
|
$qProvider.errorOnUnhandledRejections(false)
|
||||||
sixpackProvider.setOptions({
|
sixpackProvider.setOptions({
|
||||||
debug: false
|
debug: false
|
||||||
|
|
Loading…
Reference in a new issue