From c25f2df7216864fc3219fcaf151e2a8d174cc66f Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Fri, 30 Jun 2017 12:11:44 +0200 Subject: [PATCH] Added caching versions to some of the images which are loaded by js --- customize.dist/pages.js | 22 ++++++++++++---------- customize.dist/template.js | 6 ++++-- www/common/toolbar.js | 4 +++- www/file/test/main.js | 6 ++++-- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 7c8b45163..6088f2c5c 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -1,9 +1,11 @@ define([ + '/api/config', '/common/hyperscript.js', '/common/cryptpad-common.js', -], function (h, Cryptpad) { +], function (Config, h, Cryptpad) { var Pages = {}; var Msg = Cryptpad.Messages; + var urlArgs = Config.requireConf.urlArgs; var setHTML = function (e, html) { e.innerHTML = html; @@ -21,7 +23,7 @@ define([ h('div.info-container', [ h('div.left.image', [ h('img', { - src: '/customize/images/zeroknowledge_small.png', + src: '/customize/images/zeroknowledge_small.png?' + urlArgs , alt: 'Zero Knowledge' }) ]), @@ -40,7 +42,7 @@ define([ h('div.right.image', [ h('img', { alt: "User account", - src: '/customize/images/realtime_small.png', + src: '/customize/images/realtime_small.png?' + urlArgs, }) ]) ]) @@ -49,7 +51,7 @@ define([ h('div.info-container', [ h('div.left.image', [ h('img', { - src: '/customize/images/key_small.png', + src: '/customize/images/key_small.png?' + urlArgs, alt: 'User account' }) ]), @@ -67,7 +69,7 @@ define([ ]), h('div.right.image', [ h('img', { - src: '/customize/images/organize.png', + src: '/customize/images/organize.png?' + urlArgs, alt: 'User account' }) ]) @@ -204,28 +206,28 @@ define([ h('div.app-row', [ appButton("Rich Text application", Msg.main_richText, - '/customize/images/pad.png', + '/customize/images/pad.png?' + urlArgs, Msg.main_richText_p, '/pad/', Msg.button_newpad, 'create-pad'), appButton('Code application', Msg.main_code, - '/customize/images/code.png', + '/customize/images/code.png?' + urlArgs, Msg.main_code_p, '/code/', Msg.button_newcode, 'create-code'), appButton('Slide application', Msg.main_slide, - '/customize/images/slide.png', + '/customize/images/slide.png?' + urlArgs, Msg.main_slide_p, '/slide/', Msg.button_newslide, 'create-slide'), appButton('Poll application', Msg.main_poll, - '/customize/images/poll.png', + '/customize/images/poll.png?' + urlArgs, Msg.main_poll_p, '/poll/', Msg.button_newpoll, @@ -266,7 +268,7 @@ define([ return h('div#loading', h('div.loadingContainer', [ h('img.cryptofist', { - src: '/customize/cryptofist_small.png' + src: '/customize/cryptofist_small.png?' + urlArgs }), h('div.spinnerContainer', h('span.fa.fa-spinner.fa-pulse.fa-4x.fa-fw')), diff --git a/customize.dist/template.js b/customize.dist/template.js index c0ca4f1d5..41de264b4 100644 --- a/customize.dist/template.js +++ b/customize.dist/template.js @@ -3,10 +3,12 @@ define([ '/common/hyperscript.js', '/common/cryptpad-common.js', '/customize/pages.js', + '/api/config', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', -], function ($, h, Cryptpad, Pages) { +], function ($, h, Cryptpad, Pages, Config) { $(function () { + var urlArgs = Config.requireConf.urlArgs; var Messages = Cryptpad.Messages; var $body = $('body'); var isMainApp = function () { @@ -24,7 +26,7 @@ $(function () { h('span', [ h('a.gotoMain', {href: '/'}, [ h('img.cryptpad-logo', { - src: '/customize/cryptofist_mini.png', + src: '/customize/cryptofist_mini.png?' + urlArgs, alt: '', }), 'CryptPad' diff --git a/www/common/toolbar.js b/www/common/toolbar.js index bf08fcb07..0735260a1 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -4,6 +4,8 @@ define([ '/api/config' ], function ($, Config, ApiConfig) { + var urlArgs = ApiConfig.requireConf.urlArgs; + var Messages = {}; var Bar = { @@ -443,7 +445,7 @@ define([ 'class': "cryptpad-link" }).appendTo($topContainer); var $imgTag = $('', { - src: "/customize/cryptofist_mini.png", + src: "/customize/cryptofist_mini.png?" + urlArgs, alt: "Cryptpad" }); diff --git a/www/file/test/main.js b/www/file/test/main.js index 5ec71126d..3593d0ad4 100644 --- a/www/file/test/main.js +++ b/www/file/test/main.js @@ -1,4 +1,5 @@ define([ + '/api/config', 'jquery', '/bower_components/chainpad-crypto/crypto.js', '/bower_components/chainpad-netflux/chainpad-netflux.js', @@ -9,7 +10,8 @@ define([ '/file/file-crypto.js', '/bower_components/tweetnacl/nacl-fast.min.js', '/bower_components/file-saver/FileSaver.min.js', -], function ($, Crypto, realtimeInput, Toolbar, Cryptpad, Visible, Notify, FileCrypto) { +], function (Config, $, Crypto, realtimeInput, Toolbar, Cryptpad, Visible, Notify, FileCrypto) { + var urlArgs = Config.requireConf.urlArgs; var Nacl = window.nacl; $(function () { @@ -71,7 +73,7 @@ define([ }; var andThen = function () { - var src = '/customize/cryptofist_mini.png'; + var src = '/customize/cryptofist_mini.png?' + urlArgs; Cryptpad.fetch(src, function (e, file) { console.log('original file is %s uint8s', file.length); upload(file, {