# \[ANNOUNCE\] node-red-contrib-xterm (beta): Help needed

**URL:** <https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170>\
**Category:** Share Your Nodes\
**Created:** [19 November 2019 22:12 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170 "2019-11-19T22:12:09Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [19 November 2019 22:12 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/1 "2019-11-19T22:12:09Z")

</div>

Hi folks,

Last week I had some troubles with my system, which I could easily had solved when I would have been able to run some Linux commands remotely ...

So I thought: how cool would it be if I had some kind of terminal window inside my Node-RED flow editor. That was the kickoff for [node-red-contrib-xterm](https://github.com/bartbutenaers/node-red-contrib-xterm/blob/master/README.md), which offers you such a terminal.

Here is a demo to get the content of my Node-RED directory via `"ls -l"` on my Raspberry:

 ![xterm_demo](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/a8425f5aff362f0dcca7d23670cbf02dbdd435e1.gif)

This beta version can be installed directly from Github (since it is not available on NPM yet):

```auto
npm install bartbutenaers/node-red-contrib-xterm

```

_But I'm completely stuck with some issues, so I can really need some help!_

1. Would be nice if I could have some **security feedback** ([Github issue](https://github.com/bartbutenaers/node-red-contrib-xterm/issues/9)). Although I assume that the Exec-node also allows users to access their backend commands, I want to make sure that I don't introduce extra vulnerabilities. On my readme page I have added a drawing about the entire trajectory (and a small Security section), which gives you an idea about the setup and used components.

2. The rows and columns can be specified (in number of characters), but that means the terminal calculates his **own size** ([Github issue](https://github.com/bartbutenaers/node-red-contrib-xterm/issues/11)). But I want the terminal to be resize to fit the parent DIV element. As you can see in my Github issue, the xterm.js process has provided a "FitAddon" for this purpose, but I can't get that Javascript module working. Have tried lots of things, but he doesn't find the constructor ;-( Would really want to have this fixed!

3. A minor issue: when the terminal is displayed, there is **no auto-focus** ([Github issue](https://github.com/bartbutenaers/node-red-contrib-xterm/issues/13)). I call the terminal's focus function, but it doesn't work. Perhaps JQuery is somehow specifying afterwards focus on another field perhaps?

4. I have tested it on Raspbian, but I cannot get it working on **Windows 10** ([Github issue](https://github.com/bartbutenaers/node-red-contrib-xterm/issues/3)). Have described my problem in this [Discourse question](https://discourse.nodered.org/t/red-nodes-getnode-fails-on-windows-10/18069), but unfortunately I had no feedback yet. Would be nice to have a demo animation with MS DOS command line ...

5. And with lowest priority: I tried for the first time in my life to use **Ascii Art** , but I can't get it sized properly ([Github issue](https://github.com/bartbutenaers/node-red-contrib-xterm/issues/2)). It is merely a gadget, but would be nice if somebody could fix it for the older users in the community 🤣

Looking forward to all 'constructive' feedback.  
Thanks a lot and have fun with it !!!!  
Bart

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [19 November 2019 22:33 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/2 "2019-11-19T22:33:41Z")

</div>

Once again, Bart, you seem to be "coloring outside the lines"... nice job! How the heck do you find all this time to spend on these custom nodes?!?

Anyway, I'm confused by the use of a custom node that has to be dropped into the editor in order to open an interactive terminal window to the server. Are you planning on wiring a flow to either the input or output ports? If so, is the idea to pass a unix command, execute it, and pass along the results (which is what the exec node does)?

Unless I'm missing something, what do you think about implementing this as a sidebar panel instead (similar to the VSCode integrated terminal). Then I could just flip over to that panel, it would connect with the server, and I could poke around the system -- which is basically what I do today, but inside a separate ssh window.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [19 November 2019 22:51 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/3 "2019-11-19T22:51:08Z")

</div>

> [@shrickus](#):
>
> Are you planning on wiring a flow to either the input or output ports?

Hey Steve,  
Thanks!! Well that was initially my idea, but of course there are already nodes available to do that...

> [@shrickus](#):
>
> Unless I'm missing something, what do you think about implementing this as a sidebar panel instead

Damn it hurts me, but I have to admit that your idea is 100% correct. It indeed felt somehow wrong what I was doing, because I had to put on the readme page that it has no use to use more than one of those nodes in a flow... Had been thinking to create a UI node, but then it would be only available for dashboard users... With your suggestion all those problem are solved.

But I have never written a sidebar node. So now I have to spend even more time on this node, and my next node (that was 95% finished) will have to wait 🥴

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [19 November 2019 22:56 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/4 "2019-11-19T22:56:27Z")

</div>

I've never tried to build a "sidebar panel" module either, but there are a couple that might give you a template to work from -- for instance, node-red-node-swagger. I've always wanted to dig into that node and fix it, but alas, between moving and the upcoming holidays... no time this year!

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 November 2019 00:53 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/5 "2019-11-20T00:53:59Z")

</div>

> [@BartButenaers](#):
>
> security feedback

You called? 🤣

You probably aren't introducing more issues as long as the terminal runs as the same user as Node-RED which I assume it does.

On the other hand, you aren't helping security either 😃

At the very least, I would include plenty of info in the docs and the help panel to make people aware of the risks. Both about the risks of not using https and the risks of not adding Node-RED admin login.

I would avoid the problems of having your own login/user-change though, at least for now. That could be a later enhancement once you've got the basics nailed down.

And I wouldn't worry too much about http vs https since some of us already bang on about that enough and you will have the info in your help/docs.

> [@BartButenaers](#):
>
> Other tips?

Yes, if you haven't already, sign up for a service to check your package and its dependencies so that you are notified when vulnerabilities are found. Your GitHub repo can do some of that but I'd look for a separate service as well. You will want to be on top of that.

Great addition to Node-RED by the way, nice one.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [20 November 2019 06:06 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/6 "2019-11-20T06:06:43Z")

</div>

> [@TotallyInformation](#):
>
> You called? 🤣

Haha 😂. Wanted to mention your name explicit, didn't wanted to push you... Thanks for your tips!

> [@TotallyInformation](#):
>
> sign up for a service

Never heard about that. Can you advise one?

> [@shrickus](#):
>
> implementing this as a sidebar panel

@shrickus: only problem I see is that the sizebar hasn't got the right proportions. A hoizontal bar at the bottom if the efitor would have been better I think. Anyway I really need to get the [FitAddon](https://xtermjs.org/docs/api/addons/fit/) running, but I have run out of creativity...

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 November 2019 06:30 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/7 "2019-11-20T06:30:41Z")

</div>

> [@BartButenaers](#):
>
> > sign up for a service
> 
> Never heard about that. Can you advise one?

I use Snyk [What is Snyk? - Developer Security Platform | Snyk](https://snyk.io/product/) I couldn't remember it last night. Also check out the settings on your GitHub as they can also do checks. `npm audit` can also be useful but I prefer getting an email reminder of any vulnerabilities which lets me then schedule in some time to go update my dependencies and push out a new version.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [20 November 2019 21:56 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/8 "2019-11-20T21:56:54Z")

</div>

> [@shrickus](#):
>
> node-red-node-swagger

Did a quick test to show the terminal inside the right sidebar:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2d6057e095ddadc0c213a3f64a8811593a570849.png)

However it seems to me that I cannot save the settings now? My `oneditsave` is never called and my default node field values are not loaded into the node.

So now I'm wondering whether it is possible to store data from a sidebar node? And if not, where I should store my settings 🥴

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [21 November 2019 22:48 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/9 "2019-11-21T22:48:31Z")

</div>

Still haven't found a way to store the config settings for my sidebar-panel node. So I tried to move all the settings to a **config node**. However I'm not able to select any configuration node in my sidebar-panel node:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f16e04895022c7d02629903e0585c0e17ceed12d.png)

Would appreciate if anybody could give me tip, how/where I could store the configuration of my sidebar-panel node...

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [21 November 2019 23:26 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/10 "2019-11-21T23:26:32Z")

</div>

The short answer (as I'm typing this on my phone on the way to sleep) is we don't really have a well defined model for this.

The dashboard does it by creating a ui\_base config node - one the user never really knows is there. There's a lot of code in the dashboard to deal with that - there can be only one base node so it has to handle edge cases such as when a user imports a flow that includes a base node.

A key difference is the ui\_base node stores dashboard config for the runtime.

Here you are wanting a terminal window in the editor, but presumably you don't want to store its configuration in your flow? Its configuration has little to do with the running flow.

What we dont have is a published API for how to store things in user settings. This is where things like your grid size and other editor customisations are saved - not as part of the active flow.

I could point you at the unpublished APIs, (and I have no doubt that now I have mentioned them, you'll go dig them out for yourself), but they are not ready for 3rd party usage. If we're going to open them up, we need to lay down rules for how they can be used.

We also need to formalise how modules can contribute things to the UI without having to register a node in the palette, as currently that's the only way to get any code loaded into the editor.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [21 November 2019 23:40 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/11 "2019-11-21T23:40:09Z")

</div>

> [@knolleary](#):
>
> Here you are wanting a terminal window in the editor, but presumably you don't want to store its configuration in your flow? Its configuration has little to do with the running flow.

Hey Nick,  
That is indeed all correct ... The settings are only about the visual part of the terminal (like background color, text color, ...). My backend flow doesn't need those settings, to attach a pseudo-terminal to the shell.

> [@knolleary](#):
>
> If we're going to open them up, we need to lay down rules for how they can be used.

Ok. But don't want you to have to rush for this single node...  
Could I perhaps create a _temporary workaround_ (until you ever find some time for the API) by calling my admin endpoint and load/save the settings myself somewhere. Then the settings aren't stored in the flow file, but I could mention that in my readme page ...

Hope you don't wake up this night, screaming my name 😉

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [22 November 2019 01:30 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/12 "2019-11-22T01:30:33Z")

</div>

no - he delegates that to me.... aaaargh !

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [22 November 2019 06:34 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/13 "2019-11-22T06:34:57Z")

</div>

> [@dceejay](#):
>
> no - he delegates

Morning Dave,  
Thanks for joining the party... My english must be very bad, because I hadn't read your name 🤫

Ah now rereading Nick's reply, he means the dashboard's grid settings, and not mine (I also have rows and columns as number of characters). That indeed lakes sense to store my settings there. Is it ok for you to continue that discussion in another post, to keep this one focussed on xterminals?  
Thanks very much,  
Bart

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [30 December 2019 00:18 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/14 "2019-12-30T00:18:54Z")

</div>

The second beta is now released, containing a sidebar version. To avoid confusion, I propose we stop the discussion here and continue in [this](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-second-beta-sidebar/19718) new discussion!

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [30 December 2019 07:56 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-xterm-beta-help-needed/18170/15 "2019-12-30T07:56:26Z")

</div>


