Commit a1000da7 by xiongguangjie

add get version restful api

parent 6382fcb3
{ {
"info": { "info": {
"_postman_id": "fe6cdfbd-531d-45e6-87e5-d460ce9e6328", "_postman_id": "4626d766-16b5-4255-89ba-f7614de2398c",
"name": "ZLMediaKit", "name": "ZLMediaKit",
"description": "媒体服务器", "description": "媒体服务器",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
...@@ -1087,7 +1087,7 @@ ...@@ -1087,7 +1087,7 @@
}, },
{ {
"key": "speed", "key": "speed",
"value": 2.0, "value": "2.0",
"description": "要设置的录像倍速" "description": "要设置的录像倍速"
} }
] ]
...@@ -1690,6 +1690,31 @@ ...@@ -1690,6 +1690,31 @@
} }
}, },
"response": [] "response": []
},
{
"name": "获取版本信息(version)",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{ZLMediaKit_URL}}/index/api/version?secret={{ZLMediaKit_secret}}",
"host": [
"{{ZLMediaKit_URL}}"
],
"path": [
"index",
"api",
"version"
],
"query": [
{
"key": "secret",
"value": "{{ZLMediaKit_secret}}"
}
]
}
},
"response": []
} }
], ],
"event": [ "event": [
......
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
#include <tchar.h> #include <tchar.h>
#endif // _WIN32 #endif // _WIN32
#if defined(ENABLE_VERSION)
#include "version.h"
#endif
using namespace std; using namespace std;
using namespace Json; using namespace Json;
using namespace toolkit; using namespace toolkit;
...@@ -1542,6 +1546,18 @@ void installWebApi() { ...@@ -1542,6 +1546,18 @@ void installWebApi() {
}); });
#endif #endif
#if defined(ENABLE_VERSION)
api_regist("/index/api/version",[](API_ARGS_MAP_ASYNC){
CHECK_SECRET();
Value ver;
ver["buildTime"] = BUILD_TIME;
ver["branchName"] = BRANCH_NAME;
ver["commitHash"] = COMMIT_HASH;
val["data"] = ver;
invoker(200, headerOut, val.toStyledString());
});
#endif
////////////以下是注册的Hook API//////////// ////////////以下是注册的Hook API////////////
api_regist("/index/hook/on_publish",[](API_ARGS_JSON){ api_regist("/index/hook/on_publish",[](API_ARGS_JSON){
//开始推流事件 //开始推流事件
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论