From 8a691552982ce457186cc7ec30c708a70d87ce17 Mon Sep 17 00:00:00 2001 From: Ivan Stanton Date: Mon, 2 Jul 2018 15:58:27 +0000 Subject: [PATCH] northivanastan created page: Automatic map downloads --- Automatic-map-downloads.md | 97 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Automatic-map-downloads.md diff --git a/Automatic-map-downloads.md b/Automatic-map-downloads.md new file mode 100644 index 0000000..83661be --- /dev/null +++ b/Automatic-map-downloads.md @@ -0,0 +1,97 @@ +# Automatic map downloads + +## Client-side configuration + +Should already work without configuration. You can however use the following +cvars for further tuning (see xonotic.org/tools/cacs for more up-to-date information): + +* `cl_curl_enabled`: download support enabled (master switch) +* `cl_curl_maxdownloads`: maximum number of downloads at once +* `cl_curl_maxspeed`: maximum total speed in KiB/s + +Downloaded packages end up in `Xonotic/data/dlcache/` or +`~/.xonotic/data/dlcache/` and are only used till you exit Xonotic. + If you want to play them localy or use them to setup a server of your +own you can "accept" the packages by moving it one level up - right +next to your config.cfg. + +You should regularily clean up your cache to save space and make the maps +you really want available from the menu. + + +## Server-side configuration + +First of all, you need a HTTP or FTP server to host your PK3s. You can either +use some web space provider, or set up your own. For this, use any FTP or HTTP +server software you want (HTTP: lighttpd, Apache, thttpd; FTP: Filezilla, +vsftpd). HTTP is to be preferred because it works better for firewalled +players. + +On the server, you need to set up where to download the PK3s of the maps you +are running. You can either use the cvar: +* `sv_curl_defaulturl` default download URL + +to set it to some site, or put a file named "curl_urls.txt" in the data +directory of the following format: +``` + pattern url + pattern url + pattern url + ... +``` +where always the first wildcard pattern match is taken. +``` + data* - + strale* http://stralemaps.invalid/ + * http://all.the.other.stuff.invalid/id/here.php?pak= + foo* http://wont.get.here.invalid/ +``` +The pk3 name will be appended to the URL by DarkPlaces. Note that you NEED to +append a trailing slash if you refer to a directory. If you specify a "-" as +URL, the package will not be offered for download. + + +INFORMATION FOR MIRROR/MAP SERVER ADMINS: + +The Referer is always set to dp://serverhost:serverport/, the User-Agent +always starts with "Xonotic". Look at this sample log line: + +141.2.16.3 - - [06/Jun/2006:19:43:14 +0000] "GET /~polzer/temp/nexmaps.php?filename=o-fun.pk3 HTTP/1.1" 302 - "dp://141.2.16.3:26000/" "Xonotic Linux 21:26:17 Jun 6 2006" + + +If you want to set up a redirection service, here is a sample PHP code for you +to start from: + +``` +$title

$title

$message"; + exit(0); +} + +$filename = $_GET['filename']; + +$useragent = getenv("HTTP_USER_AGENT"); +if(strpos($useragent, "Xonotic ") !== 0) + bailout(403, "Forbidden", "You're not a Xonotic client."); + +$url = findmap($filename); +if(!$url) + bailout(404, "Not Found", "Well... try another file name?"); + +header("HTTP/1.1 302 Moved Temporarily"); +header("Location: $url"); + +?> +``` \ No newline at end of file -- 2.39.2