mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge branch 'master' into master
This commit is contained in:
commit
c3faeb1965
@ -344,6 +344,13 @@
|
||||
"name": "Mathias Weber",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/882006?v=4",
|
||||
"profile": "https://github.com/mweb",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "TheRedSpy15",
|
||||
"name": "TheRedSpy15",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/32081703?v=4",
|
||||
"profile": "https://github.com/TheRedSpy15",
|
||||
"contributions": [
|
||||
]
|
||||
}
|
||||
|
@ -5,6 +5,8 @@
|
||||
### ⚡️ Added
|
||||
|
||||
* Mecurial module added (@mweb)
|
||||
* Can now define numeric hotkeys in config (@mweb)
|
||||
* Linux firewall support added (@TheRedSpy15)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
[](#contributors)
|
||||
[](#contributors)
|
||||
[](https://travis-ci.com/senorprogrammer/wtf)
|
||||
[](https://gitter.im/wtfutil/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://twitter.com/wtfutil)
|
||||
@ -71,6 +71,7 @@ project:
|
||||
| [<img src="https://avatars0.githubusercontent.com/u/889171?v=4" width="48px;"/><br /><sub><b>Lineu Felipe</b></sub>](https://github.com/darkSasori)<br /> | [<img src="https://avatars2.githubusercontent.com/u/159124?v=4" width="48px;"/><br /><sub><b>Konstantin</b></sub>](https://github.com/kvj)<br /> | [<img src="https://avatars2.githubusercontent.com/u/6044920?v=4" width="48px;"/><br /><sub><b>Brendan O'Leary</b></sub>](http://www.brendanoleary.com)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1226441?v=4" width="48px;"/><br /><sub><b>bertl4398</b></sub>](https://github.com/bertl4398)<br /> | [<img src="https://avatars2.githubusercontent.com/u/6553695?v=4" width="48px;"/><br /><sub><b>Ferenc-</b></sub>](https://github.com/Ferenc-)<br /> | [<img src="https://avatars1.githubusercontent.com/u/952036?v=4" width="48px;"/><br /><sub><b>Rohan Verma</b></sub>](http://rohanverma.net)<br /> |
|
||||
| [<img src="https://avatars1.githubusercontent.com/u/19293566?v=4" width="48px;"/><br /><sub><b>Tim Fitzgerald</b></sub>](https://github.com/fimtitzgerald)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1081051?v=4" width="48px;"/><br /><sub><b>Federico Ruggi</b></sub>](https://github.com/ruggi)<br /> | [<img src="https://avatars2.githubusercontent.com/u/7293328?v=4" width="48px;"/><br /><sub><b>Craig Woodward</b></sub>](https://github.com/ctwoodward)<br /> | [<img src="https://avatars3.githubusercontent.com/u/15367484?v=4" width="48px;"/><br /><sub><b>ReadmeCritic</b></sub>](https://twitter.com/ReadmeCritic)<br /> | [<img src="https://avatars0.githubusercontent.com/u/141402?v=4" width="48px;"/><br /><sub><b>Eugene</b></sub>](https://github.com/jdevelop)<br /> | [<img src="https://avatars1.githubusercontent.com/u/12983705?s=460&v=4" width="48px;"/><br /><sub><b>Kenny Wu</b></sub>](https://github.com/Trinergy)<br /> |
|
||||
| [<img src="https://avatars0.githubusercontent.com/u/538234?v=4" width="48px;"/><br /><sub><b>Renán Romero</b></sub>](http://www.romeroruiz.com)<br /> | [<img src="https://avatars1.githubusercontent.com/u/5031240?v=4" width="48px;"/><br /><sub><b>Bastian Groß</b></sub>](https://github.com/sticreations)<br /> | [<img src="https://avatars1.githubusercontent.com/u/2496835?v=4" width="48px;"/><br /><sub><b>nicholas-eden</b></sub>](https://github.com/nicholas-eden)<br /> | [<img src="https://avatars1.githubusercontent.com/u/279390?v=4" width="48px;"/><br /><sub><b>Dan Rabinowitz</b></sub>](https://github.com/danrabinowitz)<br /> | [<img src="https://avatars1.githubusercontent.com/u/6897575?v=4" width="48px;"/><br /><sub><b>David Missmann</b></sub>](https://github.com/dvdmssmnn)<br /> | [<img src="https://avatars2.githubusercontent.com/u/882006?v=4" width="48px;"/><br /><sub><b>Mathias Weber</b></sub>](https://github.com/mweb)<br /> |
|
||||
| [<img src="https://avatars1.githubusercontent.com/u/32081703?v=4" width="48px;"/><br /><sub><b>TheRedSpy15</b></sub>](https://github.com/TheRedSpy15)<br /> |
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
## Acknowledgments
|
||||
|
@ -4,6 +4,8 @@ import (
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
"bytes"
|
||||
"os/user"
|
||||
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
@ -36,8 +38,26 @@ func FirewallStealthState() string {
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func firewallStateLinux() string {
|
||||
return "[red]NA[white]"
|
||||
func firewallStateLinux() string { // might be very Ubuntu specific
|
||||
user, _ := user.Current()
|
||||
|
||||
if strings.Contains(user.Username, "root") {
|
||||
cmd := exec.Command("ufw", "status")
|
||||
|
||||
var o bytes.Buffer
|
||||
cmd.Stdout = &o
|
||||
if err := cmd.Run(); err != nil {
|
||||
return "[red]NA[white]"
|
||||
}
|
||||
|
||||
if strings.Contains(o.String(), "active") {
|
||||
return "[green]Enabled[white]"
|
||||
} else {
|
||||
return "[red]Disabled[white]"
|
||||
}
|
||||
} else {
|
||||
return "[red]NA[white]"
|
||||
}
|
||||
}
|
||||
|
||||
func firewallStateMacOS() string {
|
||||
|
@ -29,9 +29,25 @@ func (tracker *FocusTracker) AssignHotKeys() {
|
||||
return
|
||||
}
|
||||
|
||||
usedKeys := make(map[string]bool)
|
||||
focusables := tracker.focusables()
|
||||
i := 1
|
||||
|
||||
for _, focusable := range tracker.focusables() {
|
||||
for _, focusable := range focusables {
|
||||
if focusable.FocusChar() != "" {
|
||||
usedKeys[focusable.FocusChar()] = true
|
||||
}
|
||||
}
|
||||
for _, focusable := range focusables {
|
||||
if focusable.FocusChar() != "" {
|
||||
continue
|
||||
}
|
||||
if _, foundKey := usedKeys[string('0'+i)]; foundKey {
|
||||
for ; foundKey; _, foundKey = usedKeys[string('0'+i)] {
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
// Don't have nav characters > "9"
|
||||
if i >= 10 {
|
||||
break
|
||||
|
@ -22,10 +22,16 @@ type TextWidget struct {
|
||||
}
|
||||
|
||||
func NewTextWidget(app *tview.Application, name string, configKey string, focusable bool) TextWidget {
|
||||
widget := TextWidget{
|
||||
enabled: Config.UBool(fmt.Sprintf("wtf.mods.%s.enabled", configKey), false),
|
||||
focusable: focusable,
|
||||
focusCharValue := Config.UInt(fmt.Sprintf("wtf.mods.%s.focusChar", configKey), -1)
|
||||
focusChar := string('0' + focusCharValue)
|
||||
if focusCharValue == -1 {
|
||||
focusChar = ""
|
||||
}
|
||||
|
||||
widget := TextWidget{
|
||||
enabled: Config.UBool(fmt.Sprintf("wtf.mods.%s.enabled", configKey), false),
|
||||
focusable: focusable,
|
||||
focusChar: focusChar,
|
||||
Name: Config.UString(fmt.Sprintf("wtf.mods.%s.title", configKey), name),
|
||||
RefreshInt: Config.UInt(fmt.Sprintf("wtf.mods.%s.refreshInterval", configKey)),
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user