move UID code

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-06 05:32:52 -06:00
parent 3457aefa86
commit 8b59a3141a
3 changed files with 24 additions and 10 deletions

24
gui.go
View File

@ -4,8 +4,6 @@ package main
import ( import (
"time" "time"
"os" "os"
"os/user"
"strconv"
"strings" "strings"
"go.wit.com/log" "go.wit.com/log"
@ -14,6 +12,7 @@ import (
"go.wit.com/gui/gadgets" "go.wit.com/gui/gadgets"
"go.wit.com/gui/cloudflare" "go.wit.com/gui/cloudflare"
"go.wit.com/gui/debugger" "go.wit.com/gui/debugger"
"go.wit.com/control-panels/dns/linuxstatus"
) )
// This setups up the dns control panel window // This setups up the dns control panel window
@ -51,7 +50,7 @@ func detailsTab(title string) {
me.NSrr = grid.NewLabel("NS RR's") me.NSrr = grid.NewLabel("NS RR's")
grid.NewLabel("UID =") grid.NewLabel("UID =")
me.uid = grid.NewLabel("my uid") grid.NewLabel("DEPRECATED")
grid.NewLabel("Current IPv4 =") grid.NewLabel("Current IPv4 =")
me.IPv4 = grid.NewLabel("?") me.IPv4 = grid.NewLabel("?")
@ -227,9 +226,21 @@ func mainWindow(title string) {
gr.NewButton("OS details", func () { gr.NewButton("OS details", func () {
me.details.Toggle() me.details.Toggle()
}) })
gr.NewButton("Linux details", func () { gr.NewButton("linuxstatus.New()", func () {
me.statusOS = linuxstatus.New()
})
gr.NewButton("statusOS.Ready()", func () {
me.statusOS.Ready()
})
gr.NewButton("statusOS.Draw()", func () {
me.statusOS.Ready()
})
gr.NewButton("statusOS.Update()", func () {
me.statusOS.Update() me.statusOS.Update()
}) })
gr.NewButton("Linux details", func () {
me.statusOS.Toggle()
})
gr.NewButton("resolver status", func () { gr.NewButton("resolver status", func () {
if ! me.digStatus.Ready() {return} if ! me.digStatus.Ready() {return}
me.digStatus.window.Toggle() me.digStatus.window.Toggle()
@ -347,11 +358,6 @@ func updateDNS() {
// me.fix.Enable() // me.fix.Enable()
user, _ := user.Current()
log.Println("os.Getuid =", user.Username, os.Getuid())
if (me.uid != nil) {
me.uid.SetText(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")")
}
// lookup the NS records for your domain // lookup the NS records for your domain
// if your host is test.wit.com, find the NS resource records for wit.com // if your host is test.wit.com, find the NS resource records for wit.com

View File

@ -5,6 +5,8 @@
package linuxstatus package linuxstatus
import ( import (
"os"
"os/user"
"strconv" "strconv"
"go.wit.com/log" "go.wit.com/log"
@ -30,6 +32,12 @@ func linuxLoop() {
} }
// me.IPv6.SetText(all) // me.IPv6.SetText(all)
user, _ := user.Current()
log.Println("os.Getuid =", user.Username, os.Getuid())
if (me.uid != nil) {
me.uid.Set(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")")
}
/* /*
processName := getProcessNameByPort(53) processName := getProcessNameByPort(53)
fmt.Println("Process with port 53:", processName) fmt.Println("Process with port 53:", processName)

View File

@ -51,7 +51,7 @@ type Host struct {
notes *gui.Node // using this to put notes here notes *gui.Node // using this to put notes here
// local OS settings, network interfaces, etc // local OS settings, network interfaces, etc
uid *gui.Node // user // uid *gui.Node // user
fqdn *gui.Node // display the full hostname fqdn *gui.Node // display the full hostname
IPv4 *gui.Node // show valid IPv4 addresses IPv4 *gui.Node // show valid IPv4 addresses
IPv6 *gui.Node // show valid IPv6 addresses IPv6 *gui.Node // show valid IPv6 addresses