1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-25 14:17:46 +00:00

Added patching server web files.

This commit is contained in:
Filip Maj 2018-05-29 01:06:44 -04:00
parent 0492bc4c59
commit 0209f3e617
3 changed files with 190 additions and 0 deletions

3
www/vercheck/.htaccess Normal file
View file

@ -0,0 +1,3 @@
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

123
www/vercheck/index.php Normal file
View file

@ -0,0 +1,123 @@
<?php
require 'patches.php';
function getCurrentUri()
{
$basepath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/';
$uri = substr($_SERVER['REQUEST_URI'], strlen($basepath));
if (strstr($uri, '?')) $uri = substr($uri, 0, strpos($uri, '?'));
$uri = '/' . trim($uri, '/');
return $uri;
}
function checkBootVersion($version)
{
global $LATEST_BOOT_VERSION, $BOOT_PATCHES;
if ($version != $LATEST_BOOT_VERSION)
{
if (!isset($BOOT_PATCHES[$version]))
{
header("HTTP/1.0 404 NOT FOUND");
return;
}
header("HTTP/1.0 200 OK");
header("Content-Location: ffxiv/2d2a390f/vercheck.dat");
header("Content-Type: multipart/mixed; boundary=477D80B1_38BC_41d4_8B48_5273ADB89CAC");
header("X-Repository: ffxiv/win32/release/boot");
header("X-Patch-Module: ZiPatch");
header("X-Protocol: torrent");
header("X-Info-Url: http://example.com");
header("X-Latest-Version: $LATEST_BOOT_VERSION");
header("Connection: keep-alive");
echo "--477D80B1_38BC_41d4_8B48_5273ADB89CAC\r\n";
echo "Content-Type: application/octet-stream\r\n";
echo "Content-Location: ffxiv/2d2a390f/metainfo/D$BOOT_PATCHES[$version].torrent\r\n";
echo "X-Patch-Length: " . filesize("./ffxiv/2d2a390f/patch/D$BOOT_PATCHES[$version].patch") . "\r\n";
echo "X-Signature: jqxmt9WQH1aXptNju6CmCdztFdaKbyOAVjdGw_DJvRiBJhnQL6UlDUcqxg2DeiIKhVzkjUm3hFXOVUFjygxCoPUmCwnbCaryNqVk_oTk_aZE4HGWNOEcAdBwf0Gb2SzwAtk69zs_5dLAtZ0mPpMuxWJiaNSvWjEmQ925BFwd7Vk=\r\n";
echo "test: $version";
echo "\r\n";
readfile("./ffxiv/2d2a390f/metainfo/D$BOOT_PATCHES[$version].torrent");
echo "\r\n";
echo "--477D80B1_38BC_41d4_8B48_5273ADB89CAC--\r\n\r\n";
}
else
{
header("HTTP/1.0 204 No Content");
header("Content-Location: ffxiv/48eca647/vercheck.dat");
header("X-Repository: ffxiv/win32/release/boot");
header("X-Patch-Module: ZiPatch");
header("X-Protocol: torrent");
header("X-Info-Url: http://www.example.com");
header("X-Latest-Version: $LATEST_BOOT_VERSION");
}
}
function checkGameVersion($version)
{
global $LATEST_GAME_VERSION, $GAME_PATCHES;
if ($version != $LATEST_GAME_VERSION)
{
if (!isset($GAME_PATCHES[$version]))
{
header("HTTP/1.0 404 NOT FOUND");
return;
}
header("HTTP/1.0 200 OK");
header("Content-Location: ffxiv/48eca647/vercheck.dat");
header("Content-Type: multipart/mixed; boundary=477D80B1_38BC_41d4_8B48_5273ADB89CAC");
header("X-Repository: ffxiv/win32/release/game");
header("X-Patch-Module: ZiPatch");
header("X-Protocol: torrent");
header("X-Info-Url: http://example.com");
header("X-Latest-Version: $LATEST_GAME_VERSION");
header("Connection: keep-alive");
echo "--477D80B1_38BC_41d4_8B48_5273ADB89CAC\r\n";
echo "Content-Type: application/octet-stream\r\n";
echo "Content-Location: ffxiv/48eca647/metainfo/D$GAME_PATCHES[$version].torrent\r\n";
echo "X-Patch-Length: " . filesize("./ffxiv/48eca647/patch/D$GAME_PATCHES[$version].patch") . "\r\n";
echo "X-Signature: jqxmt9WQH1aXptNju6CmCdztFdaKbyOAVjdGw_DJvRiBJhnQL6UlDUcqxg2DeiIKhVzkjUm3hFXOVUFjygxCoPUmCwnbCaryNqVk_oTk_aZE4HGWNOEcAdBwf0Gb2SzwAtk69zs_5dLAtZ0mPpMuxWJiaNSvWjEmQ925BFwd7Vk=\r\n";
echo "\r\n";
readfile("./ffxiv/48eca647/metainfo/D$GAME_PATCHES[$version].torrent");
echo "\r\n";
echo "--477D80B1_38BC_41d4_8B48_5273ADB89CAC--\r\n\r\n";
}
else
{
header("HTTP/1.0 204 No Content");
header("Content-Location: ffxiv/48eca647/vercheck.dat");
header("X-Repository: ffxiv/win32/release/game");
header("X-Patch-Module: ZiPatch");
header("X-Protocol: torrent");
header("X-Info-Url: http://www.example.com");
header("X-Latest-Version: $LATEST_GAME_VERSION");
}
}
//Find the version request
$base_url = getCurrentUri();
$routes = array();
$routes = explode('/', $base_url);
//Are we even updating FFXIV?
if ($routes[1] == "ffxiv" &&
$routes[2] == "win32" &&
$routes[3] == "release"){
//Updating Launcher
if ($routes[4] == "boot")
checkBootVersion($routes[5]);
//Updating Game
else if ($routes[4] == "game")
checkGameVersion($routes[5]);
}
?>

64
www/vercheck/patches.php Normal file
View file

@ -0,0 +1,64 @@
<?php
$LATEST_BOOT_VERSION = "2010.09.18.0000";
$LATEST_GAME_VERSION = "2012.09.19.0001";
$BOOT_PATCHES = array(
"2010.07.10.0000" => "2010.09.18.0000",
);
$GAME_PATCHES = array(
"2010.07.10.0000" => "2010.09.19.0000",
"2010.09.19.0000" => "2010.09.23.0000",
"2010.09.23.0000" => "2010.09.28.0000",
"2010.09.28.0000" => "2010.10.07.0001",
"2010.10.07.0001" => "2010.10.14.0000",
"2010.10.14.0000" => "2010.10.22.0000",
"2010.10.22.0000" => "2010.10.26.0000",
"2010.10.26.0000" => "2010.11.25.0002",
"2010.11.25.0002" => "2010.11.30.0000",
"2010.11.30.0000" => "2010.12.06.0000",
"2010.12.06.0000" => "2010.12.13.0000",
"2010.12.13.0000" => "2010.12.21.0000",
"2010.12.21.0000" => "2011.01.18.0000",
"2011.01.18.0000" => "2011.02.01.0000",
"2011.02.01.0000" => "2011.02.10.0000",
"2011.02.10.0000" => "2011.03.01.0000",
"2011.03.01.0000" => "2011.03.24.0000",
"2011.03.24.0000" => "2011.03.30.0000",
"2011.03.30.0000" => "2011.04.13.0000",
"2011.04.13.0000" => "2011.04.21.0000",
"2011.04.21.0000" => "2011.05.19.0000",
"2011.05.19.0000" => "2011.06.10.0000",
"2011.06.10.0000" => "2011.07.20.0000",
"2011.07.20.0000" => "2011.07.26.0000",
"2011.07.26.0000" => "2011.08.05.0000",
"2011.08.05.0000" => "2011.08.09.0000",
"2011.08.09.0000" => "2011.08.16.0000",
"2011.08.16.0000" => "2011.10.04.0000",
"2011.10.04.0000" => "2011.10.12.0001",
"2011.10.12.0001" => "2011.10.27.0000",
"2011.10.27.0000" => "2011.12.14.0000",
"2011.12.14.0000" => "2011.12.23.0000",
"2011.12.23.0000" => "2012.01.18.0000",
"2012.01.18.0000" => "2012.01.24.0000",
"2012.01.24.0000" => "2012.01.31.0000",
"2012.01.31.0000" => "2012.03.07.0000",
"2012.03.07.0000" => "2012.03.09.0000",
"2012.03.09.0000" => "2012.03.22.0000",
"2012.03.22.0000" => "2012.03.29.0000",
"2012.03.29.0000" => "2012.04.04.0000",
"2012.04.04.0000" => "2012.04.23.0001",
"2012.04.23.0001" => "2012.05.08.0000",
"2012.05.08.0000" => "2012.05.15.0000",
"2012.05.15.0000" => "2012.05.22.0000",
"2012.05.22.0000" => "2012.06.06.0000",
"2012.06.06.0000" => "2012.06.19.0000",
"2012.06.19.0000" => "2012.06.26.0000",
"2012.06.26.0000" => "2012.07.21.0000",
"2012.07.21.0000" => "2012.08.10.0000",
"2012.08.10.0000" => "2012.09.06.0000",
"2012.09.06.0000" => "2012.09.19.0001",
);
?>