-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathversion.php
More file actions
42 lines (37 loc) · 852 Bytes
/
version.php
File metadata and controls
42 lines (37 loc) · 852 Bytes
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
<?php
require __DIR__ . '/lib/bootstrap.inc.php';
$CD = new \Zotero\ClientDownloads([
'manifestsDir' => ROOT_DIR . "/manifests"
]);
$platform = !empty($_GET['platform']) ? $_GET['platform'] : null;
$channel = !empty($_GET['channel']) ? $_GET['channel'] : 'release';
switch ($channel) {
case 'release':
case 'beta':
case 'dev':
break;
default:
http_response_code(400);
exit;
}
header('Cache-Control: no-cache');
if ($platform) {
$version = $CD->getBuildVersion($channel, $platform);
if (!$version) {
http_response_code(400);
exit;
}
header('Content-Type: text/plain');
echo $version;
}
else {
$versions = [];
foreach ($CD->getPlatforms() as $p) {
$v = $CD->getBuildVersion($channel, $p);
if ($v) {
$versions[$p] = $v;
}
}
header('Content-Type: application/json');
echo json_encode($versions, JSON_PRETTY_PRINT) . "\n";
}