protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { string message; using (StreamReader reader = new StreamReader(request)) message = reader.ReadToEnd(); OSD osd = OSDParser.DeserializeLLSDXml(message); if (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_agentID) && !m_isGod) { m_consoleModule.SendConsoleOutput(m_agentID, "No access"); return(new byte[0]); } string cmd = osd.AsString(); if (cmd == "set console on") { if (m_isGod) { MainConsole.Instance.OnOutput += ConsoleSender; m_consoleIsOn = true; m_consoleModule.SendConsoleOutput(m_agentID, "Console is now on"); } return(new byte[0]); } else if (cmd == "set console off") { MainConsole.Instance.OnOutput -= ConsoleSender; m_consoleIsOn = false; m_consoleModule.SendConsoleOutput(m_agentID, "Console is now off"); return(new byte[0]); } if (m_consoleIsOn == false && m_consoleModule.RunCommand(osd.AsString().Trim(), m_agentID)) { return(new byte[0]); } if (m_isGod && m_consoleIsOn) { MainConsole.Instance.RunCommand(osd.AsString().Trim()); } else { m_consoleModule.SendConsoleOutput(m_agentID, "Unknown command"); } return(new byte[0]); }
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { StreamReader reader = new StreamReader(request); string message = reader.ReadToEnd(); OSD osd = OSDParser.DeserializeLLSDXml(message); string cmd = osd.AsString(); if (cmd == "set console on") { if (m_isGod) { MainConsole.Instance.OnOutput += ConsoleSender; m_consoleIsOn = true; m_consoleModule.SendConsoleOutput(m_agentID, "Console is now on"); } return(new byte[0]); } else if (cmd == "set console off") { MainConsole.Instance.OnOutput -= ConsoleSender; m_consoleIsOn = false; m_consoleModule.SendConsoleOutput(m_agentID, "Console is now off"); return(new byte[0]); } if (m_consoleIsOn == false && m_consoleModule.RunCommand(osd.AsString().Trim(), m_agentID)) { return(new byte[0]); } if (m_isGod && m_consoleIsOn) { MainConsole.Instance.RunCommand(osd.AsString().Trim()); } else { m_consoleModule.SendConsoleOutput(m_agentID, "Unknown command"); } return(new byte[0]); }
protected override void ProcessRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { httpResponse.KeepAlive = false; if (httpRequest.HttpMethod != "POST") { httpResponse.StatusCode = (int)HttpStatusCode.NotFound; return; } httpResponse.StatusCode = (int)HttpStatusCode.OK; if (!m_scene.TryGetScenePresence(m_agentID, out ScenePresence sp) || sp.IsChildAgent || sp.IsDeleted) { return; } if (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_agentID) && !m_isGod) { m_consoleModule.SendConsoleOutput(m_agentID, "No access"); return; } OSD osd; try { osd = OSDParser.DeserializeLLSDXml(httpRequest.InputStream); } catch { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; return; } string cmd = osd.AsString(); if (cmd == "set console on") { if (m_isGod) { m_consoleModule.AddConsole(m_agentID, ConsoleSender); m_consoleIsOn = true; m_consoleModule.SendConsoleOutput(m_agentID, "Console is now on"); } return; } else if (cmd == "set console off") { m_consoleModule.RemoveConsole(m_agentID); m_consoleIsOn = false; m_consoleModule.SendConsoleOutput(m_agentID, "Console is now off"); return; } if (m_consoleIsOn == false && m_consoleModule.RunCommand(osd.AsString().Trim(), m_agentID)) { return; } if (m_isGod && m_consoleIsOn) { MainConsole.Instance.RunCommand(osd.AsString().Trim()); } else { m_consoleModule.SendConsoleOutput(m_agentID, "Unknown command"); } }