public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: "Peter Müller" <peter.mueller@link38.eu>
To: development@lists.ipfire.org
Subject: Re: [PATCH v3] embed background image in redirect template
Date: Mon, 27 Aug 2018 17:46:44 +0200	[thread overview]
Message-ID: <221742c1-9f16-e510-56a8-f6a1260b3e3a@link38.eu> (raw)
In-Reply-To: <53963aa7a6dd33e84c3fbeef9e0cf7a38703a959.camel@ipfire.org>

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

Hello,

> Hi,
> 
> On Sun, 2018-08-26 at 21:15 +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).
> 
>> This patch inserts the base64 encoded image during build so
>> nothing needs to be updated twice in case background image
>> changes.
> 
>> It supersedes first and second version of this patch and has
>> been successfully tested during a clean build.
> 
>> Fixes #11650
> 
>> Signed-off-by: Peter Müller <peter.mueller(a)link38.eu>
>> ---
>>  html/html/redirect-templates/legacy/template.html | 7 ++++++-
>>  lfs/web-user-interface                            | 5 +++++
>>  2 files changed, 11 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..f3367713a 100644
>> --- a/lfs/web-user-interface
>> +++ b/lfs/web-user-interface
>> @@ -55,6 +55,11 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
>>  	mkdir -p /var/updatecache/{download,metadata}
>>  	cp -aR $(DIR_SRC)/html/* /srv/web/ipfire
> 
>> +	# Add base64 encoded background image to Squid content access page
>> +	basedata="$$( base64 ${DIR_SRC}/html/html/images/background.gif | tr -d
>> '\n' )"; \
>> +		sed -i "s|IMAGEDATAPLACEHOLDER|$${basedata}|g" \
>> +		/srv/web/ipfire/html/redirect-templates/legacy/template.html
>> +
> 
> ${DIR_SRC} should be $(DIR_SRC) in order to be expanded from the Makefile and
> not from the shell environment.
Sorry about this - fixed in v4, although it worked.
> 
> I am not even sure if DIR_SRC is guaranteed to be set.
I must say, using shell commands in LFS files is somewhat tricky...

Best regards,
Peter Müller
> 
>>  	# Change CONFIG_ROOT in cgi-scripts
>>  	for i in /srv/web/ipfire/cgi-bin/{*,logs.cgi/*,vpn.cgi/*}; do \
>>  	    if [ -f $$i ]; then \
> 

-- 
Microsoft DNS service terminates abnormally when it recieves a response
to a DNS query that was never made.  Fix Information: Run your DNS
service on a different platform.
		-- bugtraq

      parent reply	other threads:[~2018-08-27 15:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-26 19:15 Peter Müller
2018-08-27  6:37 ` Michael Tremer
2018-08-27 15:24   ` [PATCH v4] " Peter Müller
2018-08-27 15:46   ` Peter Müller [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=221742c1-9f16-e510-56a8-f6a1260b3e3a@link38.eu \
    --to=peter.mueller@link38.eu \
    --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