mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
feat: store Koel version in a .version config file instead
This commit is contained in:
parent
2e5b9b642e
commit
e284a40d0d
5 changed files with 9 additions and 23 deletions
1
.version
Normal file
1
.version
Normal file
|
@ -0,0 +1 @@
|
|||
v5.0.1
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Foundation\Application as IlluminateApplication;
|
||||
|
||||
/**
|
||||
* Extends \Illuminate\Foundation\Application to override some defaults.
|
||||
*/
|
||||
class Application extends IlluminateApplication
|
||||
{
|
||||
/**
|
||||
* Current Koel version. Must start with a v, and is synced with git tags/releases.
|
||||
*
|
||||
* @see https://github.com/koel/koel/releases
|
||||
*/
|
||||
public const KOEL_VERSION = 'v5.0.1';
|
||||
}
|
|
@ -65,3 +65,8 @@ function artist_image_url(string $fileName): string
|
|||
{
|
||||
return static_url(config('koel.artist_image_dir') . $fileName);
|
||||
}
|
||||
|
||||
function koel_version(): string
|
||||
{
|
||||
return trim(file_get_contents(base_path('.version')));
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Application;
|
||||
use App\Models\User;
|
||||
use App\Repositories\InteractionRepository;
|
||||
use App\Repositories\PlaylistRepository;
|
||||
|
@ -75,10 +74,10 @@ class DataController extends Controller
|
|||
'supportsTranscoding' => config('koel.streaming.ffmpeg_path')
|
||||
&& is_executable(config('koel.streaming.ffmpeg_path')),
|
||||
'cdnUrl' => static_url(),
|
||||
'currentVersion' => Application::KOEL_VERSION,
|
||||
'currentVersion' => koel_version(),
|
||||
'latestVersion' => $this->currentUser->is_admin
|
||||
? $this->applicationInformationService->getLatestVersionNumber()
|
||||
: Application::KOEL_VERSION,
|
||||
: koel_version(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Application;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Contracts\Cache\Repository as Cache;
|
||||
use Illuminate\Log\Logger;
|
||||
|
@ -36,7 +35,7 @@ class ApplicationInformationService
|
|||
} catch (Throwable $e) {
|
||||
$this->logger->error($e);
|
||||
|
||||
return Application::KOEL_VERSION;
|
||||
return koel_version();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue