diff --git a/app/Http/Admin/Controllers/IndexController.php b/app/Http/Admin/Controllers/IndexController.php index 4684800a..7b7b9da2 100644 --- a/app/Http/Admin/Controllers/IndexController.php +++ b/app/Http/Admin/Controllers/IndexController.php @@ -39,11 +39,13 @@ class IndexController extends Controller $todayStat = $indexService->getTodayStat(); $appInfo = $indexService->getAppInfo(); $serverInfo = $indexService->getServerInfo(); + $releases = $indexService->getReleases(); $this->view->setVar('global_stat', $globalStat); $this->view->setVar('today_stat', $todayStat); $this->view->setVar('app_info', $appInfo); $this->view->setVar('server_info', $serverInfo); + $this->view->setVar('releases', $releases); } /** diff --git a/app/Http/Admin/Services/Index.php b/app/Http/Admin/Services/Index.php index cf89b904..9febad0f 100644 --- a/app/Http/Admin/Services/Index.php +++ b/app/Http/Admin/Services/Index.php @@ -6,6 +6,7 @@ use App\Caches\SiteGlobalStat; use App\Caches\SiteTodayStat; use App\Library\AppInfo; use App\Library\Utils\ServerInfo; +use GuzzleHttp\Client; class Index extends Service { @@ -52,4 +53,17 @@ class Index extends Service return $cache->get(); } + public function getReleases() + { + $url = 'https://koogua.com/api-releases.json'; + + $client = new Client(); + + $response = $client->get($url, ['timeout' => 3]); + + $content = json_decode($response->getBody(), true); + + return $content['releases'] ?? []; + } + } diff --git a/app/Http/Admin/Views/index/index.volt b/app/Http/Admin/Views/index/index.volt index a676fc79..fd48a48a 100644 --- a/app/Http/Admin/Views/index/index.volt +++ b/app/Http/Admin/Views/index/index.volt @@ -63,7 +63,7 @@