1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
<?php
declare(strict_types=1);
require __DIR__ . '/releases.php';
/**
* zagan.bet download page.
*
* Lists every published app, terminal client and server, with version, size
* and SHA-256. The installers are stable links that ask latest.php for the
* newest build. The GPL source link points at the public git repository. No
* database, no JavaScript, no dependencies.
*/
$scan = scan_releases();
$releases = $scan['releases'];
$newest = $scan['newest_mtime'];
$base = rtrim(str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'] ?? '/')), '/');
if ($base === '.' || $base === '/') {
$base = '';
}
foreach ($releases as $kind => &$found) {
foreach ($found as &$release) {
$release['href'] = $base . '/bin/' . $kind . '/' . rawurlencode($release['file']);
}
}
unset($found, $release);
$all = array_merge($releases['gui'], $releases['client'], $releases['server']);
function e(?string $value): string
{
return htmlspecialchars($value ?? '', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
}
function human_size(int $bytes): string
{
if ($bytes >= 1048576) {
return number_format($bytes / 1048576, 1) . ' MB';
}
if ($bytes >= 1024) {
return number_format($bytes / 1024) . ' KB';
}
return $bytes . ' B';
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>żagań.bet</title>
<meta name="description" content="Official zagan.bet desktop app, terminal client and server downloads.">
<meta name="robots" content="noindex, nofollow, noarchive">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'">
</head>
<body>
<h1>żagań.bet</h1>
<p><a href="<?= e($base) ?>/play/"><strong>Play in your browser</strong></a> — no install, just an account.</p>
<p>Official desktop app, terminal client and server builds.</p>
<?php if ($newest > 0): ?>
<p>Builds published <?= e(gmdate('j M Y H:i', $newest)) ?> UTC.</p>
<?php endif; ?>
<h2>Desktop app</h2>
<p>Windows 10 or newer, or a Linux desktop. No terminal needed.</p>
<?php if ($releases['gui'] === []): ?>
<p>Nothing published yet.</p>
<?php else: ?>
<ul>
<?php foreach ($releases['gui'] as $release): ?>
<li><a href="<?= e($release['href']) ?>" download><?= e(PLATFORMS[$release['platform']] ?? ucfirst($release['platform'])) ?> <?= e($release['arch']) ?><?php if (isset(ARCHES[$release['arch']])): ?> (<?= e(ARCHES[$release['arch']]) ?>)<?php endif; ?> v<?= e($release['version']) ?> — <?= e(human_size($release['size'])) ?></a></li>
<?php endforeach; ?>
</ul>
<h3>Installers</h3>
<p>Downloads the newest build, checks its SHA-256 and installs it for your user.</p>
<ul>
<li><a href="<?= e($base) ?>/install.sh" download>Linux installer (bash)</a></li>
<li><a href="<?= e($base) ?>/install.ps1" download>Windows installer (PowerShell)</a></li>
</ul>
<?php endif; ?>
<h2>Terminal client</h2>
<p>Needs a terminal of at least 80×24 cells.</p>
<?php if ($releases['client'] === []): ?>
<p>Nothing published yet.</p>
<?php else: ?>
<ul>
<?php foreach ($releases['client'] as $release): ?>
<li><a href="<?= e($release['href']) ?>" download><?= e(PLATFORMS[$release['platform']] ?? ucfirst($release['platform'])) ?> <?= e($release['arch']) ?><?php if (isset(ARCHES[$release['arch']])): ?> (<?= e(ARCHES[$release['arch']]) ?>)<?php endif; ?> v<?= e($release['version']) ?> — <?= e(human_size($release['size'])) ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<h2>Server</h2>
<p>Generates its own TLS identity on first run.</p>
<?php if ($releases['server'] === []): ?>
<p>Nothing published yet.</p>
<?php else: ?>
<ul>
<?php foreach ($releases['server'] as $release): ?>
<li><a href="<?= e($release['href']) ?>" download><?= e(PLATFORMS[$release['platform']] ?? ucfirst($release['platform'])) ?> <?= e($release['arch']) ?><?php if (isset(ARCHES[$release['arch']])): ?> (<?= e(ARCHES[$release['arch']]) ?>)<?php endif; ?> v<?= e($release['version']) ?> — <?= e(human_size($release['size'])) ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if ($all !== []): ?>
<h2>SHA-256</h2>
<p>On Linux use <code>sha256sum <file></code>. On Windows use <code>Get-FileHash <file></code>.</p>
<p>Then simply check if the checksum matches with your file.</p>
<pre><?php
$sums = '';
foreach ($all as $release) {
$sums .= $release['sha256'] . ' ' . $release['file'] . "\n";
}
echo e($sums);
?></pre>
<?php endif; ?>
<h2>Source</h2>
<p>Zagan-Bet is free software under the GNU GPL v3 or later. The source for these builds is at <a href="https://git.2137697.xyz/zagan-bet">https://git.2137697.xyz/zagan-bet.git</a>.</p>
<h2>Running it</h2>
<p>Desktop app on Linux:</p>
<pre><code>chmod +x install.sh
./install.sh</code></pre>
<p>Desktop app on Windows (PowerShell):</p>
<pre><code>powershell -ExecutionPolicy Bypass -File .\install.ps1</code></pre>
<p>The installers fetch the newest build, verify its SHA-256, install it for your user and add a launcher.</p>
<p>Terminal client:</p>
<pre><code>chmod +x <downloaded-client>
./<downloaded-client></code></pre>
<p>Server, first run creates <code>identity.p12</code>, <code>key.pem</code> and <code>cert.pem</code>:</p>
<pre><code>chmod +x <downloaded-server>
./<downloaded-server> --init
./<downloaded-server> -i 0.0.0.0 -p 11525</code></pre>
<p>Terminal client on Windows: run the <code>.exe</code> from Windows Terminal or another real terminal.</p>
<p>Run <code>help</code> inside the terminal client; the server binary supports <code>--help</code>.</p>
</body>
</html>
|