gsamokovarov/rvt

Feature Request: Add method to render rvt console in current view

drale2k opened this issue · 5 comments

I need to add a bit of UI around the console and i noticed that the rails web-console allows for it to be rendered in the current view, with calling <% console %>.

I believe this would be generally very useful to anyone using rvt.

IMO, you can render an iframe in this case. Placing a (web) console in your code is like leaving a breakpoint in a debugger, but RVT is a virtual terminal, powered by Rails, so we don't have a context to rendered it in.

I am using an iframe right now as a workaround but there are some inherent issues

  • iFrame src's are always requested from my computer, not from the rails app's context which brings issues with CSP (i think, i need to test in production with SSL) and with IP whitelisting because now i have to know my IP in advance. Before that it was always localhost since it was in the context of rails.

A naive question. if i render xterm.js on my site inside a div and just send input/output to RVT resources, wouldn't this be all it would take? For context, i am running "/bin/sh" so i can run commands on my linux server within the Rails app which is protected by authentication using Devise.

I say that because i think rails/web-console is taking care of rails console and context. RVT imo should be more generic and not care about rails context.

This is a python example (https://github.com/jupyter/terminado). Would love to not use a separate application as a proxy but instead have it inside a Rails app :)

RVT is what rails/web-console was in its 1.x days. I extracted it into a separate project, because Web Console changed it's scope for 2.x and we had 2 products in one package, which was hard to maintain. I can drop the CSP protection, but I don't want to blow up the scope of RVT.

I can add a more generic authentication support, so you can attach a rack app instead of just relying on IP whitelisting. This can help you authenticate requests coming from Device authenticated users.

Ok thanks. I was under the impression that rails/web-console focused on being a rails console in the browser and RVT was extracted to allow and focus on general terminal emulator use.

More generic auth would definitely help. in the meantime i would like to try to use RVT in hte back but use a separate instance of xterm.js in my rails app and just point it to the RVT resources.

On top of your head, do you think this should just work or is there more to it?

There is a bit of frontend glue code. Check out the files in {app,lib}/assets/javascript.