116 lines
2.4 KiB
Bash
Executable File
116 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
exec 2>&1
|
|
|
|
uinames=(
|
|
AP
|
|
"Unique Portals Visited"
|
|
"Portals Discovered"
|
|
"XM Collected"
|
|
Hacks
|
|
"Resonators Deployed"
|
|
"Links Created"
|
|
"Control Fields Created"
|
|
"Mind Units Captured"
|
|
"Longest Link Ever Created"
|
|
"Largest Control Field"
|
|
"XM Recharged"
|
|
"Portals Captured"
|
|
"Unique Portals Captured"
|
|
"Resonators Destroyed"
|
|
"Portals Neutralized"
|
|
"Enemy Links Destroyed"
|
|
"Enemy Control Fields Destroyed"
|
|
"Distance Walked"
|
|
"Max Time Portal Held"
|
|
"Max Time Link Maintained"
|
|
"Max Link Length x Days"
|
|
"Max Time Field Held"
|
|
"Largest Field MUs x Days"
|
|
)
|
|
dsnames=(
|
|
AP
|
|
Explorer
|
|
Seer
|
|
XM
|
|
Hacker
|
|
Builder
|
|
Connector
|
|
Mind_Controller
|
|
MU
|
|
Longest_Link
|
|
Largest_Field
|
|
Recharger
|
|
Liberator
|
|
Pioneer
|
|
Purifier
|
|
Neutralized
|
|
Links_Destroyed
|
|
Fields_Destroyed
|
|
Walked
|
|
Guardian
|
|
Link_Maintained
|
|
Link_Length_x_Days
|
|
Field_Held
|
|
Field_x_Days
|
|
)
|
|
readprevvalues() {
|
|
shift
|
|
for arg
|
|
do
|
|
prevvalues+=( "$arg" )
|
|
done
|
|
}
|
|
readprevvalues $(rrdtool lastupdate ingress.rrd | tail -n1)
|
|
|
|
cat <<-EOHTML
|
|
content-type: text/xml
|
|
Last-Modified: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z')
|
|
Expires: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z')
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
|
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>IngRRD - Add data</title>
|
|
</head>
|
|
<body>
|
|
<table style="border:1px solid black; border-collapse:collapse">
|
|
<tr>
|
|
<td style="border:1px solid black"><a href="/cgi/$webuser/?start=$start&end=$end">Overview</a></td>
|
|
<td style="border:1px solid black">
|
|
<table>
|
|
<tr>
|
|
<td rowspan="2"><a href="?hist&start=$start&end=$end">History /</a></td>
|
|
<td>
|
|
<a href="?hist&start=$start&end=$end">Medals</a>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<a href="?hist&show=all&start=$start&end=$end">All</a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td style="background:black; color:white">Add data</td>
|
|
</tr>
|
|
</table>
|
|
<form method="post" action="add">
|
|
<ul>
|
|
EOHTML
|
|
|
|
for indice in ${!uinames[@]}
|
|
do
|
|
echo "<li><input type=\"text\" name=\"${dsnames[indice]}\" value=\"${prevvalues[indice]}\" /> ${uinames[indice]}</li>"
|
|
done
|
|
|
|
cat <<-EOHTML
|
|
</ul>
|
|
<input type="hidden" name="time" value="$(date +%s)" />
|
|
<button type="submit" name="submit" value="send">Send</button>
|
|
</form>
|
|
</body>
|
|
</html>
|
|
EOHTML
|