]> git.xonotic.org Git - xonotic/xonotic.git/blob - Docs/mapdownload.txt
Merge commit 'origin/esteel/renames'
[xonotic/xonotic.git] / Docs / mapdownload.txt
1 map download:\r
2 ______________\r
3 \r
4 \r
5 CLIENT SIDE:\r
6 \r
7 Should already work without configuration. You can however use the following\r
8 cvars for further tuning:\r
9 \r
10    cl_curl_enabled              download support enabled (master switch, default: 1)\r
11    cl_curl_maxdownloads         maximum number of downloads at once (default: 1)\r
12    cl_curl_maxspeed             maximum total speed in KiB/s (default: 100)\r
13 \r
14 Downloaded packages end up in |Nexuiz/data/dlcache/| or\r
15 |~/.nexuiz/data/dlcache/| and are only used till you exit Nexuiz.\r
16  If you want to play them localy or use them to setup a server of your\r
17 own you can "accept" the packages by moving it one level up - right\r
18 next to your config.cfg.\r
19 \r
20 You should regularily clean up your cache to save space and make the maps\r
21 you really want available from the menu.\r
22 \r
23 \r
24 SERVER SIDE:\r
25 \r
26 First of all, you need a HTTP or FTP server to host your PK3s. You can either\r
27 use some web space provider, or set up your own. For this, use any FTP or HTTP\r
28 server software you want (HTTP: lighttpd, Apache, thttpd; FTP: Filezilla,\r
29 vsftpd). HTTP is to be preferred because it works better for firewalled\r
30 players.\r
31 \r
32 On the server, you need to set up where to download the PK3s of the maps you\r
33 are running. You can either use the cvar\r
34 \r
35    sv_curl_defaulturl           default download URL\r
36 \r
37 to set it to some site, or put a file named "curl_urls.txt" in the data\r
38 directory of the following format:\r
39 \r
40    pattern        url\r
41    pattern        url\r
42    pattern        url\r
43    ...\r
44 \r
45 where always the first wildcard pattern match is taken.\r
46 \r
47    data*          -\r
48    strale*        http://stralemaps.invalid/\r
49    *              http://all.the.other.stuff.invalid/id/here.php?pak=\r
50    foo*           http://wont.get.here.invalid/\r
51 \r
52 The pk3 name will be appended to the URL by DarkPlaces. Note that you NEED to\r
53 append a trailing slash if you refer to a directory. If you specify a "-" as\r
54 URL, the package will not be offered for download.\r
55 \r
56 \r
57 INFORMATION FOR MIRROR/MAP SERVER ADMINS:\r
58 \r
59 The Referer is always set to dp://serverhost:serverport/, the User-Agent\r
60 always starts with "Nexuiz". Look at this sample log line:\r
61 \r
62 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/" "Nexuiz Linux 21:26:17 Jun  6 2006"\r
63 \r
64 \r
65 If you want to set up a redirection service, here is a sample PHP code for you\r
66 to start from:\r
67 \r
68 <?\r
69 \r
70 function findmap($filename)\r
71 {\r
72     # insert your database query or whatever you want here\r
73     if($filename == "foo.pk3")\r
74         return "http://barserver.invalid/foo.pk3";\r
75     return FALSE;\r
76 }\r
77 \r
78 function bailout($code, $title, $message)\r
79 {\r
80     header("HTTP/1.1 $code $title");\r
81     echo "<html><title>$title</title><h1>$title</h1>$message</html>";\r
82     exit(0);\r
83 }   \r
84 \r
85 $filename = $_GET['filename'];\r
86 \r
87 $useragent = getenv("HTTP_USER_AGENT");\r
88 if(strpos($useragent, "Nexuiz ") !== 0)\r
89     bailout(403, "Forbidden", "You're not a Nexuiz client.");\r
90     \r
91 $url = findmap($filename);\r
92 if(!$url)\r
93     bailout(404, "Not Found", "Well... try another file name?");\r
94     \r
95 header("HTTP/1.1 302 Moved Temporarily");\r
96 header("Location: $url");\r
97 \r
98 ?>\r