Auth Flow Work
Go update too
This commit is contained in:
@@ -165,7 +165,9 @@ func (s *ScreenHome) HandleResize(ev *tcell.EventResize) {
|
|||||||
|
|
||||||
func (s *ScreenHome) HandleKey(ev *tcell.EventKey) bool {
|
func (s *ScreenHome) HandleKey(ev *tcell.EventKey) bool {
|
||||||
if s.showAlert {
|
if s.showAlert {
|
||||||
return s.alert.HandleKey(ev)
|
handled := s.alert.HandleKey(ev)
|
||||||
|
s.alert.SetMessage(fmt.Sprintf("Alert Handled? %v -> %s", handled, ev.Name()))
|
||||||
|
return handled
|
||||||
}
|
}
|
||||||
if ev.Key() == tcell.KeyF12 {
|
if ev.Key() == tcell.KeyF12 {
|
||||||
s.toggleCli()
|
s.toggleCli()
|
||||||
@@ -390,6 +392,8 @@ func (s *ScreenHome) cliAuthPds(args ...string) bool {
|
|||||||
}
|
}
|
||||||
s.alert.SetTitle("Authentication Started")
|
s.alert.SetTitle("Authentication Started")
|
||||||
s.alert.SetMessage(fmt.Sprintf("OAuth Process Started.\nIf a browser window didn't open, you can open this URL manually:\n%s", authUrl))
|
s.alert.SetMessage(fmt.Sprintf("OAuth Process Started.\nIf a browser window didn't open, you can open this URL manually:\n%s", authUrl))
|
||||||
|
s.alert.SetVisible(true)
|
||||||
|
s.alert.SetActive(true)
|
||||||
s.showAlert = true
|
s.showAlert = true
|
||||||
}()
|
}()
|
||||||
return true
|
return true
|
||||||
@@ -443,7 +447,7 @@ func (s *ScreenHome) updatePdsListing() {
|
|||||||
if viper.GetBool(data.KeyRecNmInfer) {
|
if viper.GetBool(data.KeyRecNmInfer) {
|
||||||
if rec, ok := s.activePds.Records[rIds[j]]; ok {
|
if rec, ok := s.activePds.Records[rIds[j]]; ok {
|
||||||
for k := range rec {
|
for k := range rec {
|
||||||
if k == "name" || k == "title" || k == "label" {
|
if k == "name" || k == "title" || k == "label" || k == "displayName" {
|
||||||
if f, ok := rec[k].(string); ok {
|
if f, ok := rec[k].(string); ok {
|
||||||
label = fmt.Sprintf("%s (%s)", f, rIds[j])
|
label = fmt.Sprintf("%s (%s)", f, rIds[j])
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ type AuthRepo struct {
|
|||||||
context context.Context
|
context context.Context
|
||||||
|
|
||||||
session *oauth.ClientSessionData
|
session *oauth.ClientSessionData
|
||||||
|
authError error
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAuthRepo(r *Repo) (*AuthRepo, error) {
|
func NewAuthRepo(r *Repo) (*AuthRepo, error) {
|
||||||
@@ -70,12 +71,10 @@ func (r *AuthRepo) StartAuthFlow(port int, identifier string, callbackRes chan u
|
|||||||
if !strings.HasPrefix(authUrl, "https://") {
|
if !strings.HasPrefix(authUrl, "https://") {
|
||||||
return "", fmt.Errorf("non-https authUrl")
|
return "", fmt.Errorf("non-https authUrl")
|
||||||
}
|
}
|
||||||
exec.Command("xdg-open", authUrl).Run()
|
go func() {
|
||||||
|
exec.Command("xdg-open", authUrl).Start()
|
||||||
r.session, err = r.oauthClient.ProcessCallback(r.context, <-callbackRes)
|
r.session, r.authError = r.oauthClient.ProcessCallback(r.context, <-callbackRes)
|
||||||
if err != nil {
|
}()
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return authUrl, nil
|
return authUrl, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
go.mod
4
go.mod
@@ -1,6 +1,8 @@
|
|||||||
module git.bullercodeworks.com/brian/expds
|
module git.bullercodeworks.com/brian/expds
|
||||||
|
|
||||||
go 1.25.1
|
go 1.26.0
|
||||||
|
|
||||||
|
replace git.bullercodeworks.com/brian/tcell-widgets => /home/brbuller/Development/go/src/git.bullercodeworks.com/brian/tcell-widgets
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.bullercodeworks.com/brian/tcell-widgets v0.3.2
|
git.bullercodeworks.com/brian/tcell-widgets v0.3.2
|
||||||
|
|||||||
@@ -165,7 +165,15 @@ func (w *JsonContent) Draw(screen tcell.Screen) {
|
|||||||
txt = txt[:(w.w - brdSz)]
|
txt = txt[:(w.w - brdSz)]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if w.editable {
|
||||||
|
var key, val string
|
||||||
|
|
||||||
|
wh.DrawText(w.x, y, key, st.Dim(dim).Bold(!dim), screen)
|
||||||
|
st = st.Reverse(true)
|
||||||
|
wh.DrawText(w.x, y, val, st.Dim(dim).Bold(!dim), screen)
|
||||||
|
} else {
|
||||||
wh.DrawText(w.x, y, txt, st.Dim(dim).Bold(!dim), screen)
|
wh.DrawText(w.x, y, txt, st.Dim(dim).Bold(!dim), screen)
|
||||||
|
}
|
||||||
y++
|
y++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user