Commit 2d65333
Changed files (4)
cmd
ufWall
internal
cmd/ufWall/main.go
@@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
+ "os/exec"
"ufWall/internal/app"
@@ -10,6 +11,12 @@ import (
)
func main() {
+
+ if _, err := exec.LookPath("ufsw"); err != nil {
+ fmt.Println("Please first install ufw and try again.")
+ os.Exit(1)
+ }
+
f, err := tea.LogToFile("debug.log", "debug")
if err != nil {
panic(err)
internal/sections/policy/view.go
@@ -54,5 +54,5 @@ func (m Model) View(policy ufw.Policy) string {
ui.InsertCursor(routedLine, m.cursorLine == 2 && sectionActiveNoMenu, m.styles),
)
- return ui.TitledBox("Default Policies", content, m.styles, -1, m.active)
+ return ui.TitledBox("Default Policies", content, m.styles, 38, m.active)
}
internal/sections/stats/view.go
@@ -48,5 +48,5 @@ func (m Model) View(stats ufw.Stats) string {
ui.InsertCursor(rulesLine, false, m.styles),
)
- return ui.TitledBox("Firewall Stats", content, m.styles, 35, m.active)
+ return ui.TitledBox("Firewall Stats", content, m.styles, 38, m.active)
}
internal/ui/titled_box.go
@@ -8,21 +8,20 @@ import (
func TitledBox(title, content string, styles Styles, width int, activeSession bool) string {
- borderColor := styles.SectionBorder.GetBorderTopForeground()
+ style := styles.SectionBorder
if activeSession {
- borderColor = styles.SectionBorderActive.GetBorderTopForeground()
+ style = styles.SectionBorderActive
title = title + " ●"
}
+ borderColor := style.GetBorderTopForeground()
+
boxWidth := 0
if width != -1 {
boxWidth = width
}
- style := lipgloss.NewStyle().
- Border(lipgloss.RoundedBorder()).
- BorderForeground(borderColor).
- Padding(1, 2)
+ style = style.Padding(1, 2)
if boxWidth > 0 {
style = style.Width(boxWidth)