Repositories | Polyback | Log in to see private repositories


polyback-website / bcef206a2944792d992fb4d0f10cb8969bd17386 / api/client/latest.php

820 bytes | parent directory

<?php require $_SERVER['DOCUMENT_ROOT'].'/api/private/core.php';

// Latest game client release for the Polygon Player bootstrapper.
// Published by polygon-engine's publish-release.sh into the shared assets volume:
//   clients/manifest.json = {"version":"...","builds":{"linux-x86_64-musl":{"url":"/client-releases/...","sha256":"...","size":N,"archive":"tar.gz"},...}}

use pizzaboxer\ProjectPolygon\Polygon;

header("content-type: application/json");
header("Cache-Control: no-cache");

$path = Polygon::GetSharedResource("assets/clients/manifest.json");
$data = file_exists($path) ? json_decode(file_get_contents($path), true) : null;
if (!is_array($data) || empty($data["version"]))
{
	http_response_code(404);
	die(json_encode(["error" => "No client release has been published yet"]));
}
die(json_encode($data));