1
0
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:
Chris Cummer 2018-10-18 04:34:05 -07:00 committed by GitHub
commit c3faeb1965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 7 deletions

View File

@ -344,6 +344,13 @@
"name": "Mathias Weber", "name": "Mathias Weber",
"avatar_url": "https://avatars2.githubusercontent.com/u/882006?v=4", "avatar_url": "https://avatars2.githubusercontent.com/u/882006?v=4",
"profile": "https://github.com/mweb", "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": [ "contributions": [
] ]
} }

View File

@ -5,6 +5,8 @@
### ⚡️ Added ### ⚡️ Added
* Mecurial module added (@mweb) * Mecurial module added (@mweb)
* Can now define numeric hotkeys in config (@mweb)
* Linux firewall support added (@TheRedSpy15)
### 🐞 Fixed ### 🐞 Fixed

View File

@ -1,5 +1,5 @@
[![All Contributors](https://img.shields.io/badge/all_contributors-48-orange.svg?style=flat-square)](#contributors) [![All Contributors](https://img.shields.io/badge/all_contributors-49-orange.svg?style=flat-square)](#contributors)
[![Build Status](https://travis-ci.com/senorprogrammer/wtf.svg?branch=master)](https://travis-ci.com/senorprogrammer/wtf) [![Build Status](https://travis-ci.com/senorprogrammer/wtf.svg?branch=master)](https://travis-ci.com/senorprogrammer/wtf)
[![Gitter Chat](https://badges.gitter.im/wtfutil/Lobby.svg)](https://gitter.im/wtfutil/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Gitter Chat](https://badges.gitter.im/wtfutil/Lobby.svg)](https://gitter.im/wtfutil/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Twitter](https://img.shields.io/badge/follow-on%20twitter-blue.svg)](https://twitter.com/wtfutil) [![Twitter](https://img.shields.io/badge/follow-on%20twitter-blue.svg)](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://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://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://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 --> <!-- ALL-CONTRIBUTORS-LIST:END -->
## Acknowledgments ## Acknowledgments

View File

@ -4,6 +4,8 @@ import (
"os/exec" "os/exec"
"runtime" "runtime"
"strings" "strings"
"bytes"
"os/user"
"github.com/senorprogrammer/wtf/wtf" "github.com/senorprogrammer/wtf/wtf"
) )
@ -36,8 +38,26 @@ func FirewallStealthState() string {
/* -------------------- Unexported Functions -------------------- */ /* -------------------- Unexported Functions -------------------- */
func firewallStateLinux() string { func firewallStateLinux() string { // might be very Ubuntu specific
return "[red]NA[white]" 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 { func firewallStateMacOS() string {

View File

@ -29,9 +29,25 @@ func (tracker *FocusTracker) AssignHotKeys() {
return return
} }
usedKeys := make(map[string]bool)
focusables := tracker.focusables()
i := 1 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" // Don't have nav characters > "9"
if i >= 10 { if i >= 10 {
break break

View File

@ -22,10 +22,16 @@ type TextWidget struct {
} }
func NewTextWidget(app *tview.Application, name string, configKey string, focusable bool) TextWidget { func NewTextWidget(app *tview.Application, name string, configKey string, focusable bool) TextWidget {
widget := TextWidget{ focusCharValue := Config.UInt(fmt.Sprintf("wtf.mods.%s.focusChar", configKey), -1)
enabled: Config.UBool(fmt.Sprintf("wtf.mods.%s.enabled", configKey), false), focusChar := string('0' + focusCharValue)
focusable: focusable, 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), Name: Config.UString(fmt.Sprintf("wtf.mods.%s.title", configKey), name),
RefreshInt: Config.UInt(fmt.Sprintf("wtf.mods.%s.refreshInterval", configKey)), RefreshInt: Config.UInt(fmt.Sprintf("wtf.mods.%s.refreshInterval", configKey)),
} }