vhqtvn / VHEditor-Android

Run Code-server on Android
Other
948 stars 103 forks source link

How to define custom SSH port to connect to #257

Closed andrew-c0 closed 1 year ago

andrew-c0 commented 1 year ago

I'm trying to connect to the same termux instance the code-server server runs. Going into the editor > terminal > ssh user@ip -p 8022 works fine, but how can i define that 8022 port, so that when I start VHEditor and display the ssh connections, it should work? If i add the -p 8022 into the ssh file (when defining remote connections), it fails. Any ideas? Thanks in advance.

EDIT: I've tried cheating using ssh://user@host:8022, but when trying to access it, I get to a screen which requires me to choose wether to install dropbear / openssh, the lattet which I already have installed. Can't move past that afterwards.

vhqtvn commented 1 year ago

The screen to install ssh was executed this file:

https://github.com/vhqtvn/VHEditor-Android/blob/master/app/src/main/res/raw/bin_ensure_ssh.sh#L6

It must be that which ssh returned empty, so it tried to install, maybe you should put ssh bin to correct PATH defined in VHEditor.

The parser for ssh file is quite simple, just for very generic purpose as I have a version customized it for myself only.

https://github.com/vhqtvn/VHEditor-Android/blob/3419e4f3a3562950211380dd82194b5175629db0/app/src/main/res/raw/new_session_default.js#LL102C15-L102C19 https://github.com/vhqtvn/VHEditor-Android/blob/master/app/src/main/res/raw/new_session_default.js#L41

As you can see, I set const args = [line] so the whole line became a single argument. The js is just react native and you can edit as you want right on your device, so you can just copy content of that file to the loader file (original content is at https://github.com/vhqtvn/VHEditor-Android/blob/master/app/src/main/res/raw/new_session_loader.js), change that into args = line.trim().split(/\s/+) for example. That is not a correct command line parser but it will suite your case.