Documentation
¶
Overview ¶
Package app is SSHYard's interface: the host sidebar, the tabs and split panes (native terminals and files browsers alike) and the settings, built with MyGo's immediate-mode ui package. Everything platform-specific (the window's theme and language, the keychain, the updater, file dialogs) comes in through Platform, so the whole interface runs in ui.Tester.
Index ¶
- Constants
- func EncodeKey(k ui.Key, mods ui.Modifiers, m vt.Modes) ([]byte, bool)
- type App
- func (a *App) ApplySettings(s settings.Settings) error
- func (a *App) AskAI(from *conn, selection string)
- func (a *App) BackupNow(id string)
- func (a *App) ClearChat(id int)
- func (a *App) ClearSearch()
- func (a *App) Close()
- func (a *App) CloseFocused()
- func (a *App) CloseSession(id int)
- func (a *App) Connect(hostID string, at openAt) (int, error)
- func (a *App) ConnectWithoutTmux(hostID string) (int, error)
- func (a *App) ContinueAI(id int)
- func (a *App) DeleteBackupTarget(id string) error
- func (a *App) DeleteChat(host, id string)
- func (a *App) DeleteCredential(id string, rebind *authChoice) error
- func (a *App) DeleteForward(id string) error
- func (a *App) DeleteHost(id string) error
- func (a *App) DeleteProxy(id string) error
- func (a *App) DisconnectForwardConn(id string, conn uint64)
- func (a *App) Download(cn *conn, paths []string, dir string)
- func (a *App) ExportBackup(m locales.Messages) bool
- func (a *App) ForgetHostKey(id string) error
- func (a *App) ForwardStatus(id string) (forward.Status, bool)
- func (a *App) Import(m locales.Messages) (importResult, bool)
- func (a *App) InsertAI(id int, text string)
- func (a *App) InstallKey(ctx context.Context, h assets.Host, credID, password, passphrase string) installResult
- func (a *App) Keychain() (*keychain.Keychain, bool)
- func (a *App) Mkdir(cn *conn, remote bool, name string) error
- func (a *App) NewChat(id int)
- func (a *App) OpenAI(hostID string, at openAt, link int) (int, error)
- func (a *App) OpenAIBelow()
- func (a *App) OpenAIBeside()
- func (a *App) OpenChat(paneID int, id string)
- func (a *App) OpenFiles(hostID string, at openAt, from *conn) (int, error)
- func (a *App) OpenFilesBeside()
- func (a *App) OpenImport(m locales.Messages, path string)
- func (a *App) OpenLocalShell(id string) (int, error)
- func (a *App) OpenLocalTerminal() (int, error)
- func (a *App) OpenQuickConnect()
- func (a *App) OpenRemoteList(id string)
- func (a *App) QuickConnect(m locales.Messages) bool
- func (a *App) RemoveDefaultPassword() error
- func (a *App) RenameTab(id int, name string)
- func (a *App) ReplaceHostKey() error
- func (a *App) ReportError(message string)
- func (a *App) ReportLayoutError(err error)
- func (a *App) ReportLayoutReadError(err error)
- func (a *App) RestoreBackup(m locales.Messages) bool
- func (a *App) SaveCredForm(m locales.Messages) bool
- func (a *App) SaveDefaultPassword(m locales.Messages) bool
- func (a *App) SaveForm(m locales.Messages) bool
- func (a *App) SaveFwdForm(m locales.Messages) bool
- func (a *App) SaveGroup(m locales.Messages) bool
- func (a *App) SaveProxyForm(m locales.Messages) bool
- func (a *App) SaveTargetForm(m locales.Messages) bool
- func (a *App) SaveTempAs(id int)
- func (a *App) SendAI(id int, text string)
- func (a *App) SetMaximized(on bool)
- func (a *App) SetMinimized(min bool)
- func (a *App) SetWindow(w WindowControls)
- func (a *App) Settings() settings.Settings
- func (a *App) SplitFocused(edge layout.Edge)
- func (a *App) Start()
- func (a *App) StartForward(id string) error
- func (a *App) StopAI(id int)
- func (a *App) StopAllAI()
- func (a *App) StopForward(id string)
- func (a *App) Store() *assets.Store
- func (a *App) SubmitPrompt()
- func (a *App) SwitchToKey(hostID, credID, user string) error
- func (a *App) TestTarget(m locales.Messages) bool
- func (a *App) ToggleAI()
- func (a *App) ToggleFiles()
- func (a *App) ToggleForward(id string) error
- func (a *App) TogglePrivacy() error
- func (a *App) ToggleTool(k layout.Kind)
- func (a *App) TrustHostKey() error
- func (a *App) Upload(cn *conn, paths []string, dir string)
- func (a *App) View(c *ui.Context)
- type IconButton
- type Platform
- type StoragePaths
- type Window
- type WindowControls
- type WindowSpec
Constants ¶
const ( Small = 14 Tiny = 12 )
Small is the icon size of IconButtons in dense rows (tabs, sidebar rows), Tiny in the slimmest (pane headers, the files toolbar).
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the interface's state. Its View runs on the UI thread; work in the background posts its results with post.
func (*App) ApplySettings ¶
ApplySettings applies and saves settings.
func (*App) AskAI ¶
AskAI sends selection to the AI pane of from's tab, opened beside from when the tab has none. The selection is marked untrusted.
func (*App) ClearChat ¶
ClearChat forgets the pane's conversation, from the history too, and starts another.
func (*App) ClearSearch ¶
func (a *App) ClearSearch()
ClearSearch empties the hosts' search and focuses its field.
func (*App) CloseSession ¶
CloseSession closes a pane, terminal or files, and its connection.
func (*App) ConnectWithoutTmux ¶ added in v0.0.17
ConnectWithoutTmux opens a terminal to a saved host that does not attach to the host's tmux session.
func (*App) ContinueAI ¶
ContinueAI resumes a turn that paused after 25 tool calls.
func (*App) DeleteBackupTarget ¶ added in v0.0.7
DeleteBackupTarget forgets the place id with its secret and key; the backups in it stay.
func (*App) DeleteChat ¶
DeleteChat deletes host's conversation id; a pane showing it starts another.
func (*App) DeleteCredential ¶
DeleteCredential removes a credential and its secrets. The hosts that use it switch to rebind; with rebind nil a credential in use is kept (an *assets.InUseError). The secrets go first: when the keychain fails, the credential and its hosts stay as they were (a *keychainDeleteError), and only then are the hosts rebound and the entry removed.
func (*App) DeleteForward ¶
DeleteForward stops a port forward, then removes it and its password; the password goes first.
func (*App) DeleteHost ¶
DeleteHost removes a host, unless other hosts jump through it or forwards use it (an *assets.InUseError naming them).
func (*App) DeleteProxy ¶
DeleteProxy removes a proxy no host uses, and its password; the password goes first.
func (*App) DisconnectForwardConn ¶
DisconnectForwardConn closes one connection of a forward.
func (*App) Download ¶
Download copies remote files and folders into the local folder dir, asking about those already there.
func (*App) ExportBackup ¶
ExportBackup checks the sheet's password and gathers the backup, then, off the UI thread, asks where to save it and seals it there.
func (*App) ForgetHostKey ¶ added in v0.0.18
ForgetHostKey removes the keys known_hosts has for host id, so its next connection asks to trust its key again.
func (*App) ForwardStatus ¶
ForwardStatus is a forward's status, and whether it was started.
func (*App) InsertAI ¶
InsertAI writes text into the linked terminal's input, without Enter. Control characters, including CR and LF, are removed first.
func (*App) InstallKey ¶
func (a *App) InstallKey(ctx context.Context, h assets.Host, credID, password, passphrase string) installResult
InstallKey logs in to h as it does now (its shared connection, or a new one with password for a host that asks each time), appends the public key of the key credential credID to ~/.ssh/authorized_keys over SFTP, then logs in anew with the key alone to prove it works.
func (*App) OpenAI ¶
OpenAI opens an assistant for hostID. link is a terminal pane to attach, or 0. It does not open an SSH connection. A tab has one: on a pane of a tab that has one already, it shows that one (reuse).
func (*App) OpenAIBelow ¶
func (a *App) OpenAIBelow()
OpenAIBelow splits an assistant under the focused pane.
func (*App) OpenAIBeside ¶
func (a *App) OpenAIBeside()
OpenAIBeside splits an assistant next to the focused pane, on its host. The link is that pane when it is a terminal.
func (*App) OpenChat ¶
OpenChat shows the pane's host's conversation id in the pane, to carry on, after saving the one it showed. The built-in agent takes it up where it was; an external agent keeps its own memory, so it starts afresh after it (forgot).
func (*App) OpenFiles ¶
OpenFiles opens a files pane on a saved host, in a new tab or on a pane. from, when set, is the pane it was opened from (its host's connection, and secrets typed for it, serve every pane on the host).
func (*App) OpenFilesBeside ¶
func (a *App) OpenFilesBeside()
OpenFilesBeside opens a files pane on the focused pane's host, to its right.
func (*App) OpenImport ¶
OpenImport reads the config at path ("" ~/.ssh/config) and shows the preview.
func (*App) OpenLocalShell ¶ added in v0.0.11
OpenLocalShell opens the shell of id as OpenLocalTerminal does.
func (*App) OpenLocalTerminal ¶
OpenLocalTerminal opens the default shell of this computer under the focused pane, split from it in its tab, or in a new tab when there is none.
func (*App) OpenQuickConnect ¶
func (a *App) OpenQuickConnect()
OpenQuickConnect shows the quick connect sheet.
func (*App) OpenRemoteList ¶ added in v0.0.7
OpenRemoteList shows the backups in the place id, listed off the UI thread.
func (*App) QuickConnect ¶
QuickConnect connects to what the sheet holds, on a new temporary host.
func (*App) RemoveDefaultPassword ¶ added in v0.0.7
RemoveDefaultPassword forgets the default backup password, unless a backup location seals with it. The backups sealed with it still open with it.
func (*App) RenameTab ¶ added in v0.0.13
RenameTab names the tab of id for as long as it is open; "" gives it back its host's name.
func (*App) ReplaceHostKey ¶ added in v0.0.18
ReplaceHostKey trusts the key under review in place of the saved ones and connects again the panes that failed for it.
func (*App) ReportError ¶ added in v0.0.14
ReportError displays an already localized platform error without blocking window closing or quitting, including before storage is ready; UI thread only.
func (*App) ReportLayoutError ¶ added in v0.0.15
ReportLayoutError makes native geometry failures observable without exposing paths.
func (*App) ReportLayoutReadError ¶ added in v0.0.15
func (*App) RestoreBackup ¶
RestoreBackup opens the sheet's backup with its password, off the UI thread, then merges it in.
func (*App) SaveCredForm ¶
SaveCredForm validates the credential sheet, saves the credential and moves its secrets into the keychain.
func (*App) SaveDefaultPassword ¶ added in v0.0.7
SaveDefaultPassword checks the sheet, derives the key off the UI thread, then keeps it in place of the one before.
func (*App) SaveFwdForm ¶
SaveFwdForm validates the sheet, saves the forward and puts its password in the keychain; a forward running starts again with it.
func (*App) SaveProxyForm ¶
SaveProxyForm validates the sheet, saves the proxy and puts its password in the keychain.
func (*App) SaveTargetForm ¶ added in v0.0.7
SaveTargetForm checks the sheet, derives the place's key off the UI thread when a password was typed, then saves the place. A place with a password of its own needs it when new or without a key, and otherwise keeps its key; one with the default backup password needs that set.
func (*App) SaveTempAs ¶
SaveTempAs opens the host editor on the temporary host of the pane id, to keep it; its panes then show the saved host.
func (*App) SendAI ¶
SendAI asks the pane's agent. Nothing is sent until the host's first-use notice has been confirmed.
func (*App) SetMaximized ¶
SetMaximized says whether the window is maximized, for the button that maximizes or restores it.
func (*App) SetMinimized ¶
SetMinimized pauses every collector while the window is minimised. Stop only cancels, so a server that never closes the channel cannot stall this caller. Probes reset on the next frame, because sessions live on the UI thread.
func (*App) SetWindow ¶
func (a *App) SetWindow(w WindowControls)
SetWindow gives the title bar the window's buttons.
func (*App) SplitFocused ¶
SplitFocused opens a terminal on the focused pane's host beside it.
func (*App) StartForward ¶
StartForward starts a saved port forward on its host's connection, opening one without a shell when no pane has it. A local port in use is returned at once; the forward shows the error until stopped.
func (*App) StopForward ¶
StopForward stops a port forward and the connections it relays.
func (*App) SubmitPrompt ¶
func (a *App) SubmitPrompt()
SubmitPrompt retains the non-UI entry point used by connection flows.
func (*App) SwitchToKey ¶
SwitchToKey makes h log in with the credential credID, the key installed for user; it refuses when that would log in as anyone else.
func (*App) TestTarget ¶ added in v0.0.7
TestTarget checks, off the UI thread, that the place the sheet describes can be reached with its secret, typed or saved.
func (*App) ToggleAI ¶
func (a *App) ToggleAI()
ToggleAI closes the active tab's AI pane, or opens one beside the focused pane when it has none.
func (*App) ToggleFiles ¶
func (a *App) ToggleFiles()
ToggleFiles closes the active tab's files pane, or opens one beside the focused pane when it has none.
func (*App) ToggleForward ¶
ToggleForward starts a stopped forward and stops a started one.
func (*App) TogglePrivacy ¶
TogglePrivacy turns privacy mode on or off, and keeps it so.
func (*App) ToggleTool ¶ added in v0.0.22
ToggleTool closes the tool pane of kind k when it is in the active tab; else it opens it, or brings it from the tab it is in, beside the focused pane.
func (*App) TrustHostKey ¶
TrustHostKey adds the key asked about to known_hosts and connects again.
type IconButton ¶
type IconButton struct {
Icon *icons.Icon
// On is the icon while Active, as the "-fill" of a "-line" icon; nil
// keeps Icon.
On *icons.Icon
// Label names the action, from the locale catalog.
Label string
// Active shows the button on: a toggle that is set, a view that shows.
Active bool
// Toggle reports Active to assistive technology as a toggle's state.
Toggle bool
// Disabled dims the button; it reports no clicks.
Disabled bool
// Danger tints the hover red, for a destructive action.
Danger bool
// Prominent keeps the accent (or danger tint) visible at rest.
Prominent bool
// Size is the icon's size; 0 is 16. Small is 14, for dense rows, Tiny
// 12, for pane headers and the files toolbar.
Size float32
// Badge is a count shown on the button's corner, as transfers to go;
// "" shows none. BadgeDanger draws it red, for failures.
Badge string
BadgeDanger bool
}
IconButton is the app's one icon-only button: every action shown as an icon (toolbar, tab, pane header, sidebar row, files toolbar) is one, and a text Button is kept only for the primary actions of a dialog or form. Label is required and localized: it is both the tooltip and the name assistive technology reads. The look follows the theme in use (light or dark): a circle, clear and muted at rest; a quiet tint of the brand accent (#1984FC) with the icon in the accent on hover, press and while Active; MyGo's focus ring in the accent's focus color from the keyboard.
type Platform ¶
type Platform struct {
// Post asynchronously schedules a callback on the application UI thread,
// even with every window hidden; it must never run the callback inline.
// When nil, queued callbacks run before the next View frame (ui.Tester).
Post func(func())
// SetTrayIcon changes the system tray icon immediately; an error leaves it unchanged.
SetTrayIcon func(style string) error
// SetRememberLayout changes native geometry persistence; errors leave it unchanged.
// A successful change returns an undo that restores its exact previous state.
SetRememberLayout func(bool) (undo func() error, err error)
// OpenPath opens a file in its default app; nil can't.
OpenPath func(path string) error
// Notify shows a system notification, replacing the one of the same
// id, and calls clicked as it is clicked; it may block, and is never
// called on a frame. nil can't.
Notify func(id, title, body string, clicked func()) error
// CacheDir is where files opened in another app are copied, the
// user's cache folder when "".
CacheDir string
// DataDir holds application metadata and encrypted credentials; it is required
// unless ResolveStorage supplies the persistent storage paths.
DataDir string
Version string
// Secrets stores only the random master key; failures keep the app locked.
Secrets keychain.Backend
SecretLockPath string
SecretScope string
StartupError error
ResolveStorage func() (StoragePaths, error)
Updates updater.Backend
// SetTheme and SetLocale apply the user's choice to the window.
SetTheme func(theme.Mode)
SetLocale func(tag string)
// PickFile shows the system's open dialog; it may block.
PickFile func(title string) (string, error)
// PickFiles is PickFile choosing several files.
PickFiles func(title string) ([]string, error)
// SaveFile shows the system's save dialog, at path to begin with; it
// may block. "" with no error is a cancel.
SaveFile func(title, path string) (string, error)
// PickFolder shows the system's open dialog for a folder, in start to
// begin with; it may block. "" with no error is a cancel.
PickFolder func(title, start string) (string, error)
// OpenWith lets the user choose the app that opens path, then opens
// it there; it may block. A cancel is no error. nil can't.
OpenWith func(path, title string) error
// OpenWindow opens a window of its own showing spec's view, for the
// file editor; it may block, and is never called on a frame. nil
// can't.
OpenWindow func(spec WindowSpec) Window
// Dial replaces net.Dialer, for tests.
Dial func(ctx context.Context, network, addr string) (net.Conn, error)
// HomeDir is where the local side of a files pane starts, and whose
// .ssh/config the import reads; "" is the user's home.
HomeDir string
// LocalUser is the login name a host without one defaults to, as ssh
// does; "" is the user running the app.
LocalUser string
}
Platform is what the app needs from the system, including an explicit system keychain and a persistent data directory for encrypted secrets.
type StoragePaths ¶
type StoragePaths struct{ DataDir, LockPath, Scope string }
StoragePaths keeps the canonical lifetime lock separate from overridden data.
type Window ¶ added in v0.0.8
type Window interface {
Focus()
Close()
SetTitle(string)
// SetEdited marks the window as holding unsaved changes.
SetEdited(bool)
}
Window is a window OpenWindow opened. Its methods may be called on no frame only.
type WindowControls ¶
type WindowControls struct {
Minimize, Maximize, Unmaximize, Close func()
}
WindowControls are the window's buttons, for a window whose view draws them itself (Linux, Windows, where the system's are hidden): main hands them over once the window is made. On macOS the traffic lights stay and there are none.
type WindowSpec ¶ added in v0.0.8
type WindowSpec struct {
Title string
Width, Height int
// StateKey remembers the window's size and place between launches.
StateKey string
View func(*ui.Context)
// Closing is asked when the user closes the window; false keeps it
// open. It runs on no frame.
Closing func() bool
// Closed is told once the window is gone.
Closed func()
}
WindowSpec is a window the app opens beside the main one.
Source Files
¶
- ai.go
- aiacp.go
- aiacpsettings.go
- aiattach.go
- aiattach_view.go
- aibrand.go
- aihistory.go
- aireview.go
- aisettings.go
- aitools.go
- aiview.go
- alive_unix.go
- app.go
- background.go
- background_render.go
- background_settings.go
- backup.go
- backuppassword.go
- broadcast.go
- cloud.go
- credentials.go
- crumbs.go
- cursorblink.go
- docker.go
- dropmenu.go
- editor.go
- edtree.go
- fileicon.go
- fileopen.go
- files.go
- filesextra.go
- filesops.go
- follow.go
- fontsettings.go
- formcontrols.go
- forwards.go
- groups.go
- highlight.go
- hostcard.go
- hosteditor.go
- hostgroup.go
- hostlook.go
- hostsecrets.go
- iconbutton.go
- importer.go
- installkey.go
- keymap.go
- keys.go
- knownhosts.go
- layoutrestore.go
- layoutsave.go
- local.go
- localkeys.go
- mcp.go
- mcpview.go
- metricsbar.go
- migration.go
- migration_save.go
- migration_text.go
- migration_view.go
- osc52.go
- palette.go
- platform_error.go
- privacy.go
- promptpassword.go
- prompts.go
- proxies.go
- quick.go
- rail.go
- renewal.go
- secret_error.go
- secrettx.go
- security_errors.go
- sessionlog.go
- settingsview.go
- sidebar.go
- sidebar_groups.go
- single.go
- skill.go
- snippet_form.go
- snippet_send.go
- snippet_store.go
- snippets.go
- statusbar.go
- streameditor.go
- streamhost.go
- style.go
- tabs.go
- termcolor.go
- termencoding.go
- termschemes.go
- termview.go
- titlebar.go
- tmux.go
- tmuxstart.go
- toolcard.go
- toolpane.go
- unlock.go
- unlockview.go
- usage.go
- view.go
- welcomefield.go
- workspace.go
- zoom.go
- zoom_linux.go