MCPcopy Create free account
hub / github.com/RGAA-Software/GoDesk / GetRenderConfiguration

Method GetRenderConfiguration

src/render_panel/network/render_api.cpp:19–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17 const std::string kApiGetRenderConfiguration = "/get/render/configuration";
18
19 Result<RenderConfiguration, int> RenderApi::GetRenderConfiguration(const std::string& host, int port) {
20 auto client = HttpClient::Make(host, port, kApiGetRenderConfiguration);
21 auto r = client->Request({});
22
23 LOGI("code: {}, msg: {}", r.status, r.body);
24 if (r.status != 200 || r.body.empty()) {
25 return ErrInt<RenderConfiguration>(r.status);
26 }
27
28 try {
29 auto obj = json::parse(r.body);
30 if (obj["code"].get<int>() == 200) {
31 RenderConfiguration rc;
32 rc.device_id_ = obj["data"]["device_id"].get<std::string>();
33 rc.relay_host_ = obj["data"]["relay_host"].get<std::string>();
34 rc.relay_port_ = obj["data"]["relay_port"].get<int>();
35 return rc;
36 }
37 } catch(std::exception& e) {
38 LOGE("Parse json failed: {}, body: {}", e.what(), r.body);
39 }
40
41 return ErrInt<RenderConfiguration>(-1);
42 }
43
44 Result<bool, int> RenderApi::VerifySecurityPassword(const std::string& host, int port, const std::string& safety_pwd_md5) {
45 auto client = HttpClient::Make(host, port, kApiVerifySecurityPassword);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected