firmware/src/packages/fff/fff-web-ui/files/www/include/header

77 lines
2.7 KiB
Plaintext
Executable File

#!/usr/bin/haserl
<%
. /lib/functions/fff/keyxchange
. /etc/firmware_release
UPGRADE_PATH="$(getUpgradePath)"
echo -en "Content-Type: text/html\r\n\r\n"
HOSTNAME="$(uci -q get "fff.system.hostname")"
hood="$(uci -q get "system.@system[0].hood")"
NOW=$(date +%s)
#Check if new Firmware check older then 1 day
if ( [ ! -s /tmp/fwcheck ] || [ "$(cat /tmp/fwcheck)" -lt "$NOW" ] ) && [ ! "$(uci -q get fff.notifyupdate.value)" = "0" ] ; then
rm -f /tmp/isupdate
NEXTUPDATE=$(($(date +%s)+86400))
echo $NEXTUPDATE > /tmp/fwcheck
/bin/busybox wget "${UPGRADE_PATH}/release.nfo" -P /tmp -T 2
VERSION=$(cat /tmp/release.nfo|awk -F: '/VERSION:/ { print $2 }')
rm -f /tmp/release.nfo
if [ "$VERSION" != "$FIRMWARE_VERSION" -a -n "$VERSION" ]; then
echo $VERSION > /tmp/isupdate
fi
fi
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><%= ${HOSTNAME} %></title>
<link href="/style.css" rel="stylesheet" type="text/css" media="screen" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />
</head>
<body>
<div id="header" style="position: relative;">
<h1><%= ${HOSTNAME} %></h1>
<h2>Freifunk Franken Router</h2>
<img src="/freifunk.svg" style="position: absolute; top: 1px; right: 42px;" alt="" />
</div>
<div style="height: 30px; background-color: #ffb400;"></div>
<div id="menu">
<ul>
<%
for f in /www/menu/ssl/*; do
var=$(cat $f);
menu_file=$(echo $var | cut -d "," -f 1)
menu_name=$(echo $var | cut -d "," -f 2)
menu_link="/cgi-bin/${menu_file}.html";
class_active=""
[ "$menu_link" = "$REQUEST_URI" ] && class_active=' class="active"'
echo -ne "\t<li$class_active><a href=\"${menu_link}\">$menu_name</a></li>\n\t\t";
done
%>
</ul>
<div></div>
</div>
<div id="container">
<div id="primarycontainer">
<div id="primarycontent">
<%
if [ -s /tmp/isupdate ] ; then
VERSION=$(cat /tmp/isupdate)
%>
<div id="updatenotification" style="padding: 15px; margin: 4px; background-color: #cfcfcf; margin-bottom: 15px;">
<h3 style="font-size: 14pt; font-weight: bold; margin-bottom: 10px;">Es ist eine neue Firmware für deinen Freifunkrouter verfügbar!</h3>
<table style="margin-bottom: 10px;">
<tr><td>Installierte Version: </td><td><b><%= ${FIRMWARE_VERSION} %></b></td></tr>
<tr><td>Neue Version: </td><td><b><%= ${VERSION} %></b></td></tr>
</table>
<a href="https://dev.freifunk-franken.de" target="_blank">Zum Download</a> | <a href="upgrade.html">Zur Upgradeseite</a>
</div>
<% fi %>