diff --git a/postman/ZLMediaKit.postman_collection.json b/postman/ZLMediaKit.postman_collection.json index 1f1e10cd..4f51641e 100644 --- a/postman/ZLMediaKit.postman_collection.json +++ b/postman/ZLMediaKit.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "fe6cdfbd-531d-45e6-87e5-d460ce9e6328", + "_postman_id": "4626d766-16b5-4255-89ba-f7614de2398c", "name": "ZLMediaKit", "description": "媒体服务器", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" @@ -1087,7 +1087,7 @@ }, { "key": "speed", - "value": 2.0, + "value": "2.0", "description": "要设置的录像倍速" } ] @@ -1690,6 +1690,31 @@ } }, "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": [ diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 14c6a61c..0375b38a 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -48,6 +48,10 @@ #include #endif // _WIN32 +#if defined(ENABLE_VERSION) +#include "version.h" +#endif + using namespace std; using namespace Json; using namespace toolkit; @@ -1542,6 +1546,18 @@ void installWebApi() { }); #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//////////// api_regist("/index/hook/on_publish",[](API_ARGS_JSON){ //开始推流事件