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: Sun, 01 Jul 2018 10:36:48 +0100	[thread overview]
Message-ID: <62c066635c2dabc0643f405e3a1b22520bd4c870.camel@ipfire.org> (raw)
In-Reply-To: <7cac879b-faef-ef9e-90f4-4fceec7d6c62@link38.eu>

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

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

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.

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+QCQcFAls4oLEACgkQgHnw/2+Q
CQeJPA//TaqkNL0v9LL6IHEdI2hgHi64CjySvcDvdl3OjCw0oB5EEU5NivgI2jne
Wbdlgq6GwJdZaMAUP753MQVCFznO29RSSwKxo9wlCaqMnYxmPe0f83WepWV4c7dL
Fo8CplgYDdRk24wI7p68Gmexg2ZJj83IYHNTLQhqCI23WVhKtjiXQu0hRen/rreW
KVoz/xqmjge2a34MhGOlbx7ZKDK0qzvpQC3ZmNgDn9BEOHHBdaxPal6b0NbyyaAu
rNssQxhf5gAWGWvqCnKSf+hDgAckhpS5O6yvKp3SzlDvq2YSfVsAWSpTlAv4L/JY
gGXRsd0cu9JMjLWD2gafCJ2cPHTZAYDo9Ll+NLIUi0deHTKPIsc+8XeL6U2z51qE
SoWUtE0RI9Qbz80r7N/EDOVc6mIMJ1dxCQdEA2M+JDyBKyZOJRfpxG3Hf0k+JxxD
N/V/u5IXxgb8CVOGQ99pPYVqI7qDVcP4eGjB49p32UxAplxg4z+d0E6JAYUjyjET
uhlHUv9T/vlp8bt+GZTTyInTu/5qF5JWxeL78EIgcM868BnxI4S1Fq222P9suTy5
G9rxLK6Omf2I/YhLi9aTdjY358Qh6MUuxT0GCpr6FJFM+XnYnymsvACNM68Cji5s
MNhDre+R68qb9KOcWv5kAi4lOH6sQaimzXSDalZ0QnWV1m+2ch8=
=31DP
-----END PGP SIGNATURE-----


  reply	other threads:[~2018-07-01  9:36 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 [this message]
2018-07-01 11:45     ` Peter Müller
2018-07-03  9:54       ` Michael Tremer

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=62c066635c2dabc0643f405e3a1b22520bd4c870.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