Skip to content

Commit

Permalink
adjust footer and strings
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Nov 9, 2024
1 parent e14c0e9 commit b485a25
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 41 deletions.
8 changes: 3 additions & 5 deletions footer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"github.com/rivo/tview"
)

var verString = "//safebox //version %v"

func footerWindow() *tview.Flex {
// The bottom row has some info on where we are.
layoutFooter = tview.NewFlex()
Expand Down Expand Up @@ -44,9 +42,9 @@ func refreshFooter() {
SetDynamicColors(true).
SetWrap(false)

fmt.Fprintf(versionTextView, verString, VERSION)
versionTextView.SetText(S_FOOTER_COPYRIGHT)

// flex
layoutFooter.AddItem(layoutShortcuts, 0, 8, false)
layoutFooter.AddItem(versionTextView, 0, 2, false)
layoutFooter.AddItem(layoutShortcuts, 0, 7, false)
layoutFooter.AddItem(versionTextView, 0, 3, false)
}
39 changes: 3 additions & 36 deletions info.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,6 @@ import (
"github.com/rivo/tview"
)

var infoString = `
[-:-:-]Version
[darkblue]%v
[-:-:-]Location:
[darkblue]%v
[-:-:-]Master Key SHA256:
[darkblue]%v
[-:-:-]Master Keys Created At:
[darkblue]%v
[-:-:-]Number of keys with label:
[darkblue]%v
[-:-:-]System:
[darkblue]%v %v
`

var instructionsString = `
Instructions
1) Use ArrowKeys [darkred]← ↑ → ↓ [-:-:-]To Select Keys, masks on derived keys will be uncovered when selected.
2) Press [darkred]<Enter>[-:-:-] on 'Derived Keys' column to export.
3) Press [darkred]<Enter>[-:-:-] on 'Label' column to set label.
4) Use [darkred]<TAB>[-:-:-] to focus on different items.
`

func infoWindow() (content *tview.Flex) {
layoutInfo = tview.NewFlex()
layoutInfo.SetDirection(tview.FlexRow)
Expand Down Expand Up @@ -76,7 +43,7 @@ func infoMasterKey() *tview.TextView {

if masterKey != nil {
md := sha256.Sum256(masterKey.masterKey[:])
fmt.Fprintf(textview, infoString,
fmt.Fprintf(textview, S_INFOBOX_KEYINFO,
VERSION,
masterKey.path,
hexutil.Encode(md[:]),
Expand All @@ -86,7 +53,7 @@ func infoMasterKey() *tview.TextView {
runtime.GOARCH,
)
} else {
fmt.Fprintf(textview, infoString,
fmt.Fprintf(textview, S_INFOBOX_KEYINFO,
VERSION,
"N/A",
"N/A",
Expand All @@ -107,6 +74,6 @@ func infoInstructions() *tview.TextView {
textview.SetWordWrap(true)
textview.SetBackgroundColor(tcell.ColorBlue)
fmt.Fprint(textview, strings.Repeat("\n", 100))
fmt.Fprint(textview, instructionsString)
fmt.Fprint(textview, S_INFOBOX_INSTRUCTIONS)
return textview
}
39 changes: 39 additions & 0 deletions literal.go → strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,42 @@ const (
S_MSG_PASSWORD_MISMATCH = "Password mismatch"
S_MSG_PASSWORD_CHANGED = "Masterkey Password changed"
)

const (
S_INFOBOX_KEYINFO = `
[-:-:-]Version
[darkblue]%v
[-:-:-]Location:
[darkblue]%v
[-:-:-]Master Key SHA256:
[darkblue]%v
[-:-:-]Master Keys Created At:
[darkblue]%v
[-:-:-]Number of keys with label:
[darkblue]%v
[-:-:-]System:
[darkblue]%v %v
`

S_INFOBOX_INSTRUCTIONS = `
Instructions
1) Use ArrowKeys [darkred]← ↑ → ↓ [-:-:-]To Select Keys, masks on derived keys will be uncovered when selected.
2) Press [darkred]<Enter>[-:-:-] on 'Derived Keys' column to export.
3) Press [darkred]<Enter>[-:-:-] on 'Label' column to set label.
4) Use [darkred]<TAB>[-:-:-] to focus on different items.
`
)

const (
S_FOOTER_COPYRIGHT = "//safebox // Copyright (c) 2021 xtaci"
)

0 comments on commit b485a25

Please sign in to comment.