maxmcd / webtty

Share a terminal session over WebRTC
https://maxmcd.github.io/webtty/
MIT License
2.71k stars 143 forks source link

passing the key as an argument in URL #37

Open NonerKao opened 3 years ago

NonerKao commented 3 years ago

As title. Instead of opening up https://maxmcd.github.io/webtty/ (the site below) and manually initializing the connection (copy-pasting the key/answer), I am considering an usage like passing the key directly in URL like https://maxmcd.github.io/webtty/index.html&key=33j2kxK3PadnEFo... to link to an already waiting on-way webtty server.

Once this function is ready, it can be integrated into some web service, in which a background thread opens up a webtty server, parses the key it outputs and generates the link with the key as the argument. The user can just click the link in the browser to seamlessly access to the terminal. I am doing this using gotty, but it is no longer being maintained while WebRTC looks more interesting.

This is not a feature request. Rather, I would like to contribute to this project by adding this feature, if you consider it useful. I was planning to finish this function first and discuss this feature directly in the PR thread, but it is not obvious to me how to host a local site like the site for development. I tried building the npm dependencies and used a static http server to host '/web-client/dist', but the basic function is missing: it just keeps telling me There was an error with the offer: <the key>...Try entering the message again: and loops forever. The key works with the site, so there must be something missing in my build. Any hints?

NonerKao commented 3 years ago

but it is not obvious to me how to host a local site like the site for development. I tried ...

Well, never mind, I know nothing about node and typescript before, but at least I know npm run serve now.

As mentioned, I will try to add the feature and then send a PR later.