Repository navigation
feat(android,ios,client): open a remote terminal from the phone - #147
Merged
Merged
Conversation
The Android and iOS apps can now open a remote terminal on a computer (no screen), like the desktop console: a Terminal button next to Connect and a terminal icon in My devices. The terminal is the same xterm.js as the console, in a shared page (client/mobile-terminal) shown in a WebView / WKWebView; the keyboard is native (input methods, a key bar with Esc/Tab/Ctrl/Alt/arrows, hardware keyboards). Reconnects resume the same terminal; the soft keyboard overlays the terminal instead of resizing it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Android and iOS apps can now open a remote terminal on a computer, without its screen, like the desktop console (#145).
What's in it
client/mobile-terminal/is a shared page (classic scripts: Android's WebView can't load module scripts fromfile:///android_asset) with the console's xterm.js and colors, copied into the apps at build time together with xterm.js fromclient/node_modules(AndroidterminalAssetstask, iOSscripts/terminal-page.sh). Page and native code talk over JSON messages.controller/TerminalSession.kt,Terminal/TerminalSession.swift): connect / reconnect / wait for the host like remote sessions, withterminal: truein the connect options; opening, resuming with the token, acknowledging after xterm has processed the output, restart after exit, close. The page belongs to the session, so leaving and returning keeps the content; if the system kills the page's process a new one takes over (acks everything outstanding and makes the program redraw).keys.jsturns keys into bytes for the terminal's current mode.npm ci --omit=dev --ignore-scriptsinclient/for xterm.js.Testing
exit→ open again, close from the menu; also the R8-minified release build../gradlew testDebugUnitTest lintDebug(new protocol tests for the terminal commands and input chunking),npm testinclient/(newmobile-terminal.test.tsfor the key sequences).ProtocolTestshas the matching command tests.