centralize settings

This commit is contained in:
Vincent Riquer 2014-06-20 17:09:52 +02:00
parent 17524b675c
commit 9bbb4a04ff
5 changed files with 187 additions and 223 deletions

26
README
View File

@ -1,35 +1,19 @@
settings
========
Edit to your need
graph graph
===== =====
RRD rendering. RRD rendering.
Lines 7-22:
Level colors for the AP graph. Same as resonators/bursters for levels 1 to 8
(thanks @globulator).
Find a nice scheme for higher levels and send me your patch.
Lines 24,25:
You may want to adjust the default view (in seconds relative to the
current time).
Lines 93,95:
Choose which stats to show.
add.html add.html
======== ========
Update form. Should be prefilled with last inserted data. Update form. Should be prefilled with last inserted data.
No change needed.
add add
=== ===
Process POST data and updates RRD file. Optionally clears CGI cache. Process POST data and updates RRD file. Optionally clears CGI cache.
Line 14:
Set to your CGI/fastcgi cache to enable cache purge on RRD updates
Line 19,21:
Choose the right scheme for the extraction of the username from the
URL.

38
add
View File

@ -1,14 +1,6 @@
#!/bin/bash #!/bin/bash
# Path to your fastcgi_cache (optional). . settings
#CACHE_DIR=/var/www/ingRRD/cache
## FIXME change this according to your URLs:
#
# /$user/add.html
#IFS=/ read garbage webuser garbage <<<"$REQUEST_URI"
# /cgi/$user/add.html
IFS=/ read garbage garbage webuser garbage <<<"$REQUEST_URI"
if [[ $REQUEST_METHOD != POST ]] if [[ $REQUEST_METHOD != POST ]]
then then
@ -51,36 +43,10 @@ else
exit exit
fi fi
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
)
data=N data=N
for dsname in "${dsnames[@]}" for dsname in "${dsnames[@]}"
do do
data+=:${POST["$dsname"]} data+=:${POST["$dsname"]:=U}
echo "$dsname....${POST["$dsname"]}" echo "$dsname....${POST["$dsname"]}"
done done
rrdtool update ingress.rrd "$data" rrdtool update ingress.rrd "$data"

View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
. settings
if [ -n "$QUERY_STRING" ] if [ -n "$QUERY_STRING" ]
then then
query_data="${QUERY_STRING//&/ query_data="${QUERY_STRING//&/
@ -19,58 +21,6 @@ then
done <<<"${query_data//=/ }" done <<<"${query_data//=/ }"
fi fi
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() { readprevvalues() {
shift shift
for arg for arg

115
index
View File

@ -1,119 +1,6 @@
#!/bin/bash #!/bin/bash
rrdfile=ingress.rrd . settings
graph_width=800
L1color=FFCF58
L2color=FFA52E
L3color=FF7110
L4color=E70000
L5color=FF2691
L6color=EF24CE
L7color=C221E1
L8color=9523F8
L9color=000000
L10color=000000
L11color=000000
L12color=000000
L13color=000000
L14color=000000
L15color=000000
L16color=000000
default_start=-604800
default_end=1209600
start=$default_start
end=$default_end
medals=(
Explorer
Seer
Hacker
Builder
Connector
Mind_Controller
Recharger
Liberator
Pioneer
Purifier
Guardian
)
## (0) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
lvl=( . 0 2500 20000 70000 150000 300000 600000 1200000 2400000 4000000 6000000 8400000 12000000 17000000 24000000 40000000 )
lvlsilver=( . 0 0 0 0 0 0 0 0 4 5 6 7 0 0 0 0 )
lvlgold=( . 0 0 0 0 0 0 0 0 1 2 4 6 7 0 0 0 )
lvlplatinum=( . 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 )
lvlblack=( . 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 )
declare -A bronze silver gold platinum black
bronze["Explorer"]=100
silver["Explorer"]=1000
gold["Explorer"]=2000
platinum["Explorer"]=10000
black["Explorer"]=30000
bronze["Seer"]=10
silver["Seer"]=50
gold["Seer"]=200
platinum["Seer"]=500
black["Seer"]=5000
bronze["Hacker"]=2000
silver["Hacker"]=10000
gold["Hacker"]=30000
platinum["Hacker"]=100000
black["Hacker"]=200000
bronze["Builder"]=2000
silver["Builder"]=10000
gold["Builder"]=30000
platinum["Builder"]=100000
black["Builder"]=200000
bronze["Connector"]=50
silver["Connector"]=1000
gold["Connector"]=5000
platinum["Connector"]=25000
black["Connector"]=100000
bronze["Mind_Controller"]=100
silver["Mind_Controller"]=500
gold["Mind_Controller"]=2000
platinum["Mind_Controller"]=10000
black["Mind_Controller"]=40000
bronze["Recharger"]=100000
silver["Recharger"]=1000000
gold["Recharger"]=3000000
platinum["Recharger"]=10000000
black["Recharger"]=25000000
bronze["Liberator"]=100
silver["Liberator"]=1000
gold["Liberator"]=5000
platinum["Liberator"]=15000
black["Liberator"]=40000
bronze["Pioneer"]=20
silver["Pioneer"]=200
gold["Pioneer"]=1000
platinum["Pioneer"]=5000
black["Pioneer"]=20000
bronze["Purifier"]=2000
silver["Purifier"]=10000
gold["Purifier"]=30000
platinum["Purifier"]=100000
black["Purifier"]=300000
bronze["Guardian"]=3
silver["Guardian"]=10
gold["Guardian"]=20
platinum["Guardian"]=90
black["Guardian"]=150
if [ -n "$QUERY_STRING" ] if [ -n "$QUERY_STRING" ]
then then

177
settings Normal file
View File

@ -0,0 +1,177 @@
# Path to your fastcgi_cache (optional).
#CACHE_DIR=/var/www/ingRRD/cache
## FIXME change this according to your URLs:
#
# /$user/add.html
#IFS=/ read garbage webuser garbage <<<"$REQUEST_URI"
# /cgi/$user/add.html
IFS=/ read garbage garbage webuser garbage <<<"$REQUEST_URI"
rrdfile=ingress.rrd
graph_width=800
L1color=FFCF58
L2color=FFA52E
L3color=FF7110
L4color=E70000
L5color=FF2691
L6color=EF24CE
L7color=C221E1
L8color=9523F8
L9color=000000
L10color=000000
L11color=000000
L12color=000000
L13color=000000
L14color=000000
L15color=000000
L16color=000000
default_start=-604800
default_end=1209600
start=$default_start
end=$default_end
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
)
medals=(
Explorer
Seer
Hacker
Builder
Connector
Mind_Controller
Recharger
Liberator
Pioneer
Purifier
Guardian
)
## (0) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
lvl=( . 0 2500 20000 70000 150000 300000 600000 1200000 2400000 4000000 6000000 8400000 12000000 17000000 24000000 40000000 )
lvlsilver=( . 0 0 0 0 0 0 0 0 4 5 6 7 0 0 0 0 )
lvlgold=( . 0 0 0 0 0 0 0 0 1 2 4 6 7 0 0 0 )
lvlplatinum=( . 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 )
lvlblack=( . 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 )
declare -A bronze silver gold platinum black
bronze["Explorer"]=100
silver["Explorer"]=1000
gold["Explorer"]=2000
platinum["Explorer"]=10000
black["Explorer"]=30000
bronze["Seer"]=10
silver["Seer"]=50
gold["Seer"]=200
platinum["Seer"]=500
black["Seer"]=5000
bronze["Hacker"]=2000
silver["Hacker"]=10000
gold["Hacker"]=30000
platinum["Hacker"]=100000
black["Hacker"]=200000
bronze["Builder"]=2000
silver["Builder"]=10000
gold["Builder"]=30000
platinum["Builder"]=100000
black["Builder"]=200000
bronze["Connector"]=50
silver["Connector"]=1000
gold["Connector"]=5000
platinum["Connector"]=25000
black["Connector"]=100000
bronze["Mind_Controller"]=100
silver["Mind_Controller"]=500
gold["Mind_Controller"]=2000
platinum["Mind_Controller"]=10000
black["Mind_Controller"]=40000
bronze["Recharger"]=100000
silver["Recharger"]=1000000
gold["Recharger"]=3000000
platinum["Recharger"]=10000000
black["Recharger"]=25000000
bronze["Liberator"]=100
silver["Liberator"]=1000
gold["Liberator"]=5000
platinum["Liberator"]=15000
black["Liberator"]=40000
bronze["Pioneer"]=20
silver["Pioneer"]=200
gold["Pioneer"]=1000
platinum["Pioneer"]=5000
black["Pioneer"]=20000
bronze["Purifier"]=2000
silver["Purifier"]=10000
gold["Purifier"]=30000
platinum["Purifier"]=100000
black["Purifier"]=300000
bronze["Guardian"]=3
silver["Guardian"]=10
gold["Guardian"]=20
platinum["Guardian"]=90
black["Guardian"]=150