diff --git a/controller/action/DownloadActions.class.php b/controller/action/DownloadActions.class.php
index 3c67397a..5d62de78 100644
--- a/controller/action/DownloadActions.class.php
+++ b/controller/action/DownloadActions.class.php
@@ -12,7 +12,7 @@ class DownloadActions extends Actions
public static function executeDownloadReleaseAsset(string $repo, string $ext, bool $allowPrerelease = false)
{
- return Controller::redirect(GitHub::getRepoReleaseUrl($repo, OS::getOsForExtension($ext), $allowPrerelease) ?: '/get', 302);
+ return Controller::redirect(GitHub::getRepoReleaseUrl($repo, $ext, $allowPrerelease) ?: '/get', 302);
}
public static function executeDownloadSnapshot(string $type)
@@ -40,6 +40,7 @@ class DownloadActions extends Actions
$osChoices = OS::getAll();
list($uri, $osTitle, $osIcon) = $osChoices[$os];
$params = [
+ 'preferredExt' => $os === Os::OS_LINUX ? 'AppImage' : '',
'osTitle' => $osTitle,
'osIcon' => $osIcon,
'osScreenshotSrc' => 'https://spee.ch/b/desktop-035-og.jpeg',
@@ -53,7 +54,7 @@ class DownloadActions extends Actions
}
else
{
- $asset = Github::getRepoAsset(GitHub::REPO_LBRY_DESKTOP, $os);
+ $asset = Github::getRepoAsset(GitHub::REPO_LBRY_DESKTOP, $os, $params['preferredExt']);
$params['downloadUrl'] = $asset ? $asset['browser_download_url'] : null;
}
@@ -132,21 +133,36 @@ class DownloadActions extends Actions
$os = static::guessOS();
if ($os && isset($osChoices[$os])) {
- list($uri, $osTitle, $osIcon, $buttonLabel, $analyticsLabel) = $osChoices[$os];
+ list($uri, $osTitle, $osIcon, $oldButtonLabel, $analyticsLabel) = $osChoices[$os];
if ($os !== OS::OS_ANDROID) {
- $asset = Github::getRepoAsset(GitHub::REPO_LBRY_DESKTOP, $os);
+ $asset = Github::getRepoAsset(GitHub::REPO_LBRY_DESKTOP, $os, $vars['preferredExt'] ?? '');
} else {
$asset = ['browser_download_url' => static::ANDROID_STORE_URL];
}
+ $buttonLabel = __('download.for-os2', ['%os%' => OS::OS_DETAIL($os)[1]]);
+ if (isset($vars['preferredExt']) && $vars['preferredExt']) {
+ $buttonLabel = __('Download .%ext%', ['%ext%' => $vars['preferredExt']]);
+ }
+
$vars += [
'analyticsLabel' => $analyticsLabel,
'buttonLabel' => $buttonLabel,
+ 'isDownload' => true,
'downloadUrl' => $asset ? $asset['browser_download_url'] : null,
'os' => $os,
+ 'skipRender' => isset($vars['preferredExt']) && $vars['preferredExt'] &&
+ substr_compare($asset['browser_download_url'], $vars['preferredExt'], -strlen($vars['preferredExt'])) !== 0,
'isAuto' => Request::getParam('auto'),
];
+
+
+
+ if ($os === OS::OS_LINUX && !isset($vars['preferredExt'])) {
+ $vars['isDownload'] = false;
+ $vars['downloadUrl'] = '/linux';
+ }
}
return $vars;
diff --git a/lib/thirdparty/Github.class.php b/lib/thirdparty/Github.class.php
index 247ceec9..857537c8 100644
--- a/lib/thirdparty/Github.class.php
+++ b/lib/thirdparty/Github.class.php
@@ -10,7 +10,7 @@ class Github
switch ($os) {
case OS::OS_LINUX:
return
- in_array($ext, ['deb']) ||
+ in_array($ext, ['deb', 'AppImage']) ||
in_array($asset['content_type'], ['application/x-debian-package', 'application/x-deb']) ||
stripos($asset['name'], 'linux') !== false;
case OS::OS_OSX:
@@ -30,7 +30,7 @@ class Github
}
}
- protected static function findReleaseAssetForOs(array $release, string $os)
+ protected static function findReleaseAsset(array $release, string $os, string $preferredExt = '')
{
if (!in_array($os, array_keys(OS::getAll()))) {
throw new DomainException('Unknown OS');
@@ -40,11 +40,21 @@ class Github
throw new Exception('Release array missing assets - possible GitHub auth failure, auth limit, and/or inspect releases array');
}
+ $bestAsset = null;
foreach ($release['assets'] as $asset) {
if (static::isAssetForOs($asset, $os)) {
- return $asset;
+ if (!$bestAsset) {
+ $bestAsset = $asset;
+ } else if ($os === Os::OS_LINUX) {
+ $ext = pathinfo($asset['name'], PATHINFO_EXTENSION);
+ if ($ext === $preferredExt || (!$preferredExt && $ext === 'AppImage')) {
+ $bestAsset = $asset;
+ }
+ }
}
}
+
+ return $bestAsset;
}
public static function getRepoRelease($repo, $prerelease = false, $cache = true)
@@ -63,16 +73,17 @@ class Github
return null;
}
- public static function getRepoAsset($repo, $os, $prerelease = false, $cache = true)
+ public static function getRepoAsset($repo, $os, $preferredExt = '', $prerelease = false, $cache = true)
{
$release = static::getRepoRelease($repo, $prerelease, $cache);
- return $release ? static::findReleaseAssetForOs($release, $os) : null;
+ return $release ? static::findReleaseAsset($release, $os, $preferredExt) : null;
}
- public static function getRepoReleaseUrl($repo, $os, bool $prerelease = false, $cache = true)
+ public static function getRepoReleaseUrl($repo, $ext, bool $prerelease = false, $cache = true)
{
- $asset = static::getRepoAsset($repo, $os, $prerelease, $cache);
+ $os = OS::getOsForExtension($ext);
+ $asset = static::getRepoAsset($repo, $os, $ext, $prerelease, $cache);
return $asset ? $asset['browser_download_url'] : null;
}
diff --git a/lib/tools/OS.class.php b/lib/tools/OS.class.php
index 12cf8e28..aaefd516 100644
--- a/lib/tools/OS.class.php
+++ b/lib/tools/OS.class.php
@@ -83,6 +83,7 @@ class OS
{
switch ($ext) {
case 'deb':
+ case 'AppImage':
return OS::OS_LINUX;
case 'dmg':
diff --git a/view/template/download/_downloadButton.php b/view/template/download/_downloadButton.php
index 8546303c..89ec6fd8 100644
--- a/view/template/download/_downloadButton.php
+++ b/view/template/download/_downloadButton.php
@@ -1,15 +1,24 @@
-
+
+
- OS::OS_DETAIL($os)[1]]) ?>
+
+
+
+
+
- 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.
+ We provide app builds as AppImage and .deb. For other Linux flavors including Arch and Flatpak support or compiling from source, see our GitHub install page.
Works with with macOS version 10.12.4 (Sierra), and higher.
diff --git a/view/template/download/get.php b/view/template/download/get.php
index d8006821..ef985f2d 100644
--- a/view/template/download/get.php
+++ b/view/template/download/get.php
@@ -19,8 +19,15 @@
Securely download the LBRY app here, and see what all the fuss is about!
'primary' + 'buttonStyle' => 'primary', + 'preferredExt' => $preferredExt ])?> + + 'primary', + 'preferredExt' => 'deb' + ])?> +You can also download our Android app directly