public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: [PATCH v2] embed background image in redirect template
Date: Tue, 03 Jul 2018 10:54:26 +0100	[thread overview]
Message-ID: <c84a0bb2b10f16f6b16acb3c5b3e03cc3f420144.camel@ipfire.org> (raw)
In-Reply-To: <b839dae0-5b5a-271e-8834-03a4c8c5e033@link38.eu>

[-- Attachment #1: Type: text/plain, Size: 7390 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Sun, 2018-07-01 at 13:45 +0200, Peter Müller wrote:
> Hello Michael,
> 
> > Hi,
> > 
> > On Sun, 2018-07-01 at 07:49 +0200, Peter Müller wrote:
> > > 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?
> > 
> > Yes, see below...
> > 
> > > Best regards,
> > > Peter Müller
> > > > Hey,
> > > > 
> > > > On Sat, 2018-06-30 at 09:56 +0200, Peter Müller 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üller <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(-)
> > > > > 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="Content-Type" content="text/html;
> > > > > charset=utf-8"> 
> > > > >  		<title>ACCESS MESSAGE</title>
> > > > > +		<style content="text/css">
> > > > > +			td.image {
> > > > > +				background-image:
> > > > > url(data:image/gif;base64,IMAGEDATAPLACEHOLDER);
> > > > > +			}
> > > > > +		</style>
> > > > >  	</head>
> > > > >  	<body>
> > > > >  		<table width="100%" height='100%' border="0">
> > > > >  			<tr>
> > > > > -				<td colspan='3' width='100%'
> > > > > height='130'
> > > > > align="center" background="<TMPL_VAR
> > > > > NAME="ADDRESS">/images/background.gif">
> > > > > +				<td colspan='3' width='100%'
> > > > > height='152px'
> > > > > align="center" class="image">&nbsp;</td>
> > > > >  			<tr>
> > > > >  				<td width='10%'>
> > > > >  				<td align='center'
> > > > > bgcolor='#CC000000'
> > > > > width='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="$( base64
> > > > > $(DIR_SRC)/html/html/images/background.gif )"
> > > > > +	sed -i "s/IMAGEDATAPLACEHOLDER/${basedata}/g"
> > > > > $(DIR_SRC)/html/html/redirect-templates/legacy/template.html
> > 
> > This isn't a shell script. It is make in which every line invokes a new
> > shell.
> > Therefore the variable assignment happens in one shell and then the next
> > line 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
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
> <html>
> 	<head>
> 		<meta http-equiv="Content-Type" content="text/html; charset=utf-
> 8"> 
> 		<title>ACCESS MESSAGE</title>
> 		<style content="text/css">
> 			td.image {
> 				background-image:
> url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAH0AAACaCAYAAACEwUcfAAAAAXNS
> R0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOp
> gAABdwnLpRPAAAABh0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjA39c2BcAAAqsJJREFUeF7svQV4
> XVeSLVyXhGZmZo6ZYmamOGa2Y8cMScx2zEwxMzMzyMwg27JlMTOzdPnWv+pIctSZdL+e93p6euZvJ+
> s7l3TvOWftgl27qraK/pv/5VWRauxUUg92Jo2xGmnCzWRX1IHsSqpJ7ZCH1KkqspodyJyaQNYonYrY
> qLLlsuXX5KMUVWG1VWcykKM2r9bOwVFdwFlL+TV2qoJaNecjC5PVZotOMqn8A4ymkJuRlPZpOVnuhJ
> Et+5I1alJpaxFVaU3UMQ9pq5UnTakyZFfEQa3Tkp1dLgeVTq1ROai0Fkc7tcbZTsNOap0qD6lUBXUa
> VSEtUV6dTuXAxFaVjVPIpgkxmDgoSV8g0BZvl3j4hZ/hqCuZ/C8R/zff5n+tn/9WR6oNB0nz9CjZ+a
> 4mpxfnKe/9I1TI8xyVDDhBZcKvUHnfa1Qy8BIV8T1DeT+eVud/dd6+0IeLeYt7XcpTJuSaQ9WYu7pG
> 8Q/sOyY/cRyW9sJhKjA3/ZndlIRH2u4BD7TVX96nfEvukI6OkQpXL6Ce5Ui1pAmp964njcsD0p5wIc
> drVynfpztUyM1FVcrribpK0DtN7eAPuiZhbvZtor44dov1dhwY5+s4McnfcbE+0GmbKdjxiDnM4ZQl
> zAlHp42mQOdpGX55Okd4Fq/kca9g3qVrya5nC1Jn/ebX3/7XYuC/6WymDSXNy4ukCz1KTqGnKZ8rCH
> 53gkqHHKFKUWepWvwVqhx3i8qFulDxiNua4mE3nEsE3bAvG3TXsXbUQ6cWSc8deqW8tB+f8dphgf6N
> /Yr013aLU55pR0c9Un/r8YTKnrtNuceNIF2eeqRRaUidqxapa4wgzepfnXXXLpWxdz1eNJ/bpbyFPO
> 85lw946lQv7IVjmxhX516J7o5DE7wcJib7OMxJ83NckubvuC49wGGnIdDhqDnE/jJw2xrucMsc7nDe
> HOm4HcTPNAbn6pzsUbDym+e6vDu3ka5Crn+T/leH1cMjpPPeSbnizlHB0LNU/MtpSPgxqhZ3huoknw
> NuULVoF1WFuCe6clEujpWjXXLXj3mSq13ia+fBKW8dZqa+s19tcLXfaXhvtz3jpW5+0lPtAJDeMOS+
> qrTHNSp04zTl2rmE7Be1IN24xqRd1chet2pOecdNKwrndtlZtOj7MwUrBrjkbRz7JleXRHf7MaleDv
> PTfew3GvztD5iC7c+YQuyuWELtb5pD7e4BD8zhdo+Ah5YI+zvmKLvz1ij7bZZwh6nG4DztI/0LlXv0
> 0CnPmLGk1Rb8ql0UDfPvf1l3YDLs+oUJpHu3jXL7HaWi8cepbMBpqgr1Xiv2DDVIPk+N0q9T3WQXqp
> F4W1Mj+pFDk7hnTl2S3zgNT3N1+Cnd1X6j/oP9UeNH3TnDe92h9Fe6RWmvNEMSnmjbxzyxrx/0wK66
> +x11+dvHVUUP/kZ5NixXOS39RWW/azo5Ht1Mua4dUed/cUFb2ueuXe2IVw7tkz46jE/3sl9m8Lc7Yg
> rUXbcE2923hOgeW8J0DwEh/ZYlzO6qJUJ33hxhd8IcabfLHGG/zBTqNCo9JHeLcPdcpS4eIaeqlQhu
> w+8m5d+E/34HV
> [rest of the base64 block redacted]
> 
> So I guess the result of this patch is okay, but the question is why. :-)

That must be an old file from a non-clean build.

You are also modifying the source file. And you did not escape the $ in the
Makefile.

- -Michael

> 
> Best regards,
> Peter Müller
> > 
> > You will have an empty image in the result file I think.
> > 
> > -Michael
> > 
> > > > 
> > > > Did you actually test this?
> > > > 
> > > > > +
> > > > >  	# Copy all html/cgi-bin files
> > > > >  	mkdir -p /srv/web/ipfire/{cgi-bin,html}
> > > > >  	mkdir -p /var/updatecache/{download,metadata}
> > > > 
> > > > -Michael
> > > > 
> 
> 
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE5/rW5l3GGe2ypktxgHnw/2+QCQcFAls7R9IACgkQgHnw/2+Q
CQcgRBAAsX8YNxXaPCoKr7qoaSoHacSlabGf30KARfS3Wri1kR9twtGx1t9nO7+z
49zTG5EnVW9wqYOM7XBsOb5G2lLaiHJ7lgx9xqnh2NaHc1cRBsYDZ0w3cWdyO4RX
sxLXw7Lf/Z1Qj/RSgHelNaoTRbZ+pajkgVmHPqBr1LPpDAMtrNBGyvZoGn+ybFii
6wV7w1UTIrhXGjKBQWYRWaZdqq341Z61voCabFdaWUjHEjYcfFVcada6mcDec+by
N5MzLwILVlW3gumwEVDGCY29l+VCcznsiuuJ5ihRNLeMJeXFfzH81uLuWvLO9/Nt
T+ag7KPXGrjxyeVJc4L60DU/DKxzAEmj5WeH914OGiTNk8PsL1EiDCZCPCVKDZKG
LF5YxNpFEEZoks3NfCPXA02y2Evx1LhcAR74lBgxKKFyUmZHgk2qcDi6uuTzwAea
3TKTi4Jcaxhme5RTDgwtDnQP3KyQQaT+3H2/sFSuJoU/pcR2nbCykV3NvsZTsrtW
oLzB/TPPdhDcHeiykts+crqA6U9BtPGTKSV5kFZhXc9NGO0ovk/u0VEA0f+zppep
DSL7hTZFMq7CKkvo4rpacKLAArFg8/FOlFzhGMJtz4jNwmyvbvvHdpWd90wmONGy
/cKUwOlz+XwaHqFxlq9dTV/q1Nh1ykuhzVY37KVLuiqEgNWsNjo=
=NTto
-----END PGP SIGNATURE-----


      reply	other threads:[~2018-07-03  9:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4f21dad3b82620d4b47b59fdd4c6b90288f7d283.camel@ipfire.org>
2018-07-01  5:49 ` Peter Müller
2018-07-01  9:36   ` Michael Tremer
2018-07-01 11:45     ` Peter Müller
2018-07-03  9:54       ` Michael Tremer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c84a0bb2b10f16f6b16acb3c5b3e03cc3f420144.camel@ipfire.org \
    --to=michael.tremer@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox