mirror of
https://github.com/nextcloud/passman.git
synced 2025-10-07 03:56:34 +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';
|
$checkVersion = $this->config->getAppValue('passman', 'check_version', '1') === '1';
|
||||||
$localVersion = $this->appManager->getAppInfo('passman')["version"];
|
$localVersion = $this->appManager->getAppInfo('passman')["version"];
|
||||||
$githubVersion = $this->l->t('Unable to get version info');
|
$githubVersion = $this->l->t('Unable to get version info');
|
||||||
|
$githubReleaseUrl = null;
|
||||||
|
|
||||||
if ($checkVersion) {
|
if ($checkVersion) {
|
||||||
// get latest GitHub release version
|
// get latest GitHub release version
|
||||||
|
|
||||||
|
@ -71,6 +73,10 @@ class Admin implements ISettings {
|
||||||
$data = json_decode($json);
|
$data = json_decode($json);
|
||||||
if (isset($data->tag_name) && is_string($data->tag_name)) {
|
if (isset($data->tag_name) && is_string($data->tag_name)) {
|
||||||
$githubVersion = $data->tag_name;
|
$githubVersion = $data->tag_name;
|
||||||
|
|
||||||
|
if (isset($data->html_url) && is_string($data->html_url)) {
|
||||||
|
$githubReleaseUrl = $data->html_url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -82,6 +88,7 @@ class Admin implements ISettings {
|
||||||
return new TemplateResponse('passman', 'admin', [
|
return new TemplateResponse('passman', 'admin', [
|
||||||
'localVersion' => $localVersion,
|
'localVersion' => $localVersion,
|
||||||
'githubVersion' => $githubVersion,
|
'githubVersion' => $githubVersion,
|
||||||
|
'githubReleaseUrl' => $githubReleaseUrl,
|
||||||
'checkVersion' => $checkVersion,
|
'checkVersion' => $checkVersion,
|
||||||
], 'blank');
|
], 'blank');
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,14 @@ style('passman', 'vendor/font-awesome/font-awesome.min');
|
||||||
<h2><?php p($l->t('Passman Settings')); ?></h2>
|
<h2><?php p($l->t('Passman Settings')); ?></h2>
|
||||||
<?php
|
<?php
|
||||||
if ($_['checkVersion']) {
|
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 />';
|
print '<br />';
|
||||||
} ?>
|
} ?>
|
||||||
Local version: <?php p($_['localVersion']); ?><br/>
|
Local version: <?php p($_['localVersion']); ?><br/>
|
||||||
|
|
Loading…
Add table
Reference in a new issue