mirror of
https://github.com/antos-rde/antos-backend.git
synced 2025-09-29 06:21:07 +02:00
feat: add versions info to API
All checks were successful
gitea-sync/antos-backend/pipeline/head This commit looks good
All checks were successful
gitea-sync/antos-backend/pipeline/head This commit looks good
This commit is contained in:
@@ -20,7 +20,7 @@ function IndexController:doc(...)
|
||||
author = "Xuan Sang LE",
|
||||
email = "xsang.le@gmail.com",
|
||||
api_name = "AntOS API",
|
||||
version = "2.0.0-a",
|
||||
version = API_VERSION,
|
||||
documents = {
|
||||
vfs = HTTP_ROOT.."/VFS",
|
||||
user = HTTP_ROOT.."/user",
|
||||
|
@@ -17,7 +17,8 @@ function SystemController:index(...)
|
||||
["/packages"] = "Handle all operation relate to package: list, install, cache, uninstall",
|
||||
["/settings"] = "Save user setting",
|
||||
["/application"] = "Call a specific server side application api",
|
||||
["/apigateway"] = "Gateway for executing custom server side code"
|
||||
["/apigateway"] = "Gateway for executing custom server side code",
|
||||
["/version"] = "All component versions"
|
||||
}
|
||||
}
|
||||
result(api)
|
||||
@@ -248,3 +249,18 @@ function SystemController:apigateway(...)
|
||||
cout('{"error":"User unauthorized. Please login"}')
|
||||
end
|
||||
end
|
||||
|
||||
function SystemController:version(...)
|
||||
auth_or_die("User unauthorized. Please login")
|
||||
local versions = {}
|
||||
local version_file = string.format('%s/libs/versions.json', WWW_ROOT)
|
||||
if ulib.exists(version_file) then
|
||||
versions = JSON.decodeFile(version_file)
|
||||
end
|
||||
versions["REST"] = { version = API_VERSION, ref = "unknown" }
|
||||
if API_REF then
|
||||
versions["REST"]["ref"] = API_REF
|
||||
end
|
||||
result(versions)
|
||||
return false
|
||||
end
|
||||
|
Reference in New Issue
Block a user