Giter VIP home page Giter VIP logo

Comments (3)

MelanieT avatar MelanieT commented on July 21, 2024

The console protocol is fatally flawed, I should never have tried to shoehorn a console into plain http. The better way available now would be to use websockets.

from diva-distribution.

KennyFig avatar KennyFig commented on July 21, 2024

I do have a temporary fix for this issue but am struggling trying to push my commit for a pull request.

from diva-distribution.

KennyFig avatar KennyFig commented on July 21, 2024

It's an issue with the ReadResponses function. My band-aid fix can be seen below.

function ReadResponses(console, xml, status) {
  ShowStatus(console, status);
  if (xml) {
    Output(TRACE, "[ReadResponses:".concat(console.name, "] Processing response"));
    elements = xml.getElementsByTagName('Line');
    if (elements) {
      ScrollBottom.Save(console, element.MESSAGES);
      UpdateScrollback(elements.length);
      for (var i = 0; i < elements.length; ++i) {
        var lineNode = elements[i];
        //var lines = lineNode.firstChild.nodeValue.split('\n');
        //var parts = lines.shift().split(':');
        var parts;
        var line;
        var level = xml.getElementsByTagName('Level');
        if(lineNode.firstChild != null){
          parts = lineNode.firstChild.nodeValue.split(':');
          line = parts.join(':');
          if (line.substr(1, 2) == '++') { // Prompt
            if (line.substr(0, 1) == '+') {
              // Normal prompt is used as title
              SetTitle(console, line.substr(3));
            }
            else {
              // Interactive prompt for requesting input
              ShowPrompt(console, line.substr(3));
            }
            UpdateScrollback(1); Output(TRACE, "[ReadResponses:".concat(console.name, "] '", line, "'"), true);
            continue;
          }
          else if (line.length >= 1024) {
            UpdateScrollback(1); Output(TRACE, "[ReadResponses:".concat(console.name, "] Long line with ", line.length, " bytes"), true);
          }
          var matches = line.match(LinePattern);
          //line = new Array();
          if (matches) {
            line = new Array();
            // Timestamp
            line[0] = document.createTextNode(matches[1]);
            // Module name
            line[1] = document.createElement('span');
            line[1].setAttribute('style', 'color:' + Colors.GetForString(matches[2]));
            line[1].appendChild(document.createTextNode(matches[2]));
            // Colon & whitespace
            line[2] = document.createTextNode(matches[3]);
            // Message
            line[3] = document.createElement('span');
            line[3].setAttribute('class', level);
            line[3].appendChild(document.createTextNode(matches[4]));
          }
        }
        else{
          parts = lineNode;
          line = parts;
        }
        if (console.prompt)
          HidePrompt(console, true);
        //if (lines.length)
        //  UpdateScrollback(lines.length);
        //for (var l in lines)
        //  line.push(document.createTextNode(lines[l]));
        Output(MSG + " " + console.name, line, true);
      }
      ScrollBottom.Restore(console, element.MESSAGES);
    }
  }
  if (console.sessionId) {
    try {
      void AjaxSend(console.serviceURL.concat('/ReadResponses/', console.sessionId, '/'), '',
        function(xml, status) { ReadResponses(console, xml, status); },
        console.consoleRequest);
    }
    catch (e) {
      NoConnection(console);
    }          
  }
  if (wifi && (console.name == ID.DEFAULT_CONSOLE))
    if (++wifi.heartbeatCounter >= wifi.HEARTBEAT_THRESHOLD) {
      // Keep session active
      wifi.heartbeatCounter = 0;
      Output(TRACE, "[ReadResponses:".concat(console.name, "] Wifi Heartbeat"));
      void AjaxSend(location.protocol.concat('//', location.host, location.pathname, 'heartbeat/', location.search));
    }
}

from diva-distribution.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.