Website CGI (or page generator) to display Race CTS leaderboards of a Xonotic server.
scuti c128c8efd3 return unmodified string if colors does not run | hai 1 mes | |
---|---|---|
doc | %!s(int64=7) %!d(string=hai) anos | |
include | hai 1 mes | |
output | hai 1 mes | |
queries | hai 1 mes | |
scripts | hai 1 mes | |
src | hai 1 mes | |
templates | hai 1 mes | |
.gitignore | %!s(int64=7) %!d(string=hai) anos | |
LICENSE | %!s(int64=7) %!d(string=hai) anos | |
Makefile | hai 1 mes | |
README.md | hai 1 mes |
A common gateway inferface (CGI) program written in C to display Race CTS leaderboards of Xonotic servers. It can also be a static page generator.
sqlite-devel python3 python-sqlite
The first is only needed for compilation of the C program. The latter two are only for the auxiliary script allmaps.py
.
make
makes a CGI program.
make staticgen
makes a static page generator.
This program uses an sqlite3 database file created from ~/.xonotic/data/data/server.db
(text).
sqlite3 my-new.db
sqlite > .read schema.sql
python scripts/import-from-xon.py my-new.db ~/.xonotic/data/data/server.db
The program queries the database db/cts.db
(./src/dbquery.c
, function static bool executequery
)
(none)
queries/mranks.sql
?map=[map name]
queries/mleaderboard-ojoin.sql
?player=[clientid]
queries/rplayers.sql
python scripts/allmaps.py
The CGI program is still invoked in static generation. The files allmaps.py
, output/leaderboard.css
, overview.html
, map.html
produce the output.
Before executing allmaps.py
, copy and modify the templates.
cp templates/overview.html .
cp templates/map.html .
allmaps.py
outputs an html file for all distinct maps in the database. The leaderboards for each map (equivalent to ?map=[map name]
) are in output/maps/
.
The script scripts/import-from-xon.py
is based on https://git.teknik.io/antares/xonotic-py-sqlite3-defrag2db
by Antares.