diff --git a/website/versioncheck/index.php b/website/versioncheck.php similarity index 70% rename from website/versioncheck/index.php rename to website/versioncheck.php index 831e199f..479d371c 100644 --- a/website/versioncheck/index.php +++ b/website/versioncheck.php @@ -1,8 +1,11 @@ Array ( # live release 'path' => 'release', 'name' => 'Stable release build', + 'web' => 'http://iitc.jonatkins.com/?page=download', ), 'jonatkins-test' => Array ( # public test builds 'path' => 'test', 'name' => 'Test build', + 'web' => 'http://iitc.jonatkins.com/?page=test', ), 'jonatkins-experimental' => Array ( # rarely used, for features not quite ready for 'test' 'path' => 'experimental', 'name' => 'Experimental build', + 'web' => 'http://iitc.jonatkins.com/?page=test&build=experimental', ), 'jonatkins-dev' => Array ( # personal 'path' => 'dev', 'name' => 'Development builds - not for public use', + 'web' => 'http://iitc.jonatkins.com/?page=test&build=dev', ), 'local' => Array ( # not a real build, but often the default for local development @@ -37,9 +44,35 @@ if ( array_key_exists ( $build, $details ) ) { $info = $details[$build]; - $response['buildPath'] = $info['path']; + $pageurl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? "https" : "http")."://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; + $response['name'] = $info['name']; + $dir = $info['path']; + + // load main script version + $iitc_details = loadUserScriptHeader ( "$dir/total-conversion-build.user.js" ); + $response['iitc'] = Array ( + 'version' => $iitc_details['@version'], + 'downloadUrl' => url_to_absolute ( $pageurl, "$dir/total-conversion-build.user.js" ), + 'pageUrl' => url_to_absolute ( $pageurl, $info['web'] ), + ); + + // and now the plugins + + $response['plugins'] = Array(); + + foreach ( glob ( "$dir/plugins/*.user.js" ) as $path ) + { + $basename = basename ( $path, ".user.js" ); + $details = loadUserScriptHeader ( $path ); + + $response['plugins'][$basename] = Array ( + 'version' => $details['@version'], + 'downloadUrl' => url_to_absolute ( $pageurl, "$dir/plugins/$basename.user.js" ), + 'pageUrl' => url_to_absolute ( $pageurl, $info['web']."#plugin-$basename" ), + ); + } } else