add get version restful api

This commit is contained in:
xiongguangjie
2022-08-12 18:09:44 +08:00
parent 6382fcb3be
commit a1000da71f
2 changed files with 43 additions and 2 deletions

View File

@@ -48,6 +48,10 @@
#include <tchar.h>
#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){
//开始推流事件