Server: faster releases (cache hashes), per-version skip, longer signed-URL TTL

- gate.php : ETag now derived from size+mtime instead of md5_file($zip).
  Previously the gate hashed the entire 14 GB ZIP on every HEAD/GET call
  (including each of 8 parallel segments) → 30s-5min preparation lag for
  clients before the first byte. Now <1ms per request.
- SignManifest : disk-backed cache for SHA-256 keyed by (path,size,mtime).
  Re-signing 5×14 GB versions used to take ~25 min, now ~1s when nothing
  changed. New "Force re-hash" toggle in admin to ignore the cache.
- versions.php : per-row "🔁 Hash" button to sign a single version, plus
  a "⚙ Hash" dropdown to toggle hashAlgorithm:none for builds where the
  user accepts skipping client-side verification (manifest stays signed
  Ed25519, only the per-ZIP SHA-256 verification is bypassed).
- DownloadUrl.php : signed-URL TTL bumped 1h → 6h to cover slow ADSL users
  who need >1h to finish a 14 GB download.
- .gitignore : track server/builds/.htaccess + gate.php (still ignore the
  actual ZIP/exe binaries).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-02 19:14:32 +02:00
parent 0d4f126e3a
commit 962f5a8ce0
8 changed files with 406 additions and 32 deletions

View File

@@ -2,7 +2,11 @@
/**
* Wrapper CLI pour PSLauncher\Tools\SignManifest.
*
* Usage : cd ~/www/PS_Launcher && php tools/sign-manifest.php
* Usage :
* cd ~/www/PS_Launcher && php tools/sign-manifest.php
* php tools/sign-manifest.php --scope=launcher # ne re-signe que la section launcher
* php tools/sign-manifest.php --scope=versions # ne re-signe que les builds Proserve
* php tools/sign-manifest.php --force # ignore le cache, recalcule tous les SHA-256
*
* Le backoffice admin appelle directement la classe (pas d'exec).
*/
@@ -10,7 +14,15 @@ declare(strict_types=1);
require __DIR__ . '/SignManifest.php';
$scope = 'all';
$force = false;
foreach (array_slice($argv, 1) as $arg) {
if ($arg === '--force' || $arg === '-f') $force = true;
elseif (str_starts_with($arg, '--scope=')) $scope = substr($arg, 8);
elseif (in_array($arg, ['versions', 'launcher', 'all'], true)) $scope = $arg;
}
$signer = new \PSLauncher\Tools\SignManifest(dirname(__DIR__));
$result = $signer->run();
$result = $signer->run($scope, $force);
foreach ($result['log'] as $line) echo $line . "\n";
exit($result['ok'] ? 0 : 1);