| 746 | } |
| 747 | |
| 748 | bool AgentClient::handle_context_clone(const json::value& j) |
| 749 | { |
| 750 | if (!j.is<ContextCloneReverseRequest>()) { |
| 751 | return false; |
| 752 | } |
| 753 | |
| 754 | const ContextCloneReverseRequest& req = j.as<ContextCloneReverseRequest>(); |
| 755 | LogFunc << VAR(req) << VAR(ipc_addr_); |
| 756 | |
| 757 | MaaContext* context = query_context(req.context_id); |
| 758 | if (!context) { |
| 759 | LogError << "context not found" << VAR(req.context_id); |
| 760 | return false; |
| 761 | } |
| 762 | |
| 763 | MaaContext* clone = context->clone(); |
| 764 | |
| 765 | ContextCloneReverseResponse resp { |
| 766 | .clone_id = context_id(clone), |
| 767 | }; |
| 768 | send(resp); |
| 769 | |
| 770 | return true; |
| 771 | } |
| 772 | |
| 773 | bool AgentClient::handle_context_task_id(const json::value& j) |
| 774 | { |