]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
embed background image in redirect template
authorPeter Müller <peter.mueller@link38.eu>
Mon, 10 Sep 2018 14:15:44 +0000 (16:15 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 10 Sep 2018 15:30:09 +0000 (16:30 +0100)
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 to fourth version of this patch and has
been successfully tested during a clean build.

Fixes #11650

Signed-off-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/html/redirect-templates/legacy/template.html
lfs/web-user-interface

index b5fb61ebe0debea3dcf97b27ce190021a4500166..297561e3a795aa4fce870a32ffc3e7428abe0c4b 100644 (file)
@@ -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%'>
index 0c568825234a315a8abb72f0952228d24caa65ef..73aec3a8d4d8805d6fd2a6e871e015021335c4ee 100644 (file)
@@ -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
+
        # Change CONFIG_ROOT in cgi-scripts
        for i in /srv/web/ipfire/cgi-bin/{*,logs.cgi/*,vpn.cgi/*}; do \
            if [ -f $$i ]; then \