Website CGI (or page generator) to display Race CTS leaderboards of a Xonotic server.

scuti c128c8efd3 return unmodified string if colors does not run 1 ヶ月 前
doc 0a8611065b Limited line width to 80 characters 7 年 前
include e3de4151e2 renamed function b to colorize_noalloc 1 ヶ月 前
output f17c6a8f68 merge staticgen, squashed 1 ヶ月 前
queries 7212546f37 fastest players is now the same order as overview 1 ヶ月 前
scripts c128c8efd3 return unmodified string if colors does not run 1 ヶ月 前
src e3de4151e2 renamed function b to colorize_noalloc 1 ヶ月 前
templates 1fe69cfc76 (map leaderboards) displays who went the fastest 1 ヶ月 前
.gitignore 511d47e4a2 Added ignore file. 7 年 前
LICENSE dad86bc0f2 Added license file 7 年 前
Makefile 0623575917 use heap for colorize_names(...) 1 ヶ月 前
README.md ded4e29594 merge branch 'import script', squashed 1 ヶ月 前

README.md

xdfcgi

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.

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: Import data from Xonotic

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

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

Game Versions Used Under:

  • Xonotic 0.8.1
  • Xonotic 0.8.2

Compilers

  • gcc (GCC) 10.2.1
  • MinGW, GCC 4.7.1

The script scripts/import-from-xon.py is based on https://git.teknik.io/antares/xonotic-py-sqlite3-defrag2db by Antares.