mirror of
https://github.com/unraid/api.git
synced 2025-12-31 05:29:48 -06:00
feat: use patch version if needed on update check (#1227)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced version management so that update checks now prioritize combined version details obtained from patch data, ensuring more consistent and reliable version handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -95,6 +95,13 @@ class ServerState
|
||||
// echo "<pre>" . json_encode($this->webguiGlobals, JSON_PRETTY_PRINT) . "</pre>";
|
||||
|
||||
$this->var = $webguiGlobals['var'];
|
||||
|
||||
// If we're on a patch, we need to use the combinedVersion to check for updates
|
||||
if (file_exists('/tmp/Patcher/patches.json')) {
|
||||
$patchJson = @json_decode(@file_get_contents('/tmp/Patcher/patches.json'), true) ?: [];
|
||||
$this->var['version'] = $patchJson['combinedVersion'] ?? $this->var['version'];
|
||||
}
|
||||
|
||||
$this->nginxCfg = @parse_ini_file('/var/local/emhttp/nginx.ini') ?? [];
|
||||
|
||||
$this->state = strtoupper(empty($this->var['regCheck']) ? $this->var['regTy'] : $this->var['regCheck']);
|
||||
|
||||
@@ -115,7 +115,14 @@ class UnraidOsCheck
|
||||
|
||||
$params = [];
|
||||
$params['branch'] = plugin('category', self::PLG_PATH, 'stable');
|
||||
$params['current_version'] = plugin('version', self::PLG_PATH) ?: _var($var,'version');
|
||||
// Get current version from patches.json if it exists, otherwise fall back to plugin version or var.ini
|
||||
$patcherVersion = null;
|
||||
if (file_exists('/tmp/Patcher/patches.json')) {
|
||||
$patcherData = @json_decode(file_get_contents('/tmp/Patcher/patches.json'), true);
|
||||
$patcherVersion = $patcherData['combinedVersion'] ?? null;
|
||||
}
|
||||
|
||||
$params['current_version'] = $patcherVersion ?: plugin('version', self::PLG_PATH) ?: _var($var, 'version');
|
||||
if (_var($var,'regExp')) $params['update_exp'] = date('Y-m-d', _var($var,'regExp')*1);
|
||||
$defaultUrl = self::BASE_RELEASES_URL;
|
||||
// pass a param of altUrl to use the provided url instead of the default
|
||||
|
||||
Reference in New Issue
Block a user