| 1018 | } |
| 1019 | |
| 1020 | void RenderingController::HandleGET_stdmultiInfo(const httplib::Request& req, httplib::Response& res) const |
| 1021 | { |
| 1022 | if (m_RenderWindowBridge == nullptr || !m_RenderWindowBridge->HasEditorListProvider()) |
| 1023 | { |
| 1024 | const auto error = ErrorResponse::RenderWindowNotAvailable(req.path); |
| 1025 | this->SendErrorResponse(res, 503, error); |
| 1026 | return; |
| 1027 | } |
| 1028 | |
| 1029 | std::vector<EditorInfo> editors; |
| 1030 | try |
| 1031 | { |
| 1032 | editors = m_RenderWindowBridge->ListEditors(); |
| 1033 | } |
| 1034 | catch (const std::exception& e) |
| 1035 | { |
| 1036 | const auto [status, payload] = MapBridgeException(e, req.path); |
| 1037 | this->SendErrorResponse(res, status, payload); |
| 1038 | return; |
| 1039 | } |
| 1040 | |
| 1041 | for (const auto& ed : editors) |
| 1042 | { |
| 1043 | if (ed.alias == "stdmulti") |
| 1044 | { |
| 1045 | if (!ed.active) |
| 1046 | { |
| 1047 | const auto error = ErrorResponse::EditorNotActive( |
| 1048 | "StdMultiWidgetEditor is not open", req.path); |
| 1049 | this->SendErrorResponse(res, 503, error); |
| 1050 | return; |
| 1051 | } |
| 1052 | const auto j = EditorInfoToJson(ed, /*includeWindowList=*/true); |
| 1053 | res.status = 200; |
| 1054 | res.set_content(j.dump(), "application/json"); |
| 1055 | return; |
| 1056 | } |
| 1057 | } |
| 1058 | |
| 1059 | // The alias list is authoritative; stdmulti missing means the provider is broken. |
| 1060 | const auto error = ErrorResponse::InternalError( |
| 1061 | "Editor list does not contain 'stdmulti'.", req.path); |
| 1062 | this->SendErrorResponse(res, 500, error); |
| 1063 | } |
| 1064 | |
| 1065 | void RenderingController::HandleGET_stdmultiWindows(const httplib::Request& req, httplib::Response& res) const |
| 1066 | { |