feat: compare store ID

This commit is contained in:
Phan An 2024-01-07 20:02:05 +01:00
parent 4012f8d0fb
commit d5d78afa76
3 changed files with 11 additions and 0 deletions

View file

@ -28,6 +28,7 @@ class AlbumRepository extends Repository
/** @return Collection|array<array-key, Album> */
public function getMostPlayed(int $count = 6, ?User $user = null): Collection
{
/** @var ?User $user */
$user ??= $this->auth->user();
$query = Album::query()

View file

@ -28,6 +28,10 @@ class LicenseService
'instance_name' => 'Koel Plus',
]);
if ($response->meta->store_id !== config('lemonsqueezy.store_id')) {
throw new FailedToActivateLicenseException('This license key is not from Koels official store.');
}
return $this->updateOrCreateLicenseFromApiResponse($response);
} catch (ClientException $e) {
throw new FailedToActivateLicenseException(json_decode($e->getResponse()->getBody())->error, $e->getCode());

6
config/lemonsqueezy.php Normal file
View file

@ -0,0 +1,6 @@
<?php
return [
'store_id' => 62685,
'store_url' => 'https://store.plus.koel.dev',
];