mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
mvp for not using cdn when blocked
This commit is contained in:
parent
c653f59705
commit
3d36dc7d6c
3 changed files with 20 additions and 6 deletions
|
@ -61,11 +61,16 @@ module.exports = (app, webRouter, apiRouter)->
|
|||
|
||||
webRouter.use (req, res, next)->
|
||||
|
||||
cdnBlocked = req.query.nocdn == 'true' or req.session.cdnBlocked
|
||||
|
||||
if cdnBlocked and !req.session.cdnBlocked?
|
||||
req.session.cdnBlocked = true
|
||||
|
||||
isDark = req.headers?.host?.slice(0,4)?.toLowerCase() == "dark"
|
||||
isSmoke = req.headers?.host?.slice(0,5)?.toLowerCase() == "smoke"
|
||||
isLive = !isDark and !isSmoke
|
||||
|
||||
if cdnAvailable and isLive
|
||||
|
||||
if cdnAvailable and isLive and !cdnBlocked
|
||||
staticFilesBase = Settings.cdn?.web?.host
|
||||
else if darkCdnAvailable and isDark
|
||||
staticFilesBase = Settings.cdn?.web?.darkHost
|
||||
|
|
|
@ -8,6 +8,7 @@ html(itemscope, itemtype='http://schema.org/Product')
|
|||
window.similarproducts = true
|
||||
style [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {display: none !important; display: none; }
|
||||
|
||||
|
||||
-if (typeof(gaExperiments) != "undefined")
|
||||
|!{gaExperiments}
|
||||
|
||||
|
@ -51,8 +52,16 @@ html(itemscope, itemtype='http://schema.org/Product')
|
|||
window.csrfToken = "#{csrfToken}";
|
||||
|
||||
block scripts
|
||||
script(src=buildJsPath("libs/jquery-1.11.1.min.js", {fingerprint:false}))
|
||||
script(src=buildJsPath("libs/angular-1.3.15.min.js", {fingerprint:false}))
|
||||
script(src=buildJsPath("libs/jquery-1.11.1.min.js", {fingerprint:false}))
|
||||
script(type="text/javascript").
|
||||
var noCdnKey = "nocdn=true"
|
||||
var cdnBlocked = typeof jQuery === 'undefined'
|
||||
var noCdnAlreadyInUrl = window.location.href.indexOf(noCdnKey) != -1 //prevent loops
|
||||
if (cdnBlocked && !noCdnAlreadyInUrl) {
|
||||
window.location.search += '&'+noCdnKey;
|
||||
}
|
||||
|
||||
script.
|
||||
window.sharelatex = {
|
||||
siteUrl: '#{settings.siteUrl}',
|
||||
|
|
|
@ -114,9 +114,9 @@ module.exports = settings =
|
|||
showSocialButtons: false
|
||||
showComments: false
|
||||
|
||||
# cdn:
|
||||
# web:
|
||||
# host:"http://cdn.sharelatex.dev:3000"
|
||||
cdn:
|
||||
web:
|
||||
host:"http://nowhere.sharelatex.dev"
|
||||
# darkHost:"http://cdn.sharelatex.dev:3000"
|
||||
|
||||
# Where your instance of ShareLaTeX can be found publically. Used in emails
|
||||
|
|
Loading…
Reference in a new issue