Lightweight PHP frontend to browse and download CS:S demo files.
This project is linked to srcdslab/autofastdl, which generates/synchronizes files on the FastDL side.
autofastdlpopulates demo directories (css_ze/demos,css_zr/demos).Demoprovides the web interface to browse and download demos.- Download links target
https://demos.nide.gg/....
- Lists demo archives for whitelisted servers (
css_ze,css_zr). - Parses filenames to display map, start date, and size.
- Validates/sanitizes user input through
DemoSecurity.
index.php- entry point.init.php- include/constants bootstrap.includes/security.php- server/file validation, HTML escaping, security logging.pages/server.php- listing endpoint (POST server).css_ze/demos,css_zr/demos- demo directories.style/- frontend assets (static stylesheet, served directly by the web server).
From the Demo/ directory:
php -S 127.0.0.1:8000 -t .Then open http://127.0.0.1:8000/.
composer install
composer test # PHPUnit
composer lint # PHP_CodeSniffer (PSR-12)
composer lint:fix # auto-fix style issues
composer stan # PHPStan static analysis (level 7)CI (.github/workflows/ci.yml) runs a PHP syntax check, phpcs, PHPStan, and the PHPUnit suite on every push/PR. Minimum supported PHP version is 8.5.12 (fixes CVE-2026-109618 and CVE-2026-109619, see below).
The footer displays the commit the site currently runs, linked to the matching commit on GitHub.
getAppVersion() (includes/version.php) resolves it from, in order:
- the
APP_COMMIT(orGIT_COMMIT) environment variable, - a
VERSIONfile at the project root containing the commit hash, - the local
.gitdirectory (loose refs, packed refs, detached HEAD and worktrees).
If a deployment ships without .git, write the hash at deploy time, e.g.
git rev-parse HEAD > VERSION. When nothing resolves, the version line is simply omitted.
Production is deployed by the Plesk Git extension (automatic mode, branch main) into
<vhost>/demos.nide.gg. Plesk copies the files without .git and keeps its own bare repository
in <vhost>/git/demos-web (no .git suffix). Post-deployment actions run in the deployment
directory as the subscription user ($HOME is the vhost), with git but no php on the PATH.
- No
composer installstep. The site has no runtime Composer dependencies (requireonly pins the PHP version) and never loadsvendor/autoload.php; Composer is only used by CI. VERSIONis written by this post-deployment action, so the footer shows the deployed commit:
h=$(git -C "$HOME/git/demos-web" rev-parse --verify "main^{commit}") && echo "$h" > VERSIONPlesk only shows an action's output when it fails, so a successful run prints nothing; if the
repository cannot be read, the deployment step fails with git's error and VERSION is left as is.
Accepted formats:
auto-YYYYMMDD-HHMMSS-mapname.demauto-YYYYMMDD-HHMMSS-mapname.dem.bz2
On the autofastdl side, the main configuration is in config.json (see examples in the upstream repo):
config.example.fastdl.jsonconfig.example.demos.jsonconfig.example.torchlight.json
Useful parameters for demos:
threads,debug,dockerautoremove::*(local/remote retention, autoclean, priority)autoremove::after_upload(remove local file after upload)
- Only whitelisted server keys are accepted.
- Filenames are validated before disk access.
- Security events (with the client IP) are logged to
data/security.log.data/also holds the download counters and is denied to the web bydata/.htaccess(Apache). - Local secrets are ignored through
.gitignore(.env*,config.local.php,*secret*.php, etc.). - Request parameters that arrive as arrays are treated as empty, so no input can trigger a fatal error.
The server must run PHP 8.5.12 or later: older versions allow unauthenticated
remote code execution before any application code runs, so nothing in this
repository can mitigate it (php.net advisory).
If the update has to wait, the advisory lists stopgaps for php.ini or the FPM
pool (not .user.ini / ini_set()), then restart every worker:
session.upload_progress.enabled = 0fatal_error_backtraces = 0post_max_size = 8M(the site takes no uploads)memory_limit = -1viaphp_admin_value, with a container/cgroup memory limit
See also: OPEN_SOURCE.md.