repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
799a23e
parent
3d26a22
author
Eric Bower
date
2024-02-19 21:33:18 +0000 UTC
fix: ssh cms
2 files changed,  +2, -38
M pgs/cms.go
+1, -19
 1@@ -33,7 +33,6 @@ const (
 2 	statusNoAccount
 3 	statusBrowsingKeys
 4 	statusBrowsingTokens
 5-	statusSettingUsername
 6 	statusQuitting
 7 )
 8 
 9@@ -41,7 +40,6 @@ func (s status) String() string {
10 	return [...]string{
11 		"initializing",
12 		"ready",
13-		"setting username",
14 		"browsing keys",
15 		"quitting",
16 		"error",
17@@ -53,8 +51,7 @@ type menuChoice int
18 
19 // menu choices.
20 const (
21-	setUserChoice menuChoice = iota
22-	keysChoice
23+	keysChoice menuChoice = iota
24 	tokensChoice
25 	exitChoice
26 	unsetChoice // set when no choice has been made
27@@ -305,15 +302,6 @@ func updateChildren(msg tea.Msg, m model) (model, tea.Cmd) {
28 			m.status = statusQuitting
29 			return m, tea.Quit
30 		}
31-	case statusSettingUsername:
32-		m.username, cmd = username.Update(msg, m.username)
33-		if m.username.Done {
34-			m.username = username.NewModel(m.dbpool, m.user, m.sshUser) // reset the state
35-			m.status = statusReady
36-		} else if m.username.Quit {
37-			m.status = statusQuitting
38-			return m, tea.Quit
39-		}
40 	case statusNoAccount:
41 		m.createAccount, cmd = account.Update(msg, m.createAccount)
42 		if m.createAccount.Done {
43@@ -327,10 +315,6 @@ func updateChildren(msg tea.Msg, m model) (model, tea.Cmd) {
44 
45 	// Handle the menu
46 	switch m.menuChoice {
47-	case setUserChoice:
48-		m.status = statusSettingUsername
49-		m.menuChoice = unsetChoice
50-		cmd = username.InitialCmd()
51 	case keysChoice:
52 		m.status = statusBrowsingKeys
53 		m.menuChoice = unsetChoice
54@@ -392,8 +376,6 @@ func (m model) View() string {
55 		s += m.info.View()
56 		s += "\n\n" + m.menuView()
57 		s += footerView(m)
58-	case statusSettingUsername:
59-		s += username.View(m.username)
60 	case statusBrowsingKeys:
61 		s += m.keys.View()
62 	case statusBrowsingTokens:
M wish/cms/cms.go
+1, -19
 1@@ -36,7 +36,6 @@ const (
 2 	statusBrowsingPosts
 3 	statusBrowsingKeys
 4 	statusBrowsingTokens
 5-	statusSettingUsername
 6 	statusQuitting
 7 )
 8 
 9@@ -44,7 +43,6 @@ func (s status) String() string {
10 	return [...]string{
11 		"initializing",
12 		"ready",
13-		"setting username",
14 		"browsing posts",
15 		"browsing keys",
16 		"quitting",
17@@ -57,8 +55,7 @@ type menuChoice int
18 
19 // menu choices.
20 const (
21-	setUserChoice menuChoice = iota
22-	postsChoice
23+	postsChoice menuChoice = iota
24 	keysChoice
25 	tokensChoice
26 	exitChoice
27@@ -337,15 +334,6 @@ func updateChildren(msg tea.Msg, m model) (model, tea.Cmd) {
28 			m.status = statusQuitting
29 			return m, tea.Quit
30 		}
31-	case statusSettingUsername:
32-		m.username, cmd = username.Update(msg, m.username)
33-		if m.username.Done {
34-			m.username = username.NewModel(m.dbpool, m.user, m.sshUser) // reset the state
35-			m.status = statusReady
36-		} else if m.username.Quit {
37-			m.status = statusQuitting
38-			return m, tea.Quit
39-		}
40 	case statusNoAccount:
41 		m.createAccount, cmd = account.Update(msg, m.createAccount)
42 		if m.createAccount.Done {
43@@ -359,10 +347,6 @@ func updateChildren(msg tea.Msg, m model) (model, tea.Cmd) {
44 
45 	// Handle the menu
46 	switch m.menuChoice {
47-	case setUserChoice:
48-		m.status = statusSettingUsername
49-		m.menuChoice = unsetChoice
50-		cmd = username.InitialCmd()
51 	case postsChoice:
52 		m.status = statusBrowsingPosts
53 		m.menuChoice = unsetChoice
54@@ -428,8 +412,6 @@ func (m model) View() string {
55 		s += m.info.View()
56 		s += "\n\n" + m.menuView()
57 		s += footerView(m)
58-	case statusSettingUsername:
59-		s += username.View(m.username)
60 	case statusBrowsingPosts:
61 		s += m.posts.View()
62 	case statusBrowsingKeys: