From 08569103ce5252379721d3d8ab411907988f7e37 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Sun, 2 Sep 2018 09:41:28 +0200 Subject: [PATCH] ui: funnel hash through firmware-product file #2367 Part one makes it possible to inject branding info from the Makefile which is not fully complete yet but can always be finished. The new hash value can thus be used as a unqiue identifier for page resources that may be subject to caching. By using the git hash it allows us to have this effect on test commits as well as earch working version as we don't want to track the changes for each file but still get a good amount of caching. --- Makefile | 9 ++++++--- Mk/tree.mk | 7 +++++-- src/etc/inc/authgui.inc | 4 ++-- src/opnsense/{firmware-product => firmware-product.in} | 5 +++-- src/opnsense/mvc/app/views/layouts/default.volt | 5 ++--- src/www/foot.inc | 4 ++-- 6 files changed, 20 insertions(+), 14 deletions(-) rename src/opnsense/{firmware-product => firmware-product.in} (64%) diff --git a/Makefile b/Makefile index a469c0d2f..273638548 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ CORE_NAME?= opnsense-devel CORE_TYPE?= development CORE_MESSAGE?= Insert Name Here -CORE_MAINTAINER?= franco@opnsense.org +CORE_MAINTAINER?= project@opnsense.org CORE_PACKAGESITE?= https://pkg.opnsense.org CORE_ORIGIN?= opnsense/${CORE_NAME} CORE_COMMENT?= OPNsense ${CORE_TYPE} package @@ -214,7 +214,8 @@ scripts: install: @${MAKE} -C ${.CURDIR}/contrib install DESTDIR=${DESTDIR} @${MAKE} -C ${.CURDIR}/src install DESTDIR=${DESTDIR} \ - CORE_NAME=${CORE_NAME} CORE_ABI=${CORE_ABI} \ + CORE_NAME=${CORE_NAME} CORE_ABI=${CORE_ABI} CORE_WWW=${CORE_WWW} \ + CORE_MAINTAINER=${CORE_MAINTAINER} CORE_HASH=${CORE_HASH} \ CORE_PACKAGESITE=${CORE_PACKAGESITE} \ CORE_REPOSITORY=${CORE_REPOSITORY} @@ -229,7 +230,9 @@ collect: bootstrap: @${MAKE} -C ${.CURDIR}/src install-bootstrap DESTDIR=${DESTDIR} \ NO_SAMPLE=please CORE_PACKAGESITE=${CORE_PACKAGESITE} \ - CORE_NAME=${CORE_NAME} CORE_ABI=${CORE_ABI} \ + CORE_NAME=${CORE_NAME} CORE_ABI=${CORE_ABI} CORE_WWW=${CORE_WWW} \ + CORE_MAINTAINER=${CORE_MAINTAINER} CORE_HASH=${CORE_HASH} \ + CORE_PACKAGESITE=${CORE_PACKAGESITE} \ CORE_REPOSITORY=${CORE_REPOSITORY} plist: diff --git a/Mk/tree.mk b/Mk/tree.mk index 0b69e98a8..05de6c90a 100644 --- a/Mk/tree.mk +++ b/Mk/tree.mk @@ -56,10 +56,13 @@ install-${TARGET}: @(cd ${TREE}; find * -type f ${_IGNORES}) | while read FILE; do \ if [ "$${FILE%%.in}" != "$${FILE}" ]; then \ sed -i '' \ + -e "s=%%CORE_ABI%%=${CORE_ABI}=g" \ + -e "s=%%CORE_HASH%%=${CORE_HASH}=g" \ + -e "s=%%CORE_MAINTAINER%%=${CORE_MAINTAINER}=g" \ + -e "s=%%CORE_NAME%%=${CORE_NAME}=g" \ -e "s=%%CORE_PACKAGESITE%%=${CORE_PACKAGESITE}=g" \ -e "s=%%CORE_REPOSITORY%%=${CORE_REPOSITORY}=g" \ - -e "s=%%CORE_NAME%%=${CORE_NAME}=g" \ - -e "s=%%CORE_ABI%%=${CORE_ABI}=g" \ + -e "s=%%CORE_WWW%%=${CORE_WWW}=g" \ "${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE}"; \ mv -v "${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE}" \ "${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE%%.in}"; \ diff --git a/src/etc/inc/authgui.inc b/src/etc/inc/authgui.inc index f5101867c..93f54fca9 100644 --- a/src/etc/inc/authgui.inc +++ b/src/etc/inc/authgui.inc @@ -373,8 +373,8 @@ function display_login_form($Login_Error)
- (c) - + (c) +
diff --git a/src/opnsense/firmware-product b/src/opnsense/firmware-product.in similarity index 64% rename from src/opnsense/firmware-product rename to src/opnsense/firmware-product.in index 52f69455f..b2344dbb8 100644 --- a/src/opnsense/firmware-product +++ b/src/opnsense/firmware-product.in @@ -2,8 +2,9 @@ "product_copyright_owner": "Deciso B.V.", "product_copyright_url": "https://www.deciso.com/", "product_copyright_years": "2014-2018", - "product_email": "project@opnsense.org", + "product_email": "%%CORE_MAINTAINER%%", + "product_hash": "%%CORE_HASH%%", "product_id": "opnsense", "product_name": "OPNsense", - "product_website": "https://opnsense.org/" + "product_website": "%%CORE_WWW%%" } diff --git a/src/opnsense/mvc/app/views/layouts/default.volt b/src/opnsense/mvc/app/views/layouts/default.volt index 92c0b7788..35d980f11 100644 --- a/src/opnsense/mvc/app/views/layouts/default.volt +++ b/src/opnsense/mvc/app/views/layouts/default.volt @@ -265,9 +265,8 @@ diff --git a/src/www/foot.inc b/src/www/foot.inc index df303a974..8c3b36688 100644 --- a/src/www/foot.inc +++ b/src/www/foot.inc @@ -1,8 +1,8 @@