mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
add dark host option and don’t load pdfjs worker via cdn
This commit is contained in:
parent
6aca798a45
commit
3029fb6335
3 changed files with 8 additions and 2 deletions
|
@ -52,6 +52,7 @@ getFingerprint = (path) ->
|
||||||
logger.log "Finished generating file fingerprints"
|
logger.log "Finished generating file fingerprints"
|
||||||
|
|
||||||
cdnAvailable = Settings.cdn?.web?.host?
|
cdnAvailable = Settings.cdn?.web?.host?
|
||||||
|
darkCdnAvailable = Settings.cdn?.web?.darkHost?
|
||||||
|
|
||||||
module.exports = (app, webRouter, apiRouter)->
|
module.exports = (app, webRouter, apiRouter)->
|
||||||
webRouter.use (req, res, next)->
|
webRouter.use (req, res, next)->
|
||||||
|
@ -66,6 +67,8 @@ module.exports = (app, webRouter, apiRouter)->
|
||||||
|
|
||||||
if cdnAvailable and isLive
|
if cdnAvailable and isLive
|
||||||
staticFilesBase = Settings.cdn?.web?.host
|
staticFilesBase = Settings.cdn?.web?.host
|
||||||
|
else if darkCdnAvailable and isDark
|
||||||
|
staticFilesBase = Settings.cdn?.web?.darkHost
|
||||||
else
|
else
|
||||||
staticFilesBase = ""
|
staticFilesBase = ""
|
||||||
|
|
||||||
|
@ -84,7 +87,9 @@ module.exports = (app, webRouter, apiRouter)->
|
||||||
if !opts.qs?.fingerprint? and doFingerPrint
|
if !opts.qs?.fingerprint? and doFingerPrint
|
||||||
opts.qs.fingerprint = getFingerprint(path)
|
opts.qs.fingerprint = getFingerprint(path)
|
||||||
|
|
||||||
|
if opts.cdn != false
|
||||||
path = Url.resolve(staticFilesBase, path)
|
path = Url.resolve(staticFilesBase, path)
|
||||||
|
|
||||||
qs = querystring.stringify(opts.qs)
|
qs = querystring.stringify(opts.qs)
|
||||||
|
|
||||||
if qs? and qs.length > 0
|
if qs? and qs.length > 0
|
||||||
|
|
|
@ -129,7 +129,7 @@ block content
|
||||||
|
|
||||||
- var pdfPath = 'libs/pdfjs-1.3.91/pdf.worker.js'
|
- var pdfPath = 'libs/pdfjs-1.3.91/pdf.worker.js'
|
||||||
- var fingerprintedPath = fingerprint(jsPath+pdfPath)
|
- var fingerprintedPath = fingerprint(jsPath+pdfPath)
|
||||||
- var pdfJsWorkerPath = buildJsPath(pdfPath, {qs:{fingerprint:fingerprintedPath}})
|
- var pdfJsWorkerPath = buildJsPath(pdfPath, {cdn:false,qs:{fingerprint:fingerprintedPath}})
|
||||||
|
|
||||||
|
|
||||||
script(type='text/javascript').
|
script(type='text/javascript').
|
||||||
|
|
|
@ -117,6 +117,7 @@ module.exports = settings =
|
||||||
# cdn:
|
# cdn:
|
||||||
# web:
|
# web:
|
||||||
# host:"http://cdn.sharelatex.dev:3000"
|
# host:"http://cdn.sharelatex.dev:3000"
|
||||||
|
# darkHost:"http://cdn.sharelatex.dev:3000"
|
||||||
|
|
||||||
# Where your instance of ShareLaTeX can be found publically. Used in emails
|
# Where your instance of ShareLaTeX can be found publically. Used in emails
|
||||||
# that are sent out, generated links, etc.
|
# that are sent out, generated links, etc.
|
||||||
|
|
Loading…
Reference in a new issue