Documentation
¶
Overview ¶
Package accessmodal is the TUI's approval surface for browsers asking to sign in to this machine's Sidecar UI API. It is a projection of the API's access-request routes over the Local socket: it lists pending requests for context and approves by the code the person types. Selecting a row never approves, and every rule (code matching, limits, who may approve) stays in internal/uiapi.
Index ¶
- Constants
- type ApprovedMsg
- type Client
- type Host
- func (h *Host) ApplyApproved(msg ApprovedMsg) (done bool, flash string, cmd tea.Cmd)
- func (h *Host) ApplyLoaded(msg LoadedMsg)
- func (h *Host) Ensure(termWidth int)
- func (h *Host) HandleKey(msg tea.KeyPressMsg, termWidth int) (string, tea.Cmd)
- func (h *Host) HandleMouse(msg tea.MouseMsg, termWidth int) string
- func (h *Host) Load() tea.Cmd
- func (h *Host) MouseHandler() *mouse.Handler
- func (h *Host) Paste(msg tea.PasteMsg) tea.Cmd
- func (h *Host) Render(width, height int) string
- func (h *Host) Submit() tea.Cmd
- func (h *Host) WheelAtBoundary(msg tea.MouseWheelMsg) bool
- type LoadedMsg
Constants ¶
const ( // ActionApprove submits the typed code; ActionCancel closes the modal. ActionApprove = "approve" ActionCancel = "cancel" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApprovedMsg ¶
type ApprovedMsg struct {
Host *Host
Approval uiapi.AccessApproval
Err error
}
ApprovedMsg carries the outcome of an approval.
type Client ¶
type Client interface {
ListAccessRequests(ctx context.Context) (uiapi.AccessRequestList, error)
ApproveAccess(ctx context.Context, code, surface string) (uiapi.AccessApproval, error)
}
Client is the slice of the Local-socket API the modal uses.
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host is one open approval modal.
func New ¶
New opens a modal for the API server whose state lives in stateDir. A nil client discovers the running server through its endpoint file on each call.
func (*Host) ApplyApproved ¶
ApplyApproved records an approval result. It reports whether the modal is done (the browser was let in) and the line to flash; on a refusal it keeps the modal open with the server's reason and reloads the list.
func (*Host) ApplyLoaded ¶
ApplyLoaded records a list result addressed to this modal.
func (*Host) HandleMouse ¶
HandleMouse routes a mouse event and returns an action, if one was chosen.
func (*Host) MouseHandler ¶
MouseHandler is the hit map the last Render built.
func (*Host) Submit ¶
Submit approves the typed code. A code that cannot be one is refused here with the same rule the server applies, without a round trip.
func (*Host) WheelAtBoundary ¶
func (h *Host) WheelAtBoundary(msg tea.MouseWheelMsg) bool
WheelAtBoundary reports whether a wheel event would not scroll the modal.