Giter VIP home page Giter VIP logo

Comments (6)

camjac251 avatar camjac251 commented on June 14, 2024 1

Thank you for helping me with this. I've been using this nonstop now and it has worked amazingly well.

from pterosocket.

InnateAlpaca avatar InnateAlpaca commented on June 14, 2024

Hello, yes I use VS Code as my main IDE. You can run locally this class with nodejs, which is indeed the main usage I had thought of (I don't think that it would run in a browser since it uses node-fetch library), you can run nodejs in a regular cmd terminal (also the one provided by visual studio).

If you are thinking of an intergration with discord you can use discodjs library. If you only want to run the online game-console from your laptop simply run node main.js in the console (after having installed npm, node and pterosocket). I shall add an example script for simple console-strem soon. If you have any other issue feel free to ask.

from pterosocket.

camjac251 avatar camjac251 commented on June 14, 2024

Oh, thank you for uploading that so quickly. I was able to get it working in a cmd window using a conda environment with node installed, cloned the repo, and installed from local (although I had to install ws before it would work)
So far it works amazingly well and is such a great thing to have in VS Code. Thank you for making this

I noticed a bug I think, unsure. Sometimes the title of the window (couldn't figure out the title yet in VS Code, so I'm using Windows Terminal for testing that) doesn't update for a while. I would open up two tabs of the example remoteConsole.js and after a while, when I would send a command through one tab, the title would update on the other. The title wouldn't show until that happened though.

Is it possible to have a text box underneath the console output like the Pterodactyl Panel? I've noticed that when there's a bunch of errors flying through, it hides any input I type in. If the console updates, for a brief second the line appears on the "input" bottom line before it's moved up. If this happens fast, it blocks the visibility of that line entirely.

from pterosocket.

InnateAlpaca avatar InnateAlpaca commented on June 14, 2024

Hi, I'm not sure to understand what the issue is, what do you mean by "title of the window"? Could you perhaps send an image? I have tested the example with 2 windows shells and it would seem to work fine. But yea, there wasn't much traffic going through.

As for the overlap issue, I understand that it can be a problem if there is much traffic. The example I added is of course a very basic one. As far as I know you have several ways to fix it: you can change the output source, for example sending the logs to file, and leave the console free for input alone, or you could select the pterodactyle-output that you wanna show, so to leave the relevan info alone (and perhaps still saving the rest to file).

socket.on('console_output', (data)=>{
    if (!commandSent)
        if (isRelevant(data))
            console.log(data);
    else   
        commandSent = false;
});

Or you can simply try to find some tip online on consoles management with node, which is not the very focus of this library, which rather focuses on implementing the connection protocol and leaving the user managing the events so as to be able to face a wider variety of cases.

PS: or even more simply... since you are using 2 consoles opened: use one console for the input the other for the output (by removing the console_output listener from one console, and removing all the readline stuff on the other (or just the line listener). This is not a clean solution (also it creates 2 websocket instances instead of 1), but it's very simply and straight forward.

from pterosocket.

camjac251 avatar camjac251 commented on June 14, 2024

image
The title of the tab will only change if it's not the current one selected, after inputting something. I'm not sure if that might be a Windows Terminal specific thing but with two tabs open and sending commands on the active one, the title of the "non-active" changes only.

I noticed another visual bug as well, wonder if I can maybe fix it, where if you type something in the bottom bar and the console updates, the text that you've typed will disappear, but still be in the buffer.

I do like that 2 console idea, I'll give it a try if I can't figure out maybe the logging method, since logging/tailing it to a tab could be cool if an extension exists for VSCode to show stuff like that.

Could stuff match dynamically? I often get errors like this in the console but it's not always the same, usually, it'll have keywords like stack traceback or Lua error

2022-05-17_19-19-42.mp4

from pterosocket.

InnateAlpaca avatar InnateAlpaca commented on June 14, 2024

Uhm, please notice that the code I had provided didn't implement in any way the console's title, so I was a bit surprised when you mentioned it. I have no idea how that was generated (but it's not from the code).

However since it can be a nice feature I have implemented the console's title in the remoteConsole.js example (the previous one was moved to simpleRemoteConsole.js).

As for the filter in the output, you can simply implement it in the console_output listener

socket.on('console_output', (data)=>{ 
     if (!data.includes("Lua error")){
         console.log(data);
     }
});

from pterosocket.

Related Issues (4)

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.