diff --git a/app/Http/Controllers/UpdateController.php b/app/Http/Controllers/UpdateController.php index bc2b132c..b5c6ad4f 100644 --- a/app/Http/Controllers/UpdateController.php +++ b/app/Http/Controllers/UpdateController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use Exception; use Updater; use Illuminate\Http\Request; @@ -58,4 +59,20 @@ class UpdateController extends Controller 'success' => $cp, ], 200); } + + public function changelog() + { + $url = base_path() . '/changelog.json'; + + try { + $changelog = json_decode(file_get_contents($url), true); + } catch(Exception $e) { + $changelog = []; + } + + return response()->json([ + 'method' => 'get changelog', + 'data' => $changelog + ], 200); + } } diff --git a/routes/api.php b/routes/api.php index cf4ecbda..73d4acde 100644 --- a/routes/api.php +++ b/routes/api.php @@ -42,6 +42,8 @@ Route::group([ 'middleware' => 'api', 'prefix' => 'update', ], function () { + Route::get('changelog', 'UpdateController@changelog') + ->name('update.changelog'); Route::get('check', 'UpdateController@checkForUpdate') ->name('update.check'); Route::get('download', 'UpdateController@downloadUpdate')