| 989 | } |
| 990 | |
| 991 | void RenderingController::HandleGET_editors(const httplib::Request& req, httplib::Response& res) const |
| 992 | { |
| 993 | if (m_RenderWindowBridge == nullptr || !m_RenderWindowBridge->HasEditorListProvider()) |
| 994 | { |
| 995 | const auto error = ErrorResponse::RenderWindowNotAvailable(req.path); |
| 996 | this->SendErrorResponse(res, 503, error); |
| 997 | return; |
| 998 | } |
| 999 | |
| 1000 | std::vector<EditorInfo> editors; |
| 1001 | try |
| 1002 | { |
| 1003 | editors = m_RenderWindowBridge->ListEditors(); |
| 1004 | } |
| 1005 | catch (const std::exception& e) |
| 1006 | { |
| 1007 | const auto [status, payload] = MapBridgeException(e, req.path); |
| 1008 | this->SendErrorResponse(res, status, payload); |
| 1009 | return; |
| 1010 | } |
| 1011 | |
| 1012 | nlohmann::json arr = nlohmann::json::array(); |
| 1013 | for (const auto& ed : editors) |
| 1014 | arr.push_back(EditorInfoToJson(ed, /*includeWindowList=*/false)); |
| 1015 | |
| 1016 | res.status = 200; |
| 1017 | res.set_content(arr.dump(), "application/json"); |
| 1018 | } |
| 1019 | |
| 1020 | void RenderingController::HandleGET_stdmultiInfo(const httplib::Request& req, httplib::Response& res) const |
| 1021 | { |