mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
Support for auto download parameter, dynamic OS /get routes, fix for dev analytics
This commit is contained in:
parent
74e0a9423b
commit
b96d016977
5 changed files with 20 additions and 8 deletions
|
@ -97,11 +97,10 @@ class Controller
|
|||
|
||||
$router->get(['/get', 'get'], 'DownloadActions::executeGet');
|
||||
$router->get(['/getrubin', 'getrubin'], 'DownloadActions::executeGet');
|
||||
$router->get(['/windows', 'get-windows'], 'DownloadActions::executeGet');
|
||||
$router->get(['/linux', 'get-linux'], 'DownloadActions::executeGet');
|
||||
$router->get(['/osx', 'get-osx'], 'DownloadActions::executeGet');
|
||||
$router->get(['/android', 'get-android'], 'DownloadActions::executeGet');
|
||||
$router->get(['/ios', 'get-ios'], 'DownloadActions::executeGet');
|
||||
foreach(array_keys(OS::getAll()) as $os)
|
||||
{
|
||||
$router->get(['/' . $os, 'get-' . $os], 'DownloadActions::executeGet');
|
||||
}
|
||||
$router->get('/roadmap', 'ContentActions::executeRoadmap');
|
||||
|
||||
$router->post('/quickstart/auth', 'DeveloperActions::executeQuickstartAuth');
|
||||
|
|
|
@ -40,6 +40,7 @@ class DownloadActions extends Actions
|
|||
'analyticsLabel' => $analyticsLabel,
|
||||
'buttonLabel' => $buttonLabel,
|
||||
'downloadUrl' => $asset ? $asset['browser_download_url'] : null,
|
||||
'isAuto' => Request::getParam('auto'),
|
||||
'os' => $os,
|
||||
'osTitle' => $osTitle,
|
||||
'osIcon' => $osIcon,
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
class OS
|
||||
{
|
||||
/*
|
||||
* if changing below constants, you should add permanent redirects for old OS names used in URLs
|
||||
*/
|
||||
const OS_ANDROID = 'android',
|
||||
OS_IOS = 'ios',
|
||||
OS_LINUX = 'linux',
|
||||
|
@ -32,7 +35,7 @@ class OS
|
|||
case 'pkg':
|
||||
return OS::OS_OSX;
|
||||
|
||||
case 'msi': // fallthrough
|
||||
case 'Fmsi': // fallthrough
|
||||
case 'exe':
|
||||
return OS::OS_WINDOWS;
|
||||
|
||||
|
|
|
@ -21,11 +21,19 @@
|
|||
<a class="btn-alt btn-large"
|
||||
download
|
||||
href="<?php echo $downloadUrl ?>"
|
||||
id="get-download-btn"
|
||||
data-facebook-track="1"
|
||||
data-analytics-category="Sign Up"
|
||||
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 ?>
|
||||
<br/>
|
||||
<span class="meta">
|
||||
<?php echo $version ?>,
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
|
||||
</script>
|
||||
<?php else: ?>
|
||||
<?php js_start() ?>
|
||||
<script>
|
||||
window.ga = function() { };
|
||||
console.log('Analytics partial skipped because this is a non-production instance.');
|
||||
<?php js_end() ?>
|
||||
</script>
|
||||
<?php endif ?>
|
Loading…
Add table
Reference in a new issue