Sfoglia il codice sorgente

Inject isOverleaf setting globally

Alasdair Smith 8 anni fa
parent
commit
085c2529d9

+ 4 - 0
services/web/app/coffee/infrastructure/ExpressLocals.coffee

@@ -333,3 +333,7 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
 			defaultLineHeight          : if isOl then 'normal' else 'compact'
 			renderAnnouncements        : !isOl
 		next()
+
+	webRouter.use (req, res, next) ->
+		res.locals.exposedSettings =
+			isOverleaf: Settings.overleaf?

+ 1 - 0
services/web/app/views/layout.pug

@@ -70,6 +70,7 @@ html(itemscope, itemtype='http://schema.org/Product')
 			window.systemMessages = !{JSON.stringify(systemMessages).replace(/\//g, '\\/')};
 			window.ab = {};
 			window.user_id = '#{getLoggedInUserId()}';
+			window.exposedSettings = JSON.parse('!{JSON.stringify(exposedSettings).replace(/\//g, "\\/")}');
 
 		- if (typeof(settings.algolia) != "undefined")
 			script.