Hirse/vscode-ungit

Provide configurable urlBase.

Opened this issue · 4 comments

wjziv commented

This extension does not work when running VSCode through the browser via Code Server while hosted entirely on a separate server.

Expected (upon starting vscode-ungit):

  • Ungit starts running on the external server.
  • VSCode opens a new tab with Ungit.

Actual Results:

  • Ungit starts running on the local device, if possible. (Incorrect)
  • Ungit does not start running on the server.
  • VSCode opens a new tab and points to a local instance of Ungit at localhost:8448, regardless of availability.
  • If Ungit was not able to start (not installed/no access to terminal) window shows "Localhost refused to connect".

Proposed solution:
Ungit provides a method for setting a urlBase other than localhost from the command line, shown in config.js.

If this can be set from .vscode/package.json and propagated throughout vscode-ungit to start/request visuals from Ungit on the correct machine, it may be all that's needed.

Figured I'd throw this out there in case the dev/someone who's closer to this project is able to approach it faster than I can as I acquaint myself with TS.

Below: Reference to the hardcoded localhost.

const url = `http://localhost:8448/?noheader=true#/repository?path=${uri.fsPath}`;

Hirse commented

Making the URL configurable itself is a rather simple change, but it would only work if your code-server is already running the ungit server.

Starting ungit on the remote machine instead of the local one requires some more information on how exactly code-server is running VSCode.

wjziv commented

There are a few different ways to set up code-server, but it may not be worthwhile to try to cover every single base out there. If, for example, somebody spun up a docker container without the foresight to include ungit at build, there's nothing this extension will be able to do about it.

I think allowing user-set parameters to point to an extant instance of ungit allows for accessibility in almost all special cases.

I have the same issue when trying to use the extension with a SSH-Remote host, the hardcoded localhost points to the client machine instead of the host machine
I can't say for CodeServer, but afaik, the extension runs on the remote Host, while the UI is on the client
In this case, I think you can use workspaceFolder.uri.authority, which would give the ip address of the host where ungit is running, and provide it to the getWebViewHtml function
I have absolutely no experience with vscode extensions and no time to do it myself, so I hope this helps

maxfi commented

In the case of ssh-remote you can simply port forward localhost:8448 and it will work. 🎉