mirror of
https://github.com/nextcloud/passman.git
synced 2025-10-05 11:15:01 +08:00
add link to the latest github release
Signed-off-by: binsky <timo@binsky.org>
This commit is contained in:
parent
69d947c482
commit
2f7db824d5
2 changed files with 15 additions and 1 deletions
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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/>
|
||||
|
|
Loading…
Add table
Reference in a new issue