From mboxrd@z Thu Jan  1 00:00:00 1970
From: Peter =?utf-8?q?M=C3=BCller?= <peter.mueller@link38.eu>
To: development@lists.ipfire.org
Subject: Re: [PATCH v2] embed background image in redirect template
Date: Sun, 01 Jul 2018 07:49:10 +0200
Message-ID: <7cac879b-faef-ef9e-90f4-4fceec7d6c62@link38.eu>
In-Reply-To: <4f21dad3b82620d4b47b59fdd4c6b90288f7d283.camel@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============8301121127104598294=="
List-Id: <development.lists.ipfire.org>

--===============8301121127104598294==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hello Michael,

yes, I built IPfire 2.x yesterday, and the image data were included
into /srv/web/ipfire/html/redirect-templates/legacy/template.html .

Is there anything wrong with this patch?

Best regards,
Peter M=C3=BCller

> Hey,
>=20
> 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.
>=20
>> This patch inserts the base64 encoded image during build so
>> nothing needs to be updated twice in case background image
>> changes.
>=20
>> Signed-off-by: Peter M=C3=BCller <peter.mueller(a)link38.eu>
>> ---
>>  html/html/redirect-templates/legacy/template.html | 7 ++++++-
>>  lfs/web-user-interface                            | 4 ++++
>>  2 files changed, 10 insertions(+), 1 deletion(-)
>=20
>> 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 @@
>>  	<head>
>>  		<meta http-equiv=3D"Content-Type" content=3D"text/html;
>> charset=3Dutf-8">=20
>>  		<title>ACCESS MESSAGE</title>
>> +		<style content=3D"text/css">
>> +			td.image {
>> +				background-image:
>> url(data:image/gif;base64,IMAGEDATAPLACEHOLDER);
>> +			}
>> +		</style>
>>  	</head>
>>  	<body>
>>  		<table width=3D"100%" height=3D'100%' border=3D"0">
>>  			<tr>
>> -				<td colspan=3D'3' width=3D'100%' height=3D'130'
>> align=3D"center" background=3D"<TMPL_VAR NAME=3D"ADDRESS">/images/backgrou=
nd.gif">
>> +				<td colspan=3D'3' width=3D'100%' height=3D'152px'
>> align=3D"center" class=3D"image">&nbsp;</td>
>>  			<tr>
>>  				<td width=3D'10%'>
>>  				<td align=3D'center' bgcolor=3D'#CC000000'
>> 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)
>=20
>> +	# 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
> Did you actually test this?
>=20
>> +
>>  	# Copy all html/cgi-bin files
>>  	mkdir -p /srv/web/ipfire/{cgi-bin,html}
>>  	mkdir -p /var/updatecache/{download,metadata}
>=20
> -Michael
>=20

--=20
"We don't care.  We don't have to.  We're the Phone Company."


--===============8301121127104598294==
Content-Type: application/pgp-signature
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="signature.asc"
MIME-Version: 1.0

LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSXpCQUVCQ2dBZEZpRUV2UDRTaUdoRVlE
SnlyUkxrMlVqeUQzMTduMmdGQWxzNGEzQUFDZ2tRMlVqeUQzMTcKbjJqUEJBLytKQVdZRDRrUzN0
d1ozaHJrVjFYL2Y0VkZoRkMyeGcyQXByQmNhcWowV001VVdKNkVMbUM5b1p4bwpITm9Ta2c3Mmly
YndjcGUzR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