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

74 lines
2.4 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)
%>
<table style="width: 100%;">
<tr>
<td><span style="font-size: 16pt; color:#FF0000">Es ist eine neue Firmware für deinen Freifunkrouter verfügbar.<br />Alte Version: <%= ${FIRMWARE_VERSION} %> - Neue Version: <%= ${VERSION} %> <br /><a href="upgrade.html">Firmware jetzt updaten</a></span></td>
</tr>
</table>
<% fi %>