mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-31 09:21:26 +00:00
crappy android download
fix homepage systems link
This commit is contained in:
parent
6702e89a47
commit
eb2a0409a8
9 changed files with 139 additions and 57 deletions
|
@ -2,6 +2,9 @@
|
|||
|
||||
class DownloadActions extends Actions
|
||||
{
|
||||
//bad, fix me!
|
||||
const ANDROID_STORE_URL = 'https://play.google.com/store/apps/details?id=io.lbry.browser';
|
||||
|
||||
public static function executeGetAppRedirect(string $ext)
|
||||
{
|
||||
return Controller::redirect(GitHub::getAppDownloadUrl(OS::getOsForExtension($ext)) ?: '/get', 302);
|
||||
|
@ -25,17 +28,42 @@ class DownloadActions extends Actions
|
|||
return Controller::redirect($uri ?: '/quickstart', 302);
|
||||
}
|
||||
|
||||
/*
|
||||
* this is a quick fix to add android, prob not proper design
|
||||
*/
|
||||
public static function getGetTemplateParams($os)
|
||||
{
|
||||
$osChoices = OS::getAll();
|
||||
list($uri, $osTitle, $osIcon) = $osChoices[$os];
|
||||
$params = [
|
||||
'osTitle' => $osTitle,
|
||||
'osIcon' => $osIcon,
|
||||
'osScreenshotSrc' => 'https://spee.ch/@lbry:3f/lbry-redesign-preview.gif',
|
||||
'os' => $os
|
||||
];
|
||||
|
||||
if ($os === OS::OS_ANDROID)
|
||||
{
|
||||
$params['downloadUrl'] = static::ANDROID_STORE_URL;
|
||||
// $params['osScreenshotSrc'] = 'https://spee.ch/@lbry:3f/newurl.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$asset = Github::getAppAsset($os);
|
||||
$params['downloadUrl'] = $asset ? $asset['browser_download_url'] : null;
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
public static function executeGet()
|
||||
{
|
||||
$osChoices = OS::getAll();
|
||||
|
||||
$os = static::guessOS();
|
||||
|
||||
if (isset($os) && isset($osChoices[$os])) {
|
||||
list($uri, $osTitle, $osIcon, $buttonLabel, $analyticsLabel) = $osChoices[$os];
|
||||
$asset = Github::getAppAsset($os);
|
||||
$param = ['osTitle' => $osTitle, 'osIcon' => $osIcon, 'os' => $os, 'downloadUrl' => $asset ? $asset['browser_download_url'] : null];
|
||||
return ['download/get', $param];
|
||||
if (isset($os) && isset($osChoices[$os]) && !Request::getParam('showall')) {
|
||||
return ['download/get', static::getGetTemplateParams($os)];
|
||||
} else {
|
||||
return ['download/get-no-os'];
|
||||
}
|
||||
|
@ -101,25 +129,55 @@ class DownloadActions extends Actions
|
|||
|
||||
if ($os && isset($osChoices[$os])) {
|
||||
list($uri, $osTitle, $osIcon, $buttonLabel, $analyticsLabel) = $osChoices[$os];
|
||||
$release = Github::getAppRelease();
|
||||
$asset = Github::getAppAsset($os);
|
||||
|
||||
$vars += [
|
||||
'analyticsLabel' => $analyticsLabel,
|
||||
'buttonLabel' => $buttonLabel,
|
||||
'downloadUrl' => $asset ? $asset['browser_download_url'] : null,
|
||||
'meta' => true,
|
||||
'os' => $os,
|
||||
'osTitle' => $osTitle,
|
||||
'osIcon' => $osIcon,
|
||||
'releaseTimestamp' => $release ? strtotime($release['created_at']) : null,
|
||||
'size' => $asset ? $asset['size'] / (1024 * 1024) : 0, //bytes -> MB
|
||||
'sourceLink' => false,
|
||||
'version' => $release ? $release['name'] : null,
|
||||
'isAuto' => Request::getParam('auto'),
|
||||
];
|
||||
if ($os !== OS::OS_ANDROID) {
|
||||
$asset = Github::getAppAsset($os);
|
||||
} else {
|
||||
$asset = ['browser_download_url' => static::ANDROID_STORE_URL];
|
||||
}
|
||||
|
||||
$vars += [
|
||||
'analyticsLabel' => $analyticsLabel,
|
||||
'buttonLabel' => $buttonLabel,
|
||||
'downloadUrl' => $asset ? $asset['browser_download_url'] : null,
|
||||
'os' => $os,
|
||||
'isAuto' => Request::getParam('auto'),
|
||||
];
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
|
||||
public static function prepareMetaPartial(array $vars)
|
||||
{
|
||||
$osChoices = OS::getAll();
|
||||
|
||||
$os = static::guessOS();
|
||||
|
||||
if ($os && isset($osChoices[$os])) {
|
||||
list($uri, $osTitle, $osIcon, $buttonLabel, $analyticsLabel) = $osChoices[$os];
|
||||
|
||||
if ($os !== OS::OS_ANDROID) {
|
||||
$release = Github::getAppRelease();
|
||||
$asset = Github::getAppAsset($os);
|
||||
} else {
|
||||
$asset = ['browser_download_url' => static::ANDROID_STORE_URL, 'size' => 0];
|
||||
$release = [];
|
||||
}
|
||||
|
||||
$vars += [
|
||||
'os' => $os,
|
||||
'osTitle' => $osTitle,
|
||||
'osIcon' => $osIcon,
|
||||
'releaseTimestamp' => $release ? strtotime($release['created_at']) : null,
|
||||
'size' => $asset ? $asset['size'] / (1024 * 1024) : 0, //bytes -> MB
|
||||
'sourceLink' => false,
|
||||
'version' => $release ? $release['name'] : null,
|
||||
'isAuto' => Request::getParam('auto'),
|
||||
];
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}
|
||||
}
|
||||
|
|
4
lib/thirdparty/Github.class.php
vendored
4
lib/thirdparty/Github.class.php
vendored
|
@ -8,6 +8,10 @@ class Github
|
|||
throw new DomainException('Unknown OS');
|
||||
}
|
||||
|
||||
if (!isset($release['assets'])) {
|
||||
throw new Exception('Release array missing assets - possible GitHub auth failure, auth limit, and/or inspect releases array');
|
||||
}
|
||||
|
||||
foreach ($release['assets'] as $asset) {
|
||||
$ext = substr($asset['name'], -4);
|
||||
if (
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php if ($downloadUrl): ?>
|
||||
<div class="spacer-half">
|
||||
<?php if ($os !== OS::OS_ANDROID): ?>
|
||||
<a class="btn-<?php echo $buttonStyle?> btn-large"
|
||||
download
|
||||
href="<?php echo $downloadUrl ?>"
|
||||
|
@ -9,31 +9,17 @@
|
|||
data-analytics-action="Download"
|
||||
data-analytics-label="<?php echo $analyticsLabel ?>"
|
||||
><?php echo $buttonLabel ?></a>
|
||||
<?php if ($isAuto): ?>
|
||||
<?php js_start() ?>
|
||||
var anchor = document.getElementById('get-download-btn');
|
||||
ga('send', 'event', anchor.getAttribute('data-analytics-category'), anchor.getAttribute('data-analytics-action'), anchor.getAttribute('data-analytics-label'));
|
||||
setTimeout(function() { window.location = anchor.getAttribute('href'); }, 500);
|
||||
<?php js_end() ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php if ($meta): ?>
|
||||
<div class="meta">
|
||||
Version <?php echo $version ?>,
|
||||
<?php echo number_format($size, 1) ?> MB,
|
||||
built on <?php echo date('F d', $releaseTimestamp) ?>
|
||||
at <?php echo date('g:i:s A', $releaseTimestamp) ?> UTC
|
||||
</div>
|
||||
<?php if ($os === OS::OS_LINUX): ?>
|
||||
<div class="meta">
|
||||
Works with Ubuntu, Debian, or any distro with <code>apt</code> or <code>dpkg</code>.
|
||||
For other Linux flavors including Arch and Flatpak support or compiling from source, <a href="https://github.com/lbryio/lbry-desktop#install" class="link-primary">see our GitHub install page</a>.
|
||||
</div>
|
||||
<?php elseif ($sourceLink): ?>
|
||||
<div class="meta">
|
||||
Like source code? Go <a href="https://github.com/lbryio/lbry-desktop" class="link-primary">here</a>.<P><P>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php else: ?>
|
||||
<a href="<?php echo $downloadUrl ?>" class="btn--google-play">
|
||||
<img alt="<?php echo $buttonLabel ?>" src="https://play.google.com/intl/en_us/badges/images/badge_new.png"/>
|
||||
</a>
|
||||
<?php endif ?>
|
||||
<?php if ($isAuto): ?>
|
||||
<?php js_start() ?>
|
||||
var anchor = document.getElementById('get-download-btn');
|
||||
ga('send', 'event', anchor.getAttribute('data-analytics-category'), anchor.getAttribute('data-analytics-action'), anchor.getAttribute('data-analytics-label'));
|
||||
setTimeout(function() { window.location = anchor.getAttribute('href'); }, 500);
|
||||
<?php js_end() ?>
|
||||
<?php endif ?>
|
||||
<?php else: ?>
|
||||
<a href="/get" class="btn-<?php echo $buttonStyle ?> btn-large">Download LBRY</a><BR>
|
||||
|
|
14
view/template/download/_meta.php
Normal file
14
view/template/download/_meta.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<div class="meta">
|
||||
Version <?php echo $version ?>,
|
||||
<?php echo number_format($size, 1) ?> MB,
|
||||
built on <?php echo date('F d', $releaseTimestamp) ?>
|
||||
at <?php echo date('g:i:s A', $releaseTimestamp) ?> UTC
|
||||
<?php if ($os === OS::OS_LINUX): ?>
|
||||
<br/>
|
||||
Works with Ubuntu, Debian, or any distro with <code>apt</code> or <code>dpkg</code>.
|
||||
For other Linux flavors including Arch and Flatpak support or compiling from source, <a href="https://github.com/lbryio/lbry-desktop#install" class="link-primary">see our GitHub install page</a>.
|
||||
<?php elseif ($sourceLink): ?>
|
||||
<br/>
|
||||
Like source code? Go <a href="https://github.com/lbryio/lbry-desktop" class="link-primary">here</a>.
|
||||
<?php endif ?>
|
||||
</div>
|
|
@ -10,7 +10,6 @@
|
|||
</div>
|
||||
<div class="span6">
|
||||
<?php echo View::render('download/_social', [
|
||||
'cssClasses' => $socialCssClasses
|
||||
]) ?>
|
||||
</div>
|
||||
</main>
|
||||
|
|
|
@ -13,11 +13,18 @@
|
|||
<p>
|
||||
</p>
|
||||
<div class="text-center">
|
||||
<?php echo View::Render('download/_downloadButton', [
|
||||
'buttonStyle' => 'alt',
|
||||
'sourceLink' => true
|
||||
])?>
|
||||
<img src="https://spee.ch/7/lbry-redesign-preview.gif" />
|
||||
<?php $metaHtml = $os !== OS::OS_ANDROID ? View::Render('download/_meta') : false ?>
|
||||
<div class="<?php echo $metaHtml ? 'spacer-half' : 'spacer1' ?>">
|
||||
<?php echo View::Render('download/_downloadButton', [
|
||||
'buttonStyle' => 'alt'
|
||||
])?>
|
||||
</div>
|
||||
<?php if ($metaHtml): ?>
|
||||
<div class="spacer1">
|
||||
<?php echo $metaHtml ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<img src="<?php echo $osScreenshotSrc ?>" />
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<p>{{download.unavailable}}</p>
|
||||
|
|
|
@ -14,7 +14,11 @@
|
|||
<h3 class="cover-subtitle cover-title-flat">You own your data. You control the network. Indeed, you <em>are</em> the network.</h3>
|
||||
<h3 class="cover-subtitle cover-title-flat">Hollywood films, college lessons, amazing streamers and more are on the first media network ruled by <em>you</em>.</h3>
|
||||
</div>
|
||||
<div class="spacer2 text-center">
|
||||
<?php echo View::render('download/_downloadButton', ['buttonStyle' => 'primary','meta' => false,])?>
|
||||
<div class="spacer-half text-center">
|
||||
<?php echo View::render('download/_downloadButton', ['buttonStyle' => 'primary'])?>
|
||||
</div>
|
||||
<div class="meta text-center">
|
||||
<a href="/get?showall=1" class="link-primary">show all systems</a>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
<?php echo View::render('download/_downloadButton', [
|
||||
'buttonLabel' => "Try the App",
|
||||
'buttonStyle' => 'primary',
|
||||
'meta' => false,
|
||||
])?>
|
||||
</div>
|
||||
<div class="meta cover-item--outline">
|
||||
|
@ -36,7 +35,6 @@
|
|||
<?php echo View::render('download/_downloadButton', [
|
||||
'buttonLabel' => "Download LBRY",
|
||||
'buttonStyle' => 'alt',
|
||||
'meta' => false
|
||||
])?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -147,6 +147,18 @@ a:hover img
|
|||
{
|
||||
@include anchor($color-primary);
|
||||
}
|
||||
|
||||
/*please kill this*/
|
||||
.btn--google-play
|
||||
{
|
||||
$height-btn-google-play: 46px;
|
||||
height: $height-btn-google-play;
|
||||
line-height: $height-btn-google-play;
|
||||
padding: 0 30px;
|
||||
display: inline-block;
|
||||
> img { max-height: $height-btn-google-play; display: inline !important; }
|
||||
}
|
||||
|
||||
.btn-large
|
||||
{
|
||||
height: $spacing-vertical * 2;
|
||||
|
|
Loading…
Add table
Reference in a new issue