tabletopsimulator-lua-vscode icon indicating copy to clipboard operation
tabletopsimulator-lua-vscode copied to clipboard

[feature-request] TTS Host configurable

Open ShakMR opened this issue 1 year ago • 1 comments

Hi!

first of all, thanks for this plugin. I Have been looking around the code, trying to come up with a solution myself but I've never developed an extension for VSCode or used Tabletop external IDE API (whatever it is called).

I don't normally use my windows computer for development so it's a bit weird for me and I don't want to go over the hassle of configuring everything there. But I do use windows for playing TTS. Now, do you think it would be possible to connect to the TTS instance running on my windows machine from my laptop?

I've tried in a fork of this repo to add a setting to connect to the local IP address of the windows computer where TTS is running but I had 0 success so far.

What do you think?

I could go around this by using hamachi but maybe adding that config is simpler.

ShakMR avatar Mar 29 '23 17:03 ShakMR

Hi! This is such an interesting workflow, I'd be happy to suggest a few ideas.

So the way this whole external editor API works is that TTS itself (the game running in windows) opens up a server in port 39999 bound to localhost, this cannot be changed. So that means that the communication tunnel that VSCode uses is only available to that windows machine.

However I can suggest setting a private tunnel akin to a VPN between your machines. Here's a list of tunneling software with different licenses. I've personally used Ngrok with great results.

If you were to use ngrok the command would look somehting like

ngrok tcp 39999

Warning: this exposes your game external editor api to the entire internet. Anyone who knows the URL that Ngrok generates will have access to it.

In this case, even your linux machine can access it. So all it's left is to point the extension to your windows machine. To accomplish this you'd modify this line to the url generated by Ngrok. (I'm linking to the wip branch since that's the one I'm editing and still familiar with)

This I haven't tested but am happy to continue discussing it, I think it's a valid use case and could probably add the host and port as configurable options in the future.

rolandostar avatar Mar 29 '23 18:03 rolandostar