Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions app/Http/Controllers/Api/VersionController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;

class VersionController extends Controller
{
/**
* Get the current version of Snipe-IT
*
* @author [Nebelkreis] [https://github.com/NebelKreis]
*
* @return JsonResponse Returns JSON response with version information
*/
public function index(): JsonResponse
{
return response()->json(
[
'version' => config('version.app_version'),
'build_version' => config('version.build_version'),
'hash_version' => config('version.hash_version'),
'full_version' => config('version.full_app_version')
]
);
}
}
47 changes: 22 additions & 25 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -957,21 +957,20 @@
Api\SettingsController::class,
'downloadBackup'
]
)->name('api.settings.backups.download');

});

Route::resource('settings',
Api\SettingsController::class,
['names' => [
'show' => 'api.settings.show',
'update' => 'api.settings.update',
'store' => 'api.settings.store',
],
'except' => ['create', 'edit', 'index', 'destroy'],
'parameters' => ['setting' => 'setting_id'],
]
); // end settings API
)->name('api.settings.backups.download');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this? We don't allow updating most of the settings via API.


Route::resource('settings',
Api\SettingsController::class,
['names' => [
'show' => 'api.settings.show',
'update' => 'api.settings.update',
'store' => 'api.settings.store',
],
'except' => ['create', 'edit', 'index', 'destroy'],
'parameters' => ['setting' => 'setting_id'],
]
);
}); // end settings API


/**
Expand Down Expand Up @@ -1317,18 +1316,16 @@


/**
* Version API routes
*/

Route::get('/version', function () {
return response()->json(
[
'version' => config('version.app_version'),
], 200);
}); // end version api routes
* Version API routes
*/ Route::get('/version',
[
Api\VersionController::class,
'index'
]
)->name('api.version.index'); // end version api routes


Route::fallback(function () {
Route::fallback(function () {
return response()->json(
[
'status' => 'error',
Expand Down
Loading