Website CGI (or page generator) to display Race CTS leaderboards of a Xonotic server.
Go to file
2024-10-12 09:27:02 -07:00
doc Limited line width to 80 characters 2017-09-14 13:43:40 -07:00
include Revised repository organization 2017-09-12 02:48:29 -07:00
output Added html template files 2022-02-16 17:41:34 -08:00
queries main rankings query now places maps with the most records at the top 2022-02-08 19:30:18 -08:00
scripts changed interpolation to format string 2024-10-12 09:17:04 -07:00
src Added compilation flag for static generation (default: cgi) 2022-02-16 20:19:33 -08:00
templates removed stuff 2024-10-12 09:27:02 -07:00
.gitignore Added ignore file. 2017-03-13 22:37:08 -07:00
LICENSE Added license file 2017-09-14 13:27:29 -07:00
Makefile Added compilation flag for static generation (default: cgi) 2022-02-16 20:19:33 -08:00
README.md added and revised templates 2024-10-12 09:06:07 -07:00

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.

Requirements

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

make makes a CGI program.

make staticgen makes a static page generator.

Usage: CGI Query Strings

The program queries the database db/cts.db (./src/dbquery.c, function static bool executequery)

  • (none)

    • Query file: queries/mranks.sql
    • Requests the map list of the server and related data.
  • ?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.

Usage: Static Page Generation

python scripts/allmaps.py

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.

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/.

Game Versions Used Under:

  • Xonotic 0.8.1
  • Xonotic 0.8.2

Compilers

  • gcc (GCC) 10.2.1
  • MinGW, GCC 4.7.1

This program uses an sqlite3 database file created from ~/.xonotic/data/data/server.db.

The database may be built using xonotic-py-sqlite3-defrag2db.