canonical / lxd-demo-server

The LXD demo server
https://linuxcontainers.org/lxd/try-it
Apache License 2.0
75 stars 26 forks source link

Switch to xterm.js #5

Open techtonik opened 8 years ago

techtonik commented 8 years ago

It is impossible to copy/paste instructions into Try it online console to try things. Context menu doesn't work for this either.

stgraber commented 8 years ago

That's why I made it so you can click on any of the commands in the instruction to have it executed into the terminal session.

The javascript terminal library we're using doesn't do so well with copy/paste and I'm not sure that they'll be making much progress on that.

dobin commented 7 years ago

linuxcontainers.org website uses term.js: https://github.com/chjj/term.js

This is not maintained anymore, and as mentioned on the github page, the official successor is: https://github.com/sourcelair/xterm.js

In lxd-webgui, i just exchanged term.js with the sourcelair xterm.js. Everything still worked perfectly, and i had paste support with ctrl-shift-v.

https://github.com/dobin/lxd-webgui/commit/14c4b74bbc738192e65cf3064f13ca390365f9fa

stgraber commented 7 years ago

So I just tried to replace term.js with xterm.js and rendering is completely broken...

stgraber commented 7 years ago

So if either of you want to volunteer to port github.com/lxc/linuxcontainers.org from term.js to xterm.js, I'd certainly appreciate it. Note that validating the setup is always a bit tricky and it took me a couple of weeks to get term.js to render perfectly on all the setups we care about:

Especially making sure the things render properly in both very wide windows (fullscreen) and very narrow ones. Some of the font-sizing logic needed a fair amount of tweaking to convert the available screen estate in pixels to the number of columns for the terminal.

dobin commented 7 years ago

I'll have a look, as I anyway want to use lxd-demo-server for a private project.

techtonik commented 7 years ago

I see that https://github.com/sourcelair/xterm.js is pretty active, so there are chances to fix rendering bugs upstream if somebody is going to report that. Are there any tests to check that is renders perfectly?

stgraber commented 7 years ago

Well, I'm not sure that it's an actual upstream bug. It's just that @dobin said that it worked as a drop-in replacement for him, which it didn't for me and suggests there are a bunch of javascript and css changes I'd have to do to get things back to working order.

I don't believe that they pretend to be exactly compatible with term.js, though they mostly are since it's effectively a fork.

techtonik commented 7 years ago

If it is a terminal, then all you need is a websocket for stdin and stdout of controlling terminal, which is the browser. Right?

techtonik commented 7 years ago

Here is the alternative officially tested and maintained by Chromium team https://chromium.googlesource.com/apps/libapps/+/master/hterm/doc/ChangeLog.md and how to embed https://chromium.googlesource.com/apps/libapps/+/master/hterm/doc/embed.md