From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter =?utf-8?q?M=C3=BCller?= To: development@lists.ipfire.org Subject: Re: [PATCH v2] embed background image in redirect template Date: Sun, 01 Jul 2018 13:45:32 +0200 Message-ID: In-Reply-To: <62c066635c2dabc0643f405e3a1b22520bd4c870.camel@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4985014382440266657==" List-Id: --===============4985014382440266657== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hello Michael, > Hi, >=20 > On Sun, 2018-07-01 at 07:49 +0200, Peter M=C3=BCller wrote: >> Hello Michael, >=20 >> yes, I built IPfire 2.x yesterday, and the image data were included >> into /srv/web/ipfire/html/redirect-templates/legacy/template.html . >=20 >> Is there anything wrong with this patch? >=20 > Yes, see below... >=20 >> Best regards, >> Peter M=C3=BCller >=20 >>> Hey, >>> >>> On Sat, 2018-06-30 at 09:56 +0200, Peter M=C3=BCller wrote: >>>> Embed the IPFire background image into the redirect template >>>> directly via CSS instead of loading it from somewhere else. >>>> This is necessary because of Content Security Policy (CSP) and >>>> fixes #11650. >>>> This patch inserts the base64 encoded image during build so >>>> nothing needs to be updated twice in case background image >>>> changes. >>>> Signed-off-by: Peter M=C3=BCller >>>> --- >>>> html/html/redirect-templates/legacy/template.html | 7 ++++++- >>>> lfs/web-user-interface | 4 ++++ >>>> 2 files changed, 10 insertions(+), 1 deletion(-) >>>> diff --git a/html/html/redirect-templates/legacy/template.html >>>> b/html/html/redirect-templates/legacy/template.html >>>> index b5fb61ebe..297561e3a 100644 >>>> --- a/html/html/redirect-templates/legacy/template.html >>>> +++ b/html/html/redirect-templates/legacy/template.html >>>> @@ -3,11 +3,16 @@ >>>> >>>> >>> charset=3Dutf-8">=20 >>>> ACCESS MESSAGE >>>> + >>>> >>>> >>>> >>>> >>>> - >>>> >>>>
>>> align=3D"center" background=3D">>> NAME=3D"ADDRESS">/images/background.gif"> >>>> + >>> height=3D'152px' >>>> align=3D"center" class=3D"image"> 
>>>> >>> width=3D'80%'> >>>> diff --git a/lfs/web-user-interface b/lfs/web-user-interface >>>> index 0c5688252..b023cbd86 100644 >>>> --- a/lfs/web-user-interface >>>> +++ b/lfs/web-user-interface >>>> @@ -50,6 +50,10 @@ md5: >>>> $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) >>>> @$(PREBUILD) >>>> + # Add base64 encoded background image to Squid content access >>>> page >>>> + basedata=3D"$( base64 $(DIR_SRC)/html/html/images/background.gif )" >>>> + sed -i "s/IMAGEDATAPLACEHOLDER/${basedata}/g" >>>> $(DIR_SRC)/html/html/redirect-templates/legacy/template.html >=20 > This isn't a shell script. It is make in which every line invokes a new she= ll. > Therefore the variable assignment happens in one shell and then the next li= ne in > executed in a new one which knows nothing about the previous variable > assignment. This sounds correct. However, in case I ran "./make.sh build", there actually is some image data in the built file: ~> cat ~/devel/ipfire-2.x/build/srv/web/ipfire/html/redirect-templates/legacy= /template.html | head -n 8 =20 ACCESS MESSAGE