mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-04 12:01:57 +00:00
Improve version handling.
This commit is contained in:
@@ -53,8 +53,8 @@ trait UpdateTrait
|
||||
/**
|
||||
* Parses the version check result in a human readable sentence.
|
||||
*
|
||||
* @param int $versionCheck
|
||||
* @param string $version
|
||||
* @param int $versionCheck
|
||||
* @param array $information
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -76,6 +76,16 @@ trait UpdateTrait
|
||||
'date' => $carbon->formatLocalized($monthAndDayFormat),
|
||||
]
|
||||
);
|
||||
// append warning if beta or alpha.
|
||||
$isBeta = $information['is_beta'] ?? false;
|
||||
if (true === $isBeta) {
|
||||
$return = sprintf('%s %s', $return, trans('firefly.update_version_beta'));
|
||||
}
|
||||
|
||||
$isAlpha = $information['is_alpha'] ?? false;
|
||||
if (true === $isAlpha) {
|
||||
$return = sprintf('%s %s', $return, trans('firefly.update_version_alpha'));
|
||||
}
|
||||
}
|
||||
|
||||
if (0 === $versionCheck) {
|
||||
|
||||
@@ -116,6 +116,8 @@ class UpdateController extends Controller
|
||||
$latestRelease = '1.0';
|
||||
$resultString = '';
|
||||
$versionCheck = -2;
|
||||
$channel = app('fireflyconfig')->get('update_channel', 'stable')->data;
|
||||
|
||||
try {
|
||||
$latestRelease = $this->getLatestRelease();
|
||||
} catch (FireflyException $e) {
|
||||
@@ -143,6 +145,11 @@ class UpdateController extends Controller
|
||||
}
|
||||
app('fireflyconfig')->set('last_update_check', time());
|
||||
|
||||
return response()->json(['result' => $resultString]);
|
||||
return response()->json(
|
||||
[
|
||||
'result' => $resultString,
|
||||
'channel' => $channel,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class UpdateRequest implements UpdateRequestInterface
|
||||
*/
|
||||
public function getVersion(string $channel): array
|
||||
{
|
||||
$uri = 'https://version.firefly-iii.org/index.json';
|
||||
$uri = config('firefly.update_endpoint');
|
||||
Log::debug(sprintf('Going to call %s', $uri));
|
||||
try {
|
||||
$client = new Client();
|
||||
|
||||
@@ -31,7 +31,7 @@ interface UpdateRequestInterface
|
||||
/**
|
||||
* @param string $channel
|
||||
*
|
||||
* @return string
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getVersion(string $channel): array;
|
||||
|
||||
Reference in New Issue
Block a user