2022-02-20 10:30:58 +05:30
# xdfcgi
A common gateway inferface (CGI) program written in C to display data related to Race CTS leaderboards of Xonotic servers. It may also serve as a static page generator.
2017-09-12 14:45:57 +05:30
## Requirements
2022-02-20 10:30:58 +05:30
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` .
## Compiling
2022-02-20 20:30:01 +05:30
`make` makes a CGI program.
2022-02-20 10:30:58 +05:30
`make staticgen` makes a static page generator.
2022-02-20 20:30:01 +05:30
## Usage: CGI Query Strings
2022-02-20 10:30:58 +05:30
The program queries the database `db/cts.db` (`./src/dbquery.c`, function `static bool executequery` )
2017-09-12 14:45:57 +05:30
* `(none)`
- Query file: `queries/mranks.sql`
2022-02-20 10:30:58 +05:30
- Requests the map list of the server and related data.
2017-09-12 14:45:57 +05:30
* `?map=[map name]`
- Query file: `queries/mleaderboard-ojoin.sql`
- Requests the leaderboard of the map.
* `?player=[clientid]`
- Query file: `queries/rplayers.sql`
- Requests a player's ranks for all maps leaderboards s/he is present on.
2022-02-20 20:30:01 +05:30
## Usage: Static Page Generation
2024-10-12 21:36:07 +05:30
python scripts/allmaps.py
2022-02-20 20:30:01 +05:30
The CGI program is still invoked in static generation. The files `allmaps.py` , `output/leaderboard.css` , `template.html` , `template_map.html` help produce the output.
Before executing `allmaps.py` , copy and modify the templates.
2022-02-20 10:30:58 +05:30
cp ./template-generic.html ./template.html
cp ./template_map-generic.html ./template_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/` .
2017-09-12 14:45:57 +05:30
## Game Versions Used Under:
* Xonotic 0.8.1
* Xonotic 0.8.2
## Compilers
2022-02-20 20:30:01 +05:30
* gcc (GCC) 10.2.1
2017-09-12 14:45:57 +05:30
* MinGW, GCC 4.7.1
__________________
2017-09-12 14:47:47 +05:30
2017-09-12 14:45:57 +05:30
This program uses an sqlite3 database file created from `~/.xonotic/data/data/server.db` .
The database may be built using [xonotic-py-sqlite3-defrag2db ](https://git.teknik.io/antares/xonotic-py-sqlite3-defrag2db ).