From 2bcf13b750e72a63ea133304e287d2349349fdb4 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Fri, 9 Sep 2016 14:23:44 -0400 Subject: [PATCH] add windows installer redirect --- controller/Controller.class.php | 1 + controller/action/DownloadActions.class.php | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/controller/Controller.class.php b/controller/Controller.class.php index 768a266c..86c9fb53 100644 --- a/controller/Controller.class.php +++ b/controller/Controller.class.php @@ -110,6 +110,7 @@ class Controller '/plan.pdf' => 'https://www.dropbox.com/s/uevjrwnyr672clj/lbry-pln.pdf?dl=1', '/get/lbry.dmg' => DownloadActions::getDownloadUrl(DownloadActions::OS_OSX) ?: '/get', '/get/lbry.deb' => DownloadActions::getDownloadUrl(DownloadActions::OS_LINUX) ?: '/get', + '/get/lbry.msi' => DownloadActions::getDownloadUrl(DownloadActions::OS_WINDOWS) ?: '/get', ]; foreach ([302 => $tempRedirects, 301 => $permanentRedirects] as $code => $redirects) diff --git a/controller/action/DownloadActions.class.php b/controller/action/DownloadActions.class.php index f9710854..c49ce520 100644 --- a/controller/action/DownloadActions.class.php +++ b/controller/action/DownloadActions.class.php @@ -240,8 +240,9 @@ class DownloadActions extends Actions foreach ($releaseData['assets'] as $asset) { if ( - ($os == static::OS_LINUX && in_array($asset['content_type'], ['application/x-debian-package', 'application/x-deb'])) || - ($os == static::OS_OSX && in_array($asset['content_type'], ['application/x-diskcopy', 'application/x-apple-diskimage'])) + ($os == static::OS_LINUX && substr($asset['name'], -4) == '.deb') || + ($os == static::OS_OSX && substr($asset['name'], -4) == '.dmg') || + ($os == static::OS_WINDOWS && substr($asset['name'], -4) == '.msi') ) { return $asset['browser_download_url'];