More content in the page added; parsers skips the amount of read bytes, not the amount of sent bytes

This commit is contained in:
ollo 2016-12-29 22:20:19 +01:00
parent b99728ada6
commit 8aa34ce408
2 changed files with 59 additions and 2 deletions

56
webpage.html Normal file
View File

@ -0,0 +1,56 @@
<html><head><title>WordClock Setup Page</title>
<style type="text/css">
#table-6 {
width: 100%
border: 1px solid #B0B0B0;
}
#table-6 tbody {
/* Kind of irrelevant unless your .css is alreadt doing something else */
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
#table-6 thead {
text-align: left;
}
#table-6 thead th {
background: -moz-linear-gradient(top, #F0F0F0 0, #DBDBDB 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #F0F0F0), color-stop(100%, #DBDBDB));
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#F0F0F0', endColorstr='#DBDBDB', GradientType=0);
border: 1px solid #B0B0B0;
color: #444;
font-size: 16px;
font-weight: bold;
padding: 3px 10px;
}
#table-6 td {
padding: 3px 10px;
}
#table-6 tr:nth-child(even) {
background: #F2F2F2;
}
</style></head>
<body>
<h1>Welcome to the WordClock</h1>
<h2>Initial Setup</h2>
Please note that all settings are mandatory<br /><br />
<form action="/" method="POST">
<table id="table-6">
<tr><th>WIFI-SSID</b></th><td><input id="ssid" name="ssid" value="$SSID"></td><td>SSID of the wireless network</td></tr>
<tr><th>WIFI-Password</th><td><input id="password" name="password"></td><td>Password of the wireless network</td></tr>
<tr><th>SNTP Server</th><td><input id="sntpserver" name="sntpserver" value="$SNTPSERVER"></td><td>Server to sync the time with. Only one ntp server is allowed.</tr>
<tr><th>Offset to UTC time</th><td><input id="timezoneoffset" name="timezoneoffset" value="$TIMEOFFSET"></td><td>Define the offset to UTC time in hours. For example +1 hour for Germany</tr>
<tr><th>Color</th><td><input type="color" name="fcolor" value="$HEXCOLOR"></td><td /></tr>
<tr><th>1. Minute Color</th><td><input type="color" name="colorMin1" value="$HEXCOLOR1"></td><td /></tr>
<tr><th>2. Minute Color</th><td><input type="color" name="colorMin2" value="$HEXCOLOR2"></td><td /></tr>
<tr><th>3. Minute Color</th><td><input type="color" name="colorMin3" value="$HEXCOLOR3"></td><td /></tr>
<tr><th>4. Minute Color</th><td><input type="color" name="colorMin4" value="$HEXCOLOR4"></td><td /></tr>
<tr><td colspan="3"><div align="center"><input type="submit" value="Save Configuration" onclick="this.value='Submitting ..';this.disabled='disabled'; this.form.submit();"></div></td></tr>
<tr><td colspan="3"><div align="center"><input type="submit" name="action" value="Reboot"></div></td></tr>
</table>
</form>

View File

@ -29,6 +29,9 @@ function sendPage(conn, nameOfFile, replaceMap)
local line = file.readline() local line = file.readline()
while (line ~= nil) do while (line ~= nil) do
-- increase the amount of sent bytes
sentBytes=sentBytes+string.len(line)
-- all placeholder begin with a $, so search for it in the current line -- all placeholder begin with a $, so search for it in the current line
if (line:find("$") ~= nil) then if (line:find("$") ~= nil) then
-- Replace the placeholder with the dynamic content -- Replace the placeholder with the dynamic content
@ -41,8 +44,6 @@ function sendPage(conn, nameOfFile, replaceMap)
end end
buf = buf .. line buf = buf .. line
-- increase the amount of sent bytes
sentBytes=sentBytes+string.len(line)
-- Sent after 1k data -- Sent after 1k data
if (string.len(buf) >= 1000) then if (string.len(buf) >= 1000) then
line=nil line=nil