add isOwner to the client settings so we can check if the user is the owner

This commit is contained in:
Paul Rodwell 2018-09-23 18:37:43 +01:00
parent 71cd00b86a
commit ed5061e9e5
2 changed files with 14 additions and 1 deletions

View File

@ -173,7 +173,16 @@ setup = (user) ->
switch document.cookie.match('(?:^|;)\\s?state=(.*?)(?:;|$)')[1]
when 'loggedIn' then window.isAuthenticated = true
when 'loggedOut' then window.isAuthenticated = false
update_footer ownerName, isAuthenticated
myInit = {
method: 'GET'
cache: 'no-cache'
mode: 'same-origin'
}
fetch '/auth/client-settings.json', myInit
.then (response) ->
response.json().then (json) ->
window.isOwner = json.isOwner
update_footer ownerName, isAuthenticated
lastCookie = currentCookie
, 100

View File

@ -306,6 +306,10 @@ module.exports = exports = (log, loga, argv) ->
}
if wikiHost
settings.wikiHost = wikiHost
if isAuthorized(req) and owner isnt ''
settings.isOwner = true
else
settings.isOwner = false
res.json settings
app.get '/auth/loginDialog', (req, res) ->