diff options
author | binsky <timo@binsky.org> | 2022-04-24 21:11:59 +0300 |
---|---|---|
committer | binsky <timo@binsky.org> | 2022-04-24 21:11:59 +0300 |
commit | 2f7db824d582469f89ff85a8a08bd176ad6f4d84 (patch) | |
tree | f7a6fb7e47831bdc5fdbabc8d0cd1835efca6048 | |
parent | 69d947c482094497ee777a49921005f39a8c9009 (diff) |
add link to the latest github releaseimprove-github-release-info
Signed-off-by: binsky <timo@binsky.org>
-rw-r--r-- | lib/Settings/Admin.php | 7 | ||||
-rw-r--r-- | templates/admin.php | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index f71d0324..6e6f5ef3 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -58,6 +58,8 @@ class Admin implements ISettings { $checkVersion = $this->config->getAppValue('passman', 'check_version', '1') === '1'; $localVersion = $this->appManager->getAppInfo('passman')["version"]; $githubVersion = $this->l->t('Unable to get version info'); + $githubReleaseUrl = null; + if ($checkVersion) { // get latest GitHub release version @@ -71,6 +73,10 @@ class Admin implements ISettings { $data = json_decode($json); if (isset($data->tag_name) && is_string($data->tag_name)) { $githubVersion = $data->tag_name; + + if (isset($data->html_url) && is_string($data->html_url)) { + $githubReleaseUrl = $data->html_url; + } } } } catch (\Exception $e) { @@ -82,6 +88,7 @@ class Admin implements ISettings { return new TemplateResponse('passman', 'admin', [ 'localVersion' => $localVersion, 'githubVersion' => $githubVersion, + 'githubReleaseUrl' => $githubReleaseUrl, 'checkVersion' => $checkVersion, ], 'blank'); } diff --git a/templates/admin.php b/templates/admin.php index 71b38e9d..bee8264c 100644 --- a/templates/admin.php +++ b/templates/admin.php @@ -12,7 +12,14 @@ style('passman', 'vendor/font-awesome/font-awesome.min'); <h2><?php p($l->t('Passman Settings')); ?></h2> <?php if ($_['checkVersion']) { - p($l->t('GitHub version:') . ' ' . $_['githubVersion']); + if ($_['githubReleaseUrl']) { + p($l->t('GitHub version:')); + ?> + <a target="_blank" rel="noreferrer noopener" class="external" href="<?php p($_['githubReleaseUrl']); ?>"><?php p($_['githubVersion']); ?> ↗</a> + <?php + } else { + p($l->t('GitHub version:') . ' ' . $_['githubVersion']); + } print '<br />'; } ?> Local version: <?php p($_['localVersion']); ?><br/> |