mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 18:01:26 -06:00
Improve version handling.
This commit is contained in:
parent
9a028d5002
commit
cbc92d89e1
@ -53,8 +53,8 @@ trait UpdateTrait
|
|||||||
/**
|
/**
|
||||||
* Parses the version check result in a human readable sentence.
|
* Parses the version check result in a human readable sentence.
|
||||||
*
|
*
|
||||||
* @param int $versionCheck
|
* @param int $versionCheck
|
||||||
* @param string $version
|
* @param array $information
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -76,6 +76,16 @@ trait UpdateTrait
|
|||||||
'date' => $carbon->formatLocalized($monthAndDayFormat),
|
'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) {
|
if (0 === $versionCheck) {
|
||||||
|
@ -116,6 +116,8 @@ class UpdateController extends Controller
|
|||||||
$latestRelease = '1.0';
|
$latestRelease = '1.0';
|
||||||
$resultString = '';
|
$resultString = '';
|
||||||
$versionCheck = -2;
|
$versionCheck = -2;
|
||||||
|
$channel = app('fireflyconfig')->get('update_channel', 'stable')->data;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$latestRelease = $this->getLatestRelease();
|
$latestRelease = $this->getLatestRelease();
|
||||||
} catch (FireflyException $e) {
|
} catch (FireflyException $e) {
|
||||||
@ -143,6 +145,11 @@ class UpdateController extends Controller
|
|||||||
}
|
}
|
||||||
app('fireflyconfig')->set('last_update_check', time());
|
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
|
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));
|
Log::debug(sprintf('Going to call %s', $uri));
|
||||||
try {
|
try {
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
|
@ -31,7 +31,7 @@ interface UpdateRequestInterface
|
|||||||
/**
|
/**
|
||||||
* @param string $channel
|
* @param string $channel
|
||||||
*
|
*
|
||||||
* @return string
|
* @return array
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function getVersion(string $channel): array;
|
public function getVersion(string $channel): array;
|
||||||
|
@ -145,6 +145,7 @@ return [
|
|||||||
'disable_frame_header' => env('DISABLE_FRAME_HEADER', false),
|
'disable_frame_header' => env('DISABLE_FRAME_HEADER', false),
|
||||||
'login_provider' => envNonEmpty('LOGIN_PROVIDER', 'eloquent'),
|
'login_provider' => envNonEmpty('LOGIN_PROVIDER', 'eloquent'),
|
||||||
'cer_provider' => envNonEmpty('CER_PROVIDER', 'fixer'),
|
'cer_provider' => envNonEmpty('CER_PROVIDER', 'fixer'),
|
||||||
|
'update_endpoint' => 'https://version.firefly-iii.org/index.json',
|
||||||
'allowedMimes' => [
|
'allowedMimes' => [
|
||||||
/* plain files */
|
/* plain files */
|
||||||
'text/plain',
|
'text/plain',
|
||||||
|
@ -225,6 +225,8 @@ return [
|
|||||||
'admin_update_check_now_explain' => 'If you press the button, Firefly III will see if your current version is the latest.',
|
'admin_update_check_now_explain' => 'If you press the button, Firefly III will see if your current version is the latest.',
|
||||||
'check_for_updates_button' => 'Check now!',
|
'check_for_updates_button' => 'Check now!',
|
||||||
'update_new_version_alert' => 'A new version of Firefly III is available. You are running v:your_version, the latest version is v:new_version which was released on :date.',
|
'update_new_version_alert' => 'A new version of Firefly III is available. You are running v:your_version, the latest version is v:new_version which was released on :date.',
|
||||||
|
'update_version_beta' => 'This version is a BETA version. You may run into issues.',
|
||||||
|
'update_version_alpha' => 'This version is a ALPHA version. You may run into issues.',
|
||||||
'update_current_version_alert' => 'You are running v:version, which is the latest available release.',
|
'update_current_version_alert' => 'You are running v:version, which is the latest available release.',
|
||||||
'update_newer_version_alert' => 'You are running v:your_version, which is newer than the latest release, v:new_version.',
|
'update_newer_version_alert' => 'You are running v:your_version, which is newer than the latest release, v:new_version.',
|
||||||
'update_check_error' => 'An error occurred while checking for updates. Please view the log files.',
|
'update_check_error' => 'An error occurred while checking for updates. Please view the log files.',
|
||||||
|
Loading…
Reference in New Issue
Block a user