Move dashboard version check into version api endpoint

This commit is contained in:
James Brooks
2016-06-10 17:27:21 +01:00
parent 1425c15ee8
commit 947aa27e40
5 changed files with 21 additions and 22 deletions

View File

@@ -11,6 +11,13 @@
namespace CachetHQ\Cachet\Http\Controllers\Api;
use CachetHQ\Cachet\Integrations\Releases;
/**
* This is the general api controller.
*
* @author James Brooks <james@bluebaytravel.co.uk>
*/
class GeneralController extends AbstractApiController
{
/**
@@ -30,6 +37,11 @@ class GeneralController extends AbstractApiController
*/
public function version()
{
return $this->item(CACHET_VERSION);
$latest = app(Releases::class)->latest();
return $this->setMetaData([
'on_latest' => version_compare(CACHET_VERSION, $latest['tag_name']) === 1,
'latest' => $latest,
])->item(CACHET_VERSION);
}
}