Verified Commit 21acfe9d authored by noplanman's avatar noplanman

Initial visual code cleanup, no functionality change at all.

parent 97c9b20c
<?php
$api_url = "https://bauerj:" . getenv("API_KEY") . "@api.bintray.com/packages/borg-binary-builder/borg-binaries/borg-binaries/files";
$_files = file_get_contents($api_url);
$_files = json_decode($_files);
function human_filesize($bytes, $decimals = 2) {
$sz = 'BKMGTP';
$factor = floor((strlen($bytes) - 1) / 3);
$suff = @$sz[$factor];
if ($suff != "B") $suff .= "iB";
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . $suff;
$api_url = 'https://bauerj:' . getenv('API_KEY') . '@api.bintray.com/packages/borg-binary-builder/borg-binaries/borg-binaries/files';
$_files = file_get_contents($api_url);
$_files = json_decode($_files, false);
function human_filesize($bytes, $decimals = 2)
{
$sz = 'BKMGTP';
$factor = floor((strlen($bytes) - 1) / 3);
$suff = @$sz[$factor];
if ($suff != 'B') {
$suff .= 'iB';
}
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . $suff;
}
$versions = [];
$files = [];
$files = [];
foreach ($_files as $file) {
$versions[] = $file->version;
$versions[] = $file->version;
$files[$file->name] = $file;
}
uasort($files, function($a, $b) {
uasort($files, static function ($a, $b) {
return version_compare($b->version, $a->version);
});
usort($versions, "version_compare");
usort($versions, 'version_compare');
$stable = array_pop($versions);
$binaries = [];
foreach (["armv5", "armv6", "arm64"] as $flavor) {
foreach (['armv5', 'armv6', 'arm64'] as $flavor) {
$binaries[$flavor] = [
"version" => $files["borg-$stable-$flavor"]->version,
"size" => $files["borg-$stable-$flavor"]->size,
"sha256" => $files["borg-$stable-$flavor"]->sha256,
"url" => "https://dl.bintray.com/borg-binary-builder/borg-binaries/borg-$stable-$flavor"
'version' => $files["borg-{$stable}-{$flavor}"]->version,
'size' => $files["borg-{$stable}-{$flavor}"]->size,
'sha256' => $files["borg-{$stable}-{$flavor}"]->sha256,
'url' => "https://dl.bintray.com/borg-binary-builder/borg-binaries/borg-{$stable}-{$flavor}",
];
}
......@@ -48,10 +51,14 @@ fclose($fp);
font-weight: 700;
src: local('Encode Sans'), url(_assets/EncodeSans-Regular.woff) format('woff');
}
body {
font-family: 'EncodeSans';
}
.container { padding: 25px; }
.container {
padding: 25px;
}
</style>
<style>
</style>
......@@ -65,7 +72,7 @@ fclose($fp);
<span class="flavor">
<a class="download" href="https://dl.bintray.com/borg-binary-builder/borg-binaries/borg-<?= $stable ?>-armv5">
<h2>ARMv5 / ARMv4t</h2><br>
<b class="download-link">Borg <?= $stable ?><br><br><?= human_filesize($files["borg-$stable-armv5"]->size) ?></b>
<b class="download-link">Borg <?= $stable ?><br><br><?= human_filesize($files["borg-{$stable}-armv5"]->size) ?></b>
</a>
<span class="description">
This version is built for 32Bit-ARM CPUs without a Floating-Point-Unit (ARM v4t and v5).<br>
......@@ -80,7 +87,7 @@ fclose($fp);
<span class="flavor">
<a class="download" href="https://dl.bintray.com/borg-binary-builder/borg-binaries/borg-<?= $stable ?>-armv6">
<h2>ARMv7 / ARMv6</h2><br>
<b class="download-link">Borg <?= $stable ?><br><br><?= human_filesize($files["borg-$stable-armv6"]->size) ?></b>
<b class="download-link">Borg <?= $stable ?><br><br><?= human_filesize($files["borg-{$stable}-armv6"]->size) ?></b>
</a>
<span class="description">
This version is built for 32Bit-ARM CPUs with a Floating-Point-Unit (ARM v6 and v7).<br>
......@@ -96,7 +103,7 @@ fclose($fp);
<span class="flavor">
<a class="download" href="https://dl.bintray.com/borg-binary-builder/borg-binaries/borg-<?= $stable ?>-arm64">
<h2>ARMv8 (or ARM64)</h2><br>
<b class="download-link">Borg <?= $stable ?><br><br><?= human_filesize($files["borg-$stable-arm64"]->size) ?></b>
<b class="download-link">Borg <?= $stable ?><br><br><?= human_filesize($files["borg-{$stable}-arm64"]->size) ?></b>
</a>
<span class="description">
This version is built for modern 64Bit-ARM CPUs (ARM v8).<br>
......@@ -108,29 +115,29 @@ fclose($fp);
</span>
</span>
<h2>Frequently Asked Questions</h2>
<div class="container">
<h3>Which version should I choose?</h3>
There is probably only one version that's going to run on your device. Run <span class="code">uname -m</span> and choose the version that's named similar to the output.
</div>
<div class="container">
<h3>Which dependencies do I need?</h3>
These binaries should work on the specified platform without installing any dependencies except for libc.<br> You can find more
information about how to use them in the <a href="https://borgbackup.readthedocs.io/en/stable/installation.html#standalone-binary">borg documentation</a>.
</div>
<div class="container">
<h3>How can I check the authenticity of the binaries?</h3>
All binaries are signed with PGP key <a href="/borg-binary-builder.asc"><i>A96A45C9</i></a>.
</div>
<div class="container">
<h3>Where can I submit bug reports or feature requests?</h3>
Please open an issue <a href="https://git.feneas.org/borg-binary-builder/borg-binaries">here</a>.
</div>
<div class="container">
<h3>Can I use a script to check this website for updates?</h3>
Yes, but please use <a href="/binaries.json">this JSON representation</a> in stead of this website. Also, please note that excessive polling might get you banned.
</div>
<h2>Frequently Asked Questions</h2>
<div class="container">
<h3>Which version should I choose?</h3>
There is probably only one version that's going to run on your device. Run <span class="code">uname -m</span> and choose the version that's named similar to the output.
</div>
<div class="container">
<h3>Which dependencies do I need?</h3>
These binaries should work on the specified platform without installing any dependencies except for libc.<br> You can find more
information about how to use them in the <a href="https://borgbackup.readthedocs.io/en/stable/installation.html#standalone-binary">borg documentation</a>.
</div>
<div class="container">
<h3>How can I check the authenticity of the binaries?</h3>
All binaries are signed with PGP key <a href="/borg-binary-builder.asc"><i>A96A45C9</i></a>.
</div>
<div class="container">
<h3>Where can I submit bug reports or feature requests?</h3>
Please open an issue <a href="https://git.feneas.org/borg-binary-builder/borg-binaries">here</a>.
</div>
<div class="container">
<h3>Can I use a script to check this website for updates?</h3>
Yes, but please use <a href="/binaries.json">this JSON representation</a> in stead of this website. Also, please note that excessive polling might get you banned.
</div>
<h2>Archive</h2>
</div>
<div id="view" class="view-details view-size-20">
......@@ -141,15 +148,15 @@ Yes, but please use <a href="/binaries.json">this JSON representation</a> in ste
<a class="date descending"><span class="l10n-lastModified">Changed</span></a>
<a class="size"><span class="l10n-size">Size</span></a>
</li>
<?php foreach ($files as $f) { ?>
<li class="item file">
<a href="https://dl.bintray.com/borg-binary-builder/borg-binaries/<?= $f->name ?>">
<span class="label" title="<?= $f->name ?>"><?= $f->name ?></span>
<span class="date" data-time="<?= $f->created ?>"><?= $f->created ?></span>
<span class="size" data-bytes="<?= $f->size ?>"><?= human_filesize($f->size) ?></span>
</span></a>
</li>
<?php }?>
<?php foreach ($files as $f) : ?>
<li class="item file">
<a href="https://dl.bintray.com/borg-binary-builder/borg-binaries/<?= $f->name ?>">
<span class="label" title="<?= $f->name ?>"><?= $f->name ?></span>
<span class="date" data-time="<?= $f->created ?>"><?= $f->created ?></span>
<span class="size" data-bytes="<?= $f->size ?>"><?= human_filesize($f->size) ?></span>
</span></a>
</li>
<?php endforeach; ?>
</ul>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment