diff --git a/services/web/app/coffee/infrastructure/ExpressLocals.coffee b/services/web/app/coffee/infrastructure/ExpressLocals.coffee index d2aeae655c..7aef6e5424 100644 --- a/services/web/app/coffee/infrastructure/ExpressLocals.coffee +++ b/services/web/app/coffee/infrastructure/ExpressLocals.coffee @@ -134,11 +134,15 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)-> res.locals.fullJsPath = Url.resolve(staticFilesBase, jsPath) res.locals.lib = PackageVersions.lib + + res.locals.buildJsPath = (jsFile, opts = {})-> path = Path.join(jsPath, jsFile) + + # TODO CDN? if opts.hashedPath - return hashedFiles[path] + path = hashedFiles[path] doFingerPrint = opts.fingerprint != false @@ -159,7 +163,7 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)-> res.locals.buildCssPath = (cssFile, opts)-> path = Path.join("/stylesheets/", cssFile) - if opts.hashedPath + if opts?.hashedPath hashedPath = hashedFiles[path] return Url.resolve(staticFilesBase, hashedPath) return Url.resolve(staticFilesBase, path) + "?fingerprint=" + getFingerprint(path) diff --git a/services/web/app/views/layout.pug b/services/web/app/views/layout.pug index 537417dce3..d9bba35f0b 100644 --- a/services/web/app/views/layout.pug +++ b/services/web/app/views/layout.pug @@ -142,9 +142,9 @@ html(itemscope, itemtype='http://schema.org/Product') window.requirejs = { "paths" : { "moment": "libs/#{lib('moment')}", - "fineuploader": "libs/#{lib('fineuploader')}" + "fineuploader": "libs/#{lib('fineuploader')}", + "main": "#{buildJsPath('main.js', {hashedPath:true, fingerprint:false}).slice(0,-3)}", }, - "urlArgs": "fingerprint=#{fingerprint(jsPath + 'main.js')}-#{fingerprint(jsPath + 'libs.js')}", "config":{ "moment":{ "noGlobal": true @@ -152,7 +152,7 @@ html(itemscope, itemtype='http://schema.org/Product') } }; script( - data-main=buildJsPath('main.js', {hashedPath:true}), + data-main=buildJsPath('main.js', {hashedPath:false, fingerprint:false}), baseurl=fullJsPath, src=buildJsPath('libs/require.js') ) diff --git a/services/web/app/views/project/editor.pug b/services/web/app/views/project/editor.pug index c49afee0b2..a37ac6e6d5 100644 --- a/services/web/app/views/project/editor.pug +++ b/services/web/app/views/project/editor.pug @@ -131,7 +131,9 @@ block requirejs "pdfjs-dist/build/pdf": "libs/#{lib('pdfjs')}/pdf", "pdfjs-dist/build/pdf.worker": "#{pdfWorkerPath}", "ace": "#{lib('ace')}", - "fineuploader": "libs/#{lib('fineuploader')}" + "fineuploader": "libs/#{lib('fineuploader')}", + "ide": "#{buildJsPath('ide.js', {hashedPath:true, fingerprint:false}).slice(0,-3)}", + }, "urlArgs" : "fingerprint=#{fingerprint(jsPath + 'ide.js')}-#{fingerprint(jsPath + 'libs.js')}", "waitSeconds": 0, @@ -161,7 +163,7 @@ block requirejs window.uiConfig = JSON.parse('!{JSON.stringify(uiConfig).replace(/\//g, "\\/")}'); script( - data-main=buildJsPath("ide.js", {hashedPath:true}), + data-main=buildJsPath("ide.js", {hashedPath:false}), baseurl=fullJsPath, data-ace-base=buildJsPath(lib('ace'), {fingerprint:false}), src=buildJsPath('libs/require.js', {hashedPath:true})