aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-02-09 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-02-09 20:20:20 +0100
commite621c28222d883e63be60b850c363723bb358295 (patch)
treeaa5171d52c61eb5598ade910c4aa82167d1f3e02 /src
parent0.5 (diff)
downloadhardflip-e621c28222d883e63be60b850c363723bb358295.tar.gz
hardflip-e621c28222d883e63be60b850c363723bb358295.tar.bz2
hardflip-e621c28222d883e63be60b850c363723bb358295.tar.xz
hardflip-e621c28222d883e63be60b850c363723bb358295.tar.zst
hardflip-e621c28222d883e63be60b850c363723bb358295.zip
fuck
Diffstat (limited to 'src')
-rw-r--r--src/c_defs.go1
-rw-r--r--src/i_ui.go67
2 files changed, 67 insertions, 1 deletions
diff --git a/src/c_defs.go b/src/c_defs.go
index ceb2a5b..cb6f9f8 100644
--- a/src/c_defs.go
+++ b/src/c_defs.go
@@ -56,6 +56,7 @@ const (
CONF_DIR_NAME = "hf"
DATA_DIR_NAME = "hf"
VERSION = "v0.5"
+ VERSION_NAME = ""
)
const (
diff --git a/src/i_ui.go b/src/i_ui.go
index 7d25d93..50e1542 100644
--- a/src/i_ui.go
+++ b/src/i_ui.go
@@ -186,6 +186,69 @@ func i_draw_bottom_text(ui HardUI) {
ui.dim[W] - 1, ui.dim[H] - 1, ui.style[STYLE_BOT], " " + VERSION)
}
+func i_draw_welcome_box(ui HardUI) {
+ l_max, r_max := ui.dim[W] / 8 + 1, ui.dim[W] - ui.dim[W] / 8 - 1
+ b_max := ui.dim[H] / 2 - 1
+ i_draw_box(ui.s,
+ l_max - 1, 0, r_max, b_max + 1,
+ ui.style[STYLE_BOX], ui.style[STYLE_HEAD], "", true)
+ art := [6]string{
+ ` _ __`,
+ `| | / _|`,
+ `| |__ | |_`,
+ `| '_ \| _|`,
+ `| | | | |`,
+ `|_| |_|_|`,
+ }
+ line := 0
+ for k, v := range art {
+ if k + 1 > b_max { break }
+ line = k + 1
+ l, r := (ui.dim[W] / 2) - 6, ui.dim[W]
+ if l < l_max { l = l_max }; if r > r_max { r = r_max }
+ i_draw_text(ui.s,
+ l, k + 1, r, k + 1,
+ ui.style[STYLE_DEF], v)
+ }
+ if line > b_max { return }
+ text := "hardflip " + VERSION
+ if len(VERSION_NAME) > 0 {
+ text += " - " + VERSION_NAME
+ }
+ l, r := ui.dim[W] / 2 - len(text) / 2 + 10,
+ ui.dim[W] / 2 + len(text) / 2 + 1 + 10
+ if l < l_max { l = l_max }; if r > r_max { r = r_max }
+ i_draw_text(ui.s,
+ l,
+ line,
+ r,
+ line,
+ ui.style[STYLE_DEF], text)
+ if line += 2; line > b_max { return }
+ text = ` Welcome to hardflip! Please enter the public gpg key ID to be used
+for password encryption/decryption.`
+ l, r = ui.dim[W] / 2 - len(text) / 2, ui.dim[W] / 2 + len(text) / 2 + 1
+ if l < l_max { l = l_max }; if r > r_max { r = r_max }
+ i_draw_text(ui.s,
+ l,
+ line,
+ r,
+ b_max,
+ ui.style[STYLE_DEF], text)
+ text = ` If you don't want to use GnuPG for password storage, please type
+'plain'. (Plaintext passswords are not recommended)`
+ // FIX: fuck
+ if line += 2; line > b_max { return }
+ l, r = ui.dim[W] / 2 - len(text) / 2, ui.dim[W] / 2 + len(text) / 2 + 1
+ if l < l_max { l = l_max }; if r > r_max { r = r_max }
+ i_draw_text(ui.s,
+ l,
+ line,
+ r,
+ b_max,
+ ui.style[STYLE_DEF], text)
+}
+
func i_draw_zhosts_box(ui HardUI) {
i_draw_msg(ui.s, 1, ui.style[STYLE_BOX], ui.dim, " No hosts ")
text := "Hosts list empty. Add hosts/folders by pressing (a/m)"
@@ -396,7 +459,9 @@ func i_ui(data_dir string) {
if data.load_err != nil && len(data.load_err) > 0 {
data.ui.mode = ERROR_MODE
}
- if data.litems.head == nil {
+ if data.opts.GPG == DEFAULT_OPTS.GPG && data.litems.head == nil {
+ i_draw_welcome_box(data.ui)
+ } else if data.litems.head == nil {
i_draw_zhosts_box(data.ui)
}
if data.ui.mode == DELETE_MODE {