MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / NewApp

Function NewApp

internal/tui/app.go:60–96  ·  view source on GitHub ↗

NewApp creates the root TUI application model.

(port int, secretKey string, hook *LogHook)

Source from the content-addressed store, hash-verified

58
59// NewApp creates the root TUI application model.
60func NewApp(port int, secretKey string, hook *LogHook) App {
61 standalone := hook != nil
62 authRequired := !standalone
63 ti := textinput.New()
64 ti.CharLimit = 512
65 ti.EchoMode = textinput.EchoPassword
66 ti.EchoCharacter = '*'
67 ti.SetValue(strings.TrimSpace(secretKey))
68 ti.Focus()
69
70 client := NewClient(port, secretKey)
71 app := App{
72 activeTab: tabDashboard,
73 standalone: standalone,
74 logsEnabled: true,
75 authenticated: !authRequired,
76 authInput: ti,
77 dashboard: newDashboardModel(client),
78 config: newConfigTabModel(client),
79 auth: newAuthTabModel(client),
80 keys: newKeysTabModel(client),
81 oauth: newOAuthTabModel(client),
82 logs: newLogsTabModel(client, hook),
83 client: client,
84 initialized: [6]bool{
85 tabDashboard: true,
86 tabLogs: true,
87 },
88 }
89
90 app.refreshTabs()
91 if authRequired {
92 app.initialized = [6]bool{}
93 }
94 app.setAuthInputPrompt()
95 return app
96}
97
98func (a App) Init() tea.Cmd {
99 if !a.authenticated {

Callers 1

RunFunction · 0.85

Calls 9

refreshTabsMethod · 0.95
setAuthInputPromptMethod · 0.95
newDashboardModelFunction · 0.85
newConfigTabModelFunction · 0.85
newAuthTabModelFunction · 0.85
newKeysTabModelFunction · 0.85
newOAuthTabModelFunction · 0.85
newLogsTabModelFunction · 0.85
NewClientFunction · 0.70

Tested by

no test coverage detected