diff --git a/controller/action/DownloadActions.class.php b/controller/action/DownloadActions.class.php index d4e680d0..64c59e2d 100644 --- a/controller/action/DownloadActions.class.php +++ b/controller/action/DownloadActions.class.php @@ -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; + } } diff --git a/lib/thirdparty/Github.class.php b/lib/thirdparty/Github.class.php index 9e85dee0..686b34ff 100644 --- a/lib/thirdparty/Github.class.php +++ b/lib/thirdparty/Github.class.php @@ -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 ( diff --git a/view/template/download/_downloadButton.php b/view/template/download/_downloadButton.php index a67f8cf9..01bce231 100644 --- a/view/template/download/_downloadButton.php +++ b/view/template/download/_downloadButton.php @@ -1,5 +1,5 @@ -
+ - - - 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); - - -
- -
- Version , - MB, - built on - at UTC -
- -
- Works with Ubuntu, Debian, or any distro with apt or dpkg. - For other Linux flavors including Arch and Flatpak support or compiling from source, see our GitHub install page. -
- -
- Like source code? Go here.

-

- + + + <?php echo $buttonLabel ?> + + + + + 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); + Download LBRY
diff --git a/view/template/download/_meta.php b/view/template/download/_meta.php new file mode 100644 index 00000000..165eedb1 --- /dev/null +++ b/view/template/download/_meta.php @@ -0,0 +1,14 @@ +
+ Version , + MB, + built on + at UTC + +
+ Works with Ubuntu, Debian, or any distro with apt or dpkg. + For other Linux flavors including Arch and Flatpak support or compiling from source, see our GitHub install page. + +
+ Like source code? Go here. + +
\ No newline at end of file diff --git a/view/template/download/get-no-os.php b/view/template/download/get-no-os.php index a7cf064d..2cb9d97e 100644 --- a/view/template/download/get-no-os.php +++ b/view/template/download/get-no-os.php @@ -10,7 +10,6 @@
$socialCssClasses ]) ?>
diff --git a/view/template/download/get.php b/view/template/download/get.php index ba0a5948..8acf1100 100644 --- a/view/template/download/get.php +++ b/view/template/download/get.php @@ -13,11 +13,18 @@

- 'alt', - 'sourceLink' => true - ])?> - + +
+ 'alt' + ])?> +
+ +
+ +
+ +

{{download.unavailable}}

diff --git a/view/template/page/home.php b/view/template/page/home.php index 8c485d8e..3172e11c 100644 --- a/view/template/page/home.php +++ b/view/template/page/home.php @@ -14,7 +14,11 @@

You own your data. You control the network. Indeed, you are the network.

Hollywood films, college lessons, amazing streamers and more are on the first media network ruled by you.

-
- 'primary','meta' => false,])?> +
+ 'primary'])?> +
+
+ show all systems +
diff --git a/view/template/page/rubin.php b/view/template/page/rubin.php index 0d967419..7f5578bc 100644 --- a/view/template/page/rubin.php +++ b/view/template/page/rubin.php @@ -16,7 +16,6 @@ "Try the App", 'buttonStyle' => 'primary', - 'meta' => false, ])?>
@@ -36,7 +35,6 @@ "Download LBRY", 'buttonStyle' => 'alt', - 'meta' => false ])?>
diff --git a/web/scss/_basic.scss b/web/scss/_basic.scss index cc41767b..d36dc3c3 100644 --- a/web/scss/_basic.scss +++ b/web/scss/_basic.scss @@ -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;