Compare commits
99 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f91ffbef0f | ||
|
|
3521a3b6f5 | ||
|
|
a6d7954795 | ||
|
|
96e9d75810 | ||
|
|
b2904929b0 | ||
|
|
033e7aa1ac | ||
|
|
53e404dd55 | ||
|
|
8318d2e80f | ||
|
|
3af2a3738f | ||
|
|
e31c2c3e36 | ||
|
|
3f20981550 | ||
|
|
f8368e4998 | ||
|
|
121a73c312 | ||
|
|
86af0d82a4 | ||
|
|
b94129fb0e | ||
|
|
59a843bb8d | ||
|
|
a86aa3eec3 | ||
|
|
a20b4e3592 | ||
|
|
9e62295188 | ||
|
|
2e891d05ca | ||
|
|
bfbec54de3 | ||
|
|
c677bce14e | ||
|
|
6f30efeebe | ||
|
|
14a0e74b25 | ||
|
|
4951ca24da | ||
|
|
1cd6c25b02 | ||
|
|
d9a9e7f753 | ||
|
|
5388a1b408 | ||
|
|
7687af38e1 | ||
|
|
9b26641a0c | ||
|
|
e5ef667909 | ||
|
|
c39479f12b | ||
|
|
f1109f6465 | ||
|
|
127883701d | ||
|
|
5cacc3c5ea | ||
|
|
65957ff732 | ||
|
|
7a096dbc94 | ||
|
|
a7977959b5 | ||
|
|
ea92d56426 | ||
|
|
3c193d219e | ||
|
|
f3a2bd3e88 | ||
|
|
f0488851ae | ||
|
|
c5276247b8 | ||
|
|
27d3a48d98 | ||
|
|
9065248d1c | ||
|
|
6e0c150e26 | ||
|
|
489b23899e | ||
|
|
8f50aa02d6 | ||
|
|
c3454e734f | ||
|
|
2138e671c4 | ||
|
|
0b6816f6e3 | ||
|
|
b72a5e0cc6 | ||
|
|
e4f1851b50 | ||
|
|
20f879271c | ||
|
|
d60e652d17 | ||
|
|
6f0d93e29e | ||
|
|
d7f8f0a918 | ||
|
|
8d89a2a7f4 | ||
|
|
0e4a694d09 | ||
|
|
754420e0c7 | ||
|
|
ae29e13108 | ||
|
|
0e3811de44 | ||
|
|
d1c0e870f0 | ||
|
|
795d8f7e63 | ||
|
|
5008ca46d8 | ||
|
|
e03e261d00 | ||
|
|
4a119a700f | ||
|
|
c1897b475a | ||
|
|
1672b42f7e | ||
|
|
8a28ea47fd | ||
|
|
3450fbc78f | ||
|
|
48ad9ce669 | ||
|
|
fd676f13cf | ||
|
|
63b5f3a604 | ||
|
|
b20031ff6a | ||
|
|
00516c3191 | ||
|
|
76c4010ce2 | ||
|
|
0b8d265024 | ||
|
|
80825b0dff | ||
|
|
42daf1a9f7 | ||
|
|
04960123da | ||
|
|
ab03aeb7a0 | ||
|
|
f6860b56b8 | ||
|
|
6bea425367 | ||
|
|
1b3379b613 | ||
|
|
1cc68c9203 | ||
|
|
c3a6f98b13 | ||
|
|
21fec5a5d0 | ||
|
|
b2b798c514 | ||
|
|
5d63cf41eb | ||
|
|
e519c4a892 | ||
|
|
754106de62 | ||
|
|
07474c5b3d | ||
|
|
b142aef93c | ||
|
|
babe81c1aa | ||
|
|
b89ecfec79 | ||
|
|
5e7659b845 | ||
|
|
eee49d713d | ||
|
|
2a6b0efe68 |
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
open_collective: #normen
|
||||
ko_fi: normen
|
||||
patreon: #normen
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
61
README.md
61
README.md
@@ -2,60 +2,53 @@
|
||||
|
||||
A command line interface for whatsapp, based on [go-whatsapp](https://github.com/Rhymen/go-whatsapp) and [tview](https://github.com/rivo/tview)
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────────┐
|
||||
│ WhatsCLI v0.4.2 Help: /name NewName | /addname 123456 NewName | /quit |│
|
||||
├──────────────────────────────┬──────────────────────────────────────────┤
|
||||
│Contacts │(03-14-12 22:59:00) Me: Hey, whatscli here│
|
||||
│├──Peter │(03-14-12 23:00:00) Peter: Cool 😀 │
|
||||
│├──Paul │ │
|
||||
│└──Mary │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ ├──────────────────────────────────────────┤
|
||||
│ │Yeah, love the shell! │
|
||||
└──────────────────────────────┴──────────────────────────────────────────┘
|
||||
```
|
||||

|
||||
|
||||
## Features
|
||||
|
||||
Things that work.
|
||||
|
||||
- Sending and receiving WhatsApp messages in a command line app
|
||||
- Connects through the Web App API without a browser
|
||||
- Allows sending and receiving WhatsApp messages in a command line app
|
||||
- Allows downloading and opening image/video/audio/document attachments
|
||||
- Uses QR code for simple setup
|
||||
- Allows downloading and opening image/video/audio/document attachments
|
||||
- Allows sending documents
|
||||
- Allows color customization
|
||||
- Allows basic group management
|
||||
- Supports desktop notifications
|
||||
- Binaries for Windows, Mac, Linux and RaspBerry Pi
|
||||
|
||||
### Caveats
|
||||
|
||||
This is a WIP. Heres some things you might expect to work that don't. Plus some other things I should mention.
|
||||
Heres some things you might expect to work that don't. Plus some other things I should mention.
|
||||
|
||||
- Only shows existing chats
|
||||
- Only fetches a few old messages
|
||||
- No incoming message notification / count
|
||||
- No proper connection drop handling
|
||||
- Not configurable at all
|
||||
- Leaves its config files in your home folder
|
||||
- No auto-reconnect when connection drops
|
||||
- No automation of messages, no sending of messages through shell commands
|
||||
- FaceBook obviously doesn't endorse or like these kinds of apps and they're likely to break when FaceBook changes stuff in their web app
|
||||
|
||||
## Installation / Usage
|
||||
|
||||
How to get it running and how to use it
|
||||
|
||||
### Latest Release
|
||||
|
||||
Always fresh, always up to date.
|
||||
|
||||
- Download a release
|
||||
- Put the binary in your PATH (optional)
|
||||
- Run with `whatscli` (or double-click)
|
||||
- Scan the QR code with WhatsApp on your phone (maybe resize shell)
|
||||
- Scan the QR code with WhatsApp on your phone (resize shell or change font size to see whole code)
|
||||
|
||||
### Package Managers
|
||||
|
||||
Some ways to install via package managers are supported but the installed version might be out of date.
|
||||
|
||||
#### MacOS (homebrew)
|
||||
|
||||
- `brew install normen/tap/whatscli`
|
||||
|
||||
#### Arch Linux (AUR)
|
||||
|
||||
- `https://aur.archlinux.org/packages/whatscli/`
|
||||
|
||||
|
||||
177
config/settings.go
Normal file
177
config/settings.go
Normal file
@@ -0,0 +1,177 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/user"
|
||||
|
||||
"github.com/adrg/xdg"
|
||||
"gitlab.com/tslocum/cbind"
|
||||
"gopkg.in/ini.v1"
|
||||
)
|
||||
|
||||
var configFilePath string
|
||||
var keyConfig *cbind.Configuration
|
||||
var cfg *ini.File
|
||||
|
||||
type IniFile struct {
|
||||
*General
|
||||
*Keymap
|
||||
*Ui
|
||||
*Colors
|
||||
}
|
||||
|
||||
type General struct {
|
||||
DownloadPath string
|
||||
PreviewPath string
|
||||
CmdPrefix string
|
||||
ShowCommand string
|
||||
EnableNotifications bool
|
||||
NotificationTimeout int64
|
||||
}
|
||||
|
||||
type Keymap struct {
|
||||
SwitchPanels string
|
||||
FocusMessages string
|
||||
FocusInput string
|
||||
FocusChats string
|
||||
CommandBacklog string
|
||||
CommandRead string
|
||||
CommandCopyuser string
|
||||
CommandConnect string
|
||||
CommandQuit string
|
||||
CommandHelp string
|
||||
MessageDownload string
|
||||
MessageOpen string
|
||||
MessageShow string
|
||||
MessageUrl string
|
||||
MessageInfo string
|
||||
MessageRevoke string
|
||||
}
|
||||
|
||||
type Ui struct {
|
||||
ChatSidebarWidth int
|
||||
}
|
||||
|
||||
type Colors struct {
|
||||
Background string
|
||||
Text string
|
||||
ForwardedText string
|
||||
ListHeader string
|
||||
ListContact string
|
||||
ListGroup string
|
||||
ChatContact string
|
||||
ChatMe string
|
||||
Borders string
|
||||
InputBackground string
|
||||
InputText string
|
||||
UnreadCount string
|
||||
Positive string
|
||||
Negative string
|
||||
}
|
||||
|
||||
var Config = IniFile{
|
||||
&General{
|
||||
DownloadPath: GetHomeDir() + "Downloads",
|
||||
PreviewPath: GetHomeDir() + "Downloads",
|
||||
CmdPrefix: "/",
|
||||
ShowCommand: "jp2a --color",
|
||||
EnableNotifications: false,
|
||||
NotificationTimeout: 60,
|
||||
},
|
||||
&Keymap{
|
||||
SwitchPanels: "Tab",
|
||||
FocusMessages: "Ctrl+w",
|
||||
FocusInput: "Ctrl+Space",
|
||||
FocusChats: "Ctrl+e",
|
||||
CommandBacklog: "Ctrl+b",
|
||||
CommandRead: "Ctrl+n",
|
||||
CommandCopyuser: "Ctrl+c",
|
||||
CommandConnect: "Ctrl+r",
|
||||
CommandQuit: "Ctrl+q",
|
||||
CommandHelp: "Ctrl+?",
|
||||
MessageDownload: "d",
|
||||
MessageInfo: "i",
|
||||
MessageOpen: "o",
|
||||
MessageUrl: "u",
|
||||
MessageRevoke: "r",
|
||||
MessageShow: "s",
|
||||
},
|
||||
&Ui{
|
||||
ChatSidebarWidth: 30,
|
||||
},
|
||||
&Colors{
|
||||
Background: "black",
|
||||
Text: "white",
|
||||
ForwardedText: "purple",
|
||||
ListHeader: "yellow",
|
||||
ListContact: "green",
|
||||
ListGroup: "blue",
|
||||
ChatContact: "green",
|
||||
ChatMe: "blue",
|
||||
Borders: "white",
|
||||
InputBackground: "blue",
|
||||
InputText: "white",
|
||||
UnreadCount: "yellow",
|
||||
Positive: "green",
|
||||
Negative: "red",
|
||||
},
|
||||
}
|
||||
|
||||
func InitConfig() {
|
||||
var err error
|
||||
if configFilePath, err = xdg.ConfigFile("whatscli/whatscli.config"); err == nil {
|
||||
// add any new values
|
||||
var cfg *ini.File
|
||||
if cfg, err = ini.Load(configFilePath); err == nil {
|
||||
cfg.NameMapper = ini.TitleUnderscore
|
||||
cfg.ValueMapper = os.ExpandEnv
|
||||
if section, err := cfg.GetSection("general"); err == nil {
|
||||
section.MapTo(&Config.General)
|
||||
}
|
||||
if section, err := cfg.GetSection("keymap"); err == nil {
|
||||
section.MapTo(&Config.Keymap)
|
||||
}
|
||||
if section, err := cfg.GetSection("ui"); err == nil {
|
||||
section.MapTo(&Config.Ui)
|
||||
}
|
||||
if section, err := cfg.GetSection("colors"); err == nil {
|
||||
section.MapTo(&Config.Colors)
|
||||
}
|
||||
newCfg := ini.Empty()
|
||||
if err = ini.ReflectFromWithMapper(newCfg, &Config, ini.TitleUnderscore); err == nil {
|
||||
//TODO: only save if changes
|
||||
err = newCfg.SaveTo(configFilePath)
|
||||
}
|
||||
} else {
|
||||
cfg = ini.Empty()
|
||||
cfg.NameMapper = ini.TitleUnderscore
|
||||
cfg.ValueMapper = os.ExpandEnv
|
||||
if err = ini.ReflectFromWithMapper(cfg, &Config, ini.TitleUnderscore); err == nil {
|
||||
err = cfg.SaveTo(configFilePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Printf(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func GetConfigFilePath() string {
|
||||
return configFilePath
|
||||
}
|
||||
|
||||
func GetSessionFilePath() string {
|
||||
if sessionFilePath, err := xdg.ConfigFile("whatscli/session"); err == nil {
|
||||
return sessionFilePath
|
||||
}
|
||||
return GetHomeDir() + ".whatscli.session"
|
||||
}
|
||||
|
||||
// gets the OS home dir with a path separator at the end
|
||||
func GetHomeDir() string {
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
}
|
||||
return usr.HomeDir + string(os.PathSeparator)
|
||||
}
|
||||
BIN
doc/screenshot.png
Normal file
BIN
doc/screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 421 KiB |
11
go.mod
11
go.mod
@@ -4,7 +4,11 @@ go 1.15
|
||||
|
||||
require (
|
||||
github.com/Rhymen/go-whatsapp v0.1.1
|
||||
github.com/adrg/xdg v0.2.3
|
||||
github.com/atotto/clipboard v0.1.2
|
||||
github.com/gabriel-vasile/mimetype v1.1.2
|
||||
github.com/gdamore/tcell/v2 v2.0.1-0.20201017141208-acf90d56d591
|
||||
github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28
|
||||
github.com/golang/protobuf v1.4.3 // indirect
|
||||
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
|
||||
github.com/gorilla/websocket v1.4.2 // indirect
|
||||
@@ -13,8 +17,11 @@ require (
|
||||
github.com/rivo/tview v0.0.0-20201118063654-f007e9ad3893
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
|
||||
golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 // indirect
|
||||
golang.org/x/sys v0.0.0-20201118182958-a01c418693c7 // indirect
|
||||
gitlab.com/tslocum/cbind v0.1.4
|
||||
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 // indirect
|
||||
golang.org/x/sys v0.0.0-20201126144705-a4b67b81d3d2 // indirect
|
||||
golang.org/x/text v0.3.4 // indirect
|
||||
google.golang.org/protobuf v1.25.0 // indirect
|
||||
gopkg.in/ini.v1 v1.62.0
|
||||
mvdan.cc/xurls/v2 v2.2.0
|
||||
)
|
||||
|
||||
75
go.sum
75
go.sum
@@ -1,31 +1,27 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f h1:2dk3eOnYllh+wUOuDhOoC2vUVoJF/5z478ryJ+wzEII=
|
||||
github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f/go.mod h1:4a58ifQTEe2uwwsaqbh3i2un5/CBPg+At/qHpt18Tmk=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/Rhymen/go-whatsapp v0.0.0/go.mod h1:rdQr95g2C1xcOfM7QGOhza58HeI3I+tZ/bbluv7VazA=
|
||||
github.com/Rhymen/go-whatsapp v0.1.0 h1:XTXhFIQ/fx9jKObUnUX2Q+nh58EyeHNhX7DniE8xeuA=
|
||||
github.com/Rhymen/go-whatsapp v0.1.0/go.mod h1:xJSy+okeRjKkQEH/lEYrnekXB3PG33fqL0I6ncAkV50=
|
||||
github.com/Rhymen/go-whatsapp v0.1.1-0.20201007125822-005103751b7a h1:LW+rX0NY6LzMPa2hJcgmQlfiFJUihzOMAaIoCq+P3xc=
|
||||
github.com/Rhymen/go-whatsapp v0.1.1-0.20201007125822-005103751b7a/go.mod h1:o7jjkvKnigfu432dMbQ/w4PH0Yp5u4Y6ysCNjUlcYCk=
|
||||
github.com/Rhymen/go-whatsapp v0.1.1-0.20201117204225-79ad714fa46a h1:IhYU0cQ0cvMO9MOuOO08X8zUtMQ+AVIV0D+7eZVtHe8=
|
||||
github.com/Rhymen/go-whatsapp v0.1.1-0.20201117204225-79ad714fa46a/go.mod h1:o7jjkvKnigfu432dMbQ/w4PH0Yp5u4Y6ysCNjUlcYCk=
|
||||
github.com/Rhymen/go-whatsapp v0.1.1 h1:OK+bCugQcr2YjyYKeDzULqCtM50TPUFM6LvQtszKfcw=
|
||||
github.com/Rhymen/go-whatsapp v0.1.1/go.mod h1:o7jjkvKnigfu432dMbQ/w4PH0Yp5u4Y6ysCNjUlcYCk=
|
||||
github.com/Rhymen/go-whatsapp/examples/echo v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:zgCiQtBtZ4P4gFWvwl9aashsdwOcbb/EHOGRmSzM8ME=
|
||||
github.com/Rhymen/go-whatsapp/examples/restoreSession v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:5sCUSpG616ZoSJhlt9iBNI/KXBqrVLcNUJqg7J9+8pU=
|
||||
github.com/Rhymen/go-whatsapp/examples/sendImage v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:RdiyhanVEGXTam+mZ3k6Y3VDCCvXYCwReOoxGozqhHw=
|
||||
github.com/Rhymen/go-whatsapp/examples/sendTextMessages v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:suwzklatySS3Q0+NCxCDh5hYfgXdQUWU1DNcxwAxStM=
|
||||
github.com/SchulteMK/go-whatsapp v0.0.0-20201117193111-50e7347bfbb6 h1:Rsit49rPlurIGzQn9VGOPph0pNjUX+bo+9Lg51D8rn0=
|
||||
github.com/SchulteMK/go-whatsapp v0.0.0-20201117193111-50e7347bfbb6/go.mod h1:o7jjkvKnigfu432dMbQ/w4PH0Yp5u4Y6ysCNjUlcYCk=
|
||||
github.com/adrg/xdg v0.2.3 h1:GxXngdYxNDkoUvZXjNJGwqZxWXi43MKbOOlA/00qZi4=
|
||||
github.com/adrg/xdg v0.2.3/go.mod h1:7I2hH/IT30IsupOpKZ5ue7/qNi3CoKzD6tL3HwpaRMQ=
|
||||
github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY=
|
||||
github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/gabriel-vasile/mimetype v1.1.2 h1:gaPnPcNor5aZSVCJVSGipcpbgMWiAAj9z182ocSGbHU=
|
||||
github.com/gabriel-vasile/mimetype v1.1.2/go.mod h1:6CDPel/o/3/s4+bp6kIbsWATq8pmgOisOPG40CJa6To=
|
||||
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
|
||||
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
|
||||
github.com/gdamore/tcell v1.4.0 h1:vUnHwJRvcPQa3tzi+0QI4U9JINXYJlOz9yiaiPQ2wMU=
|
||||
github.com/gdamore/tcell v1.4.0/go.mod h1:vxEiSDZdW3L+Uhjii9c3375IlDmR05bzxY404ZVSMo0=
|
||||
github.com/gdamore/tcell/v2 v2.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs=
|
||||
github.com/gdamore/tcell/v2 v2.0.0-dev/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
|
||||
github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
|
||||
github.com/gdamore/tcell/v2 v2.0.1-0.20201017141208-acf90d56d591 h1:0WWUDZ1oxq7NxVyGo8M3KI5jbkiwNAdZFFzAdC68up4=
|
||||
github.com/gdamore/tcell/v2 v2.0.1-0.20201017141208-acf90d56d591/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
|
||||
@@ -38,7 +34,6 @@ github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk=
|
||||
github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
@@ -54,25 +49,23 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSfgRJKqIzapE78onvvTbdi1rMkU00lZw=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gopherjs/gopherwasm v1.1.0 h1:fA2uLoctU5+T3OhOn2vYP0DVT6pxc7xhTlBB1paATqQ=
|
||||
github.com/gopherjs/gopherwasm v1.1.0/go.mod h1:SkZ8z7CWBz5VXbhJel8TxCmAcsQqzgWGR/8nMhyhZSI=
|
||||
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
||||
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
|
||||
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg=
|
||||
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
||||
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
|
||||
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw=
|
||||
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
@@ -81,36 +74,33 @@ github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/Qd
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ=
|
||||
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/rivo/tview v0.0.0-20201018122409-d551c850a743 h1:9BBjVJTRxuYBeCAv9DFH2hSzY0ujLx5sxMg5D3K/Xeg=
|
||||
github.com/rivo/tview v0.0.0-20201018122409-d551c850a743/go.mod h1:t7mcA3nlK9dxD1DMoz/DQRMWFMkGBUj6rJBM5VNfLFA=
|
||||
github.com/rivo/tview v0.0.0-20201117185959-f9f2182520da h1:XUh+g7tjO81Ph5+7GSco4VLrBbQPnakm8M6sQU+fT5Y=
|
||||
github.com/rivo/tview v0.0.0-20201117185959-f9f2182520da/go.mod h1:0ha5CGekam8ZV1kxkBxSlh7gfQ7YolUj2P/VruwH0QY=
|
||||
github.com/rivo/tview v0.0.0-20201118063654-f007e9ad3893 h1:24As98PZlIdjZn6V4wUulAbYlG7RPg/du9A1FZdT/vs=
|
||||
github.com/rivo/tview v0.0.0-20201118063654-f007e9ad3893/go.mod h1:0ha5CGekam8ZV1kxkBxSlh7gfQ7YolUj2P/VruwH0QY=
|
||||
github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
|
||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9 h1:lpEzuenPuO1XNTeikEmvqYFcU37GVLl8SRNblzyvGBE=
|
||||
github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9/go.mod h1:PLPIyL7ikehBD1OAjmKKiOEhbvWyHGaNDjquXMcYABo=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA=
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG04SN9W+iWHCRyHqlVYILiSXziwk=
|
||||
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o=
|
||||
gitlab.com/tslocum/cbind v0.1.4 h1:cbZXPPcieXspk8cShoT6efz7HAT8yMNQcofYWNizis4=
|
||||
gitlab.com/tslocum/cbind v0.1.4/go.mod h1:RvwYE3auSjBNlCmWeGspzn+jdLUVQ8C2QGC+0nP9ChI=
|
||||
golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20201116153603-4be66e5b6582 h1:0WDrJ1E7UolDk1KhTXxxw3Fc8qtk5x7dHP431KHEJls=
|
||||
golang.org/x/crypto v0.0.0-20201116153603-4be66e5b6582/go.mod h1:tCqSYrHVcf3i63Co2FzBkTCo2gdF6Zak62921dSfraU=
|
||||
golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o=
|
||||
golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 h1:xYJJ3S178yv++9zXV/hnr29plCAGO9vAFG9dorqaFQc=
|
||||
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
@@ -128,27 +118,20 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201017003518-b09fb700fbb7 h1:XtNJkfEjb4zR3q20BBBcYUykVOEMgZeIUOpBPfNYgxg=
|
||||
golang.org/x/sys v0.0.0-20201013132646-2da7054afaeb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201017003518-b09fb700fbb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201116194326-cc9327a14d48 h1:AYCWBZhgIw6XobZ5CibNJr0Rc4ZofGGKvWa1vcx2IGk=
|
||||
golang.org/x/sys v0.0.0-20201116194326-cc9327a14d48/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637 h1:O5hKNaGxIT4A8OTMnuh6UpmBdI3SAPxlZ3g0olDrJVM=
|
||||
golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201117222635-ba5294a509c7 h1:s330+6z/Ko3J0o6rvOcwXe5nzs7UT9tLKHoOXYn6uE0=
|
||||
golang.org/x/sys v0.0.0-20201117222635-ba5294a509c7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201118182958-a01c418693c7 h1:Z991aAXPjz0tLnj74pVXW3eWJ5lHMIBvbRfMq4M2jHA=
|
||||
golang.org/x/sys v0.0.0-20201118182958-a01c418693c7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/term v0.0.0-20201113234701-d7a72108b828/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201126144705-a4b67b81d3d2 h1:WFCmm2Hi9I2gYf1kv7LQ8ajKA5x9heC2v9xuUKwvf68=
|
||||
golang.org/x/sys v0.0.0-20201126144705-a4b67b81d3d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
@@ -173,10 +156,18 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
|
||||
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
mvdan.cc/xurls/v2 v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
|
||||
mvdan.cc/xurls/v2 v2.2.0/go.mod h1:EV1RMtya9D6G5DMYPGD8zTQzaHet6Jh8gFlRgGRJeO8=
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
package messages
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"os"
|
||||
"os/user"
|
||||
"strings"
|
||||
|
||||
"github.com/Rhymen/go-whatsapp"
|
||||
)
|
||||
|
||||
var contacts map[string]string
|
||||
var connection *whatsapp.Conn
|
||||
|
||||
// loads custom contacts from disk
|
||||
func LoadContacts() {
|
||||
contacts = make(map[string]string)
|
||||
file, err := os.Open(GetHomeDir() + ".whatscli.contacts")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
decoder := gob.NewDecoder(file)
|
||||
err = decoder.Decode(&contacts)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// saves custom contacts to disk
|
||||
func SaveContacts() {
|
||||
file, err := os.Create(GetHomeDir() + ".whatscli.contacts")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
encoder := gob.NewEncoder(file)
|
||||
err = encoder.Encode(contacts)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// sets a new name for a whatsapp id
|
||||
func SetIdName(id string, name string) {
|
||||
contacts[id] = name
|
||||
SaveContacts()
|
||||
}
|
||||
|
||||
// gets a pretty name for a whatsapp id
|
||||
func GetIdName(id string) string {
|
||||
if _, ok := contacts[id]; ok {
|
||||
return contacts[id]
|
||||
}
|
||||
if val, ok := connection.Store.Contacts[id]; ok {
|
||||
if val.Name != "" {
|
||||
return val.Name
|
||||
} else if val.Short != "" {
|
||||
return val.Short
|
||||
} else if val.Notify != "" {
|
||||
return val.Notify
|
||||
}
|
||||
}
|
||||
return strings.TrimSuffix(id, CONTACTSUFFIX)
|
||||
}
|
||||
|
||||
// gets a short name for a whatsapp id
|
||||
func GetIdShort(id string) string {
|
||||
if val, ok := connection.Store.Contacts[id]; ok {
|
||||
if val.Short != "" {
|
||||
return val.Short
|
||||
} else if val.Name != "" {
|
||||
return val.Name
|
||||
} else if val.Notify != "" {
|
||||
return val.Notify
|
||||
}
|
||||
}
|
||||
if _, ok := contacts[id]; ok {
|
||||
return contacts[id]
|
||||
}
|
||||
return strings.TrimSuffix(id, CONTACTSUFFIX)
|
||||
}
|
||||
|
||||
// gets the OS home dir with a path separator at the end
|
||||
func GetHomeDir() string {
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
}
|
||||
return usr.HomeDir + string(os.PathSeparator)
|
||||
}
|
||||
78
messages/messages.go
Normal file
78
messages/messages.go
Normal file
@@ -0,0 +1,78 @@
|
||||
//this package manages the messages
|
||||
package messages
|
||||
|
||||
import "io"
|
||||
|
||||
// TODO: move these funcs/interface to channels
|
||||
type UiMessageHandler interface {
|
||||
NewMessage(Message)
|
||||
NewScreen([]Message)
|
||||
SetChats([]Chat)
|
||||
PrintError(error)
|
||||
PrintText(string)
|
||||
PrintFile(string)
|
||||
SetStatus(SessionStatus)
|
||||
OpenFile(string)
|
||||
GetWriter() io.Writer
|
||||
}
|
||||
|
||||
// data struct for current session status
|
||||
type SessionStatus struct {
|
||||
BatteryCharge int
|
||||
BatteryLoading bool
|
||||
BatteryPowersave bool
|
||||
Connected bool
|
||||
LastSeen string
|
||||
}
|
||||
|
||||
// message struct for battery messages
|
||||
type BatteryMsg struct {
|
||||
charge int
|
||||
loading bool
|
||||
powersave bool
|
||||
}
|
||||
|
||||
// message struct for status messages
|
||||
type StatusMsg struct {
|
||||
connected bool
|
||||
err error
|
||||
}
|
||||
|
||||
// message object for commands
|
||||
type Command struct {
|
||||
Name string
|
||||
Params []string
|
||||
}
|
||||
|
||||
// internal message representation to abstract from message lib
|
||||
type Message struct {
|
||||
Id string
|
||||
ChatId string // the source of the message (group id or contact id)
|
||||
ContactId string
|
||||
ContactName string
|
||||
ContactShort string
|
||||
Timestamp uint64
|
||||
FromMe bool
|
||||
Forwarded bool
|
||||
Text string
|
||||
}
|
||||
|
||||
// internal contact representation to abstract from message lib
|
||||
type Chat struct {
|
||||
Id string
|
||||
IsGroup bool
|
||||
Name string
|
||||
Unread int
|
||||
//TODO: convert to uint64
|
||||
LastMessage int64
|
||||
}
|
||||
|
||||
type Contact struct {
|
||||
Id string
|
||||
Name string
|
||||
Short string
|
||||
}
|
||||
|
||||
const GROUPSUFFIX = "@g.us"
|
||||
const CONTACTSUFFIX = "@s.whatsapp.net"
|
||||
const STATUSSUFFIX = "status@broadcast"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,35 +1,30 @@
|
||||
package messages
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Rhymen/go-whatsapp"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/skratchdot/open-golang/open"
|
||||
)
|
||||
|
||||
const GROUPSUFFIX = "@g.us"
|
||||
const CONTACTSUFFIX = "@s.whatsapp.net"
|
||||
|
||||
type MessageDatabase struct {
|
||||
textMessages map[string][]*whatsapp.TextMessage // text messages stored by RemoteJid
|
||||
messagesById map[string]*whatsapp.TextMessage // text messages stored by message ID
|
||||
latestMessage map[string]uint64 // last message from RemoteJid
|
||||
otherMessages map[string]*interface{} // other non-text messages, stored by ID
|
||||
contacts map[string]Contact
|
||||
chats map[string]Chat
|
||||
}
|
||||
|
||||
// initialize the database
|
||||
func (db *MessageDatabase) Init() {
|
||||
//var this = *db
|
||||
(*db).textMessages = make(map[string][]*whatsapp.TextMessage)
|
||||
(*db).messagesById = make(map[string]*whatsapp.TextMessage)
|
||||
(*db).otherMessages = make(map[string]*interface{})
|
||||
(*db).latestMessage = make(map[string]uint64)
|
||||
db.textMessages = make(map[string][]*whatsapp.TextMessage)
|
||||
db.messagesById = make(map[string]*whatsapp.TextMessage)
|
||||
db.otherMessages = make(map[string]*interface{})
|
||||
db.latestMessage = make(map[string]uint64)
|
||||
db.contacts = make(map[string]Contact)
|
||||
db.chats = make(map[string]Chat)
|
||||
}
|
||||
|
||||
// add a text message to the database, stored by RemoteJid
|
||||
@@ -37,23 +32,45 @@ func (db *MessageDatabase) AddTextMessage(msg *whatsapp.TextMessage) bool {
|
||||
//var this = *db
|
||||
var didNew = false
|
||||
var wid = msg.Info.RemoteJid
|
||||
if (*db).textMessages[wid] == nil {
|
||||
if db.textMessages[wid] == nil {
|
||||
var newArr = []*whatsapp.TextMessage{}
|
||||
(*db).textMessages[wid] = newArr
|
||||
(*db).latestMessage[wid] = msg.Info.Timestamp
|
||||
db.textMessages[wid] = newArr
|
||||
db.latestMessage[wid] = msg.Info.Timestamp
|
||||
didNew = true
|
||||
} else if (*db).latestMessage[wid] < msg.Info.Timestamp {
|
||||
(*db).latestMessage[wid] = msg.Info.Timestamp
|
||||
} else if db.latestMessage[wid] < msg.Info.Timestamp {
|
||||
db.latestMessage[wid] = msg.Info.Timestamp
|
||||
didNew = true
|
||||
}
|
||||
(*db).textMessages[wid] = append((*db).textMessages[wid], msg)
|
||||
(*db).messagesById[msg.Info.Id] = msg
|
||||
sort.Slice((*db).textMessages[wid], func(i, j int) bool {
|
||||
return (*db).textMessages[wid][i].Info.Timestamp < (*db).textMessages[wid][j].Info.Timestamp
|
||||
})
|
||||
//do we know this chat? if not add
|
||||
if _, ok := db.chats[msg.Info.RemoteJid]; !ok {
|
||||
//don't have this chat!
|
||||
isGroup := strings.Contains(msg.Info.RemoteJid, GROUPSUFFIX)
|
||||
db.chats[msg.Info.RemoteJid] = Chat{
|
||||
msg.Info.RemoteJid,
|
||||
isGroup,
|
||||
db.GetIdName(msg.Info.RemoteJid),
|
||||
1,
|
||||
int64(msg.Info.Timestamp),
|
||||
}
|
||||
}
|
||||
//check if message exists, ignore otherwise
|
||||
if _, ok := db.messagesById[msg.Info.Id]; !ok {
|
||||
db.messagesById[msg.Info.Id] = msg
|
||||
db.textMessages[wid] = append(db.textMessages[wid], msg)
|
||||
sort.Slice(db.textMessages[wid], func(i, j int) bool {
|
||||
return db.textMessages[wid][i].Info.Timestamp < db.textMessages[wid][j].Info.Timestamp
|
||||
})
|
||||
}
|
||||
return didNew
|
||||
}
|
||||
|
||||
func (db *MessageDatabase) NewUnreadChat(id string) {
|
||||
if chat, ok := db.chats[id]; ok {
|
||||
chat.Unread++
|
||||
db.chats[id] = chat
|
||||
}
|
||||
}
|
||||
|
||||
// add audio/video/image/doc message, stored by message id
|
||||
func (db *MessageDatabase) AddOtherMessage(msg *interface{}) {
|
||||
var id = ""
|
||||
@@ -69,31 +86,63 @@ func (db *MessageDatabase) AddOtherMessage(msg *interface{}) {
|
||||
id = v.Info.Id
|
||||
}
|
||||
if id != "" {
|
||||
(*db).otherMessages[id] = msg
|
||||
db.otherMessages[id] = msg
|
||||
}
|
||||
}
|
||||
|
||||
func (db *MessageDatabase) AddContact(contact Contact) {
|
||||
db.contacts[contact.Id] = contact
|
||||
}
|
||||
|
||||
func (db *MessageDatabase) AddChat(chat Chat) {
|
||||
db.chats[chat.Id] = chat
|
||||
}
|
||||
|
||||
// get an array of all chat ids
|
||||
func (db *MessageDatabase) GetContactIds() []string {
|
||||
//var this = *db
|
||||
keys := make([]string, len((*db).textMessages))
|
||||
func (db *MessageDatabase) GetChatIds() []Chat {
|
||||
keys := make([]Chat, len(db.chats))
|
||||
i := 0
|
||||
for k := range (*db).textMessages {
|
||||
for _, k := range db.chats {
|
||||
keys[i] = k
|
||||
i++
|
||||
}
|
||||
sort.Slice(keys, func(i, j int) bool {
|
||||
return (*db).latestMessage[keys[i]] > (*db).latestMessage[keys[j]]
|
||||
return db.latestMessage[keys[i].Id] > db.latestMessage[keys[j].Id]
|
||||
})
|
||||
return keys
|
||||
}
|
||||
|
||||
// gets a pretty name for a whatsapp id
|
||||
func (sm *MessageDatabase) GetIdName(id string) string {
|
||||
if val, ok := sm.contacts[id]; ok {
|
||||
if val.Name != "" {
|
||||
return val.Name
|
||||
} else if val.Short != "" {
|
||||
return val.Short
|
||||
}
|
||||
}
|
||||
return strings.TrimSuffix(strings.TrimSuffix(id, CONTACTSUFFIX), GROUPSUFFIX)
|
||||
}
|
||||
|
||||
// gets a short name for a whatsapp id
|
||||
func (sm *MessageDatabase) GetIdShort(id string) string {
|
||||
if val, ok := sm.contacts[id]; ok {
|
||||
//TODO val.notify from whatsapp??
|
||||
if val.Short != "" {
|
||||
return val.Short
|
||||
} else if val.Name != "" {
|
||||
return val.Name
|
||||
}
|
||||
}
|
||||
return strings.TrimSuffix(strings.TrimSuffix(id, CONTACTSUFFIX), GROUPSUFFIX)
|
||||
}
|
||||
|
||||
func (db *MessageDatabase) GetMessageInfo(id string) string {
|
||||
if _, ok := (*db).otherMessages[id]; ok {
|
||||
if _, ok := db.otherMessages[id]; ok {
|
||||
return "[yellow]OtherMessage[-]"
|
||||
}
|
||||
out := ""
|
||||
if msg, ok := (*db).messagesById[id]; ok {
|
||||
if msg, ok := db.messagesById[id]; ok {
|
||||
out += "[yellow]ID: " + msg.Info.Id + "[-]\n"
|
||||
out += "[yellow]PushName: " + msg.Info.PushName + "[-]\n"
|
||||
out += "[yellow]RemoteJid: " + msg.Info.RemoteJid + "[-]\n"
|
||||
@@ -105,91 +154,10 @@ func (db *MessageDatabase) GetMessageInfo(id string) string {
|
||||
}
|
||||
|
||||
// get a string containing all messages for a chat by chat id
|
||||
func (db *MessageDatabase) GetMessagesString(wid string) (string, []string) {
|
||||
//var this = *db
|
||||
var out = ""
|
||||
var arr = []string{}
|
||||
for _, element := range (*db).textMessages[wid] {
|
||||
out += GetTextMessageString(element)
|
||||
out += "\n"
|
||||
arr = append(arr, element.Info.Id)
|
||||
func (db *MessageDatabase) GetMessages(wid string) []whatsapp.TextMessage {
|
||||
var arr = []whatsapp.TextMessage{}
|
||||
for _, element := range db.textMessages[wid] {
|
||||
arr = append(arr, *element)
|
||||
}
|
||||
return out, arr
|
||||
}
|
||||
|
||||
// create a formatted string with regions based on message ID from a text message
|
||||
func GetTextMessageString(msg *whatsapp.TextMessage) string {
|
||||
out := ""
|
||||
text := tview.Escape((*msg).Text)
|
||||
tim := time.Unix(int64((*msg).Info.Timestamp), 0)
|
||||
out += "[\""
|
||||
out += (*msg).Info.Id
|
||||
out += "\"]"
|
||||
if (*msg).Info.FromMe { //msg from me
|
||||
out += "[-::d](" + tim.Format("02-01-06 15:04:05") + ") [blue::b]Me: [-::-]" + text
|
||||
} else if strings.Contains((*msg).Info.RemoteJid, GROUPSUFFIX) { // group msg
|
||||
userId := (*msg).Info.SenderJid
|
||||
out += "[-::d](" + tim.Format("02-01-06 15:04:05") + ") [green::b]" + GetIdShort(userId) + ": [-::-]" + text
|
||||
} else { // message from others
|
||||
out += "[-::d](" + tim.Format("02-01-06 15:04:05") + ") [green::b]" + GetIdShort((*msg).Info.RemoteJid) + ": [-::-]" + text
|
||||
}
|
||||
out += "[\"\"]"
|
||||
return out
|
||||
}
|
||||
|
||||
// attempts to download a messages attachments, returns path or error message
|
||||
func (db *MessageDatabase) DownloadMessage(wid string, open bool) (string, error) {
|
||||
if msg, ok := (*db).otherMessages[wid]; ok {
|
||||
var fileName string = ""
|
||||
switch v := (*msg).(type) {
|
||||
default:
|
||||
case whatsapp.ImageMessage:
|
||||
if data, err := v.Download(); err == nil {
|
||||
fileName = v.Info.Id + "." + strings.TrimPrefix(v.Type, "image/")
|
||||
path, err := saveAttachment(data, fileName, open)
|
||||
return path, err
|
||||
} else {
|
||||
return fileName, err
|
||||
}
|
||||
case whatsapp.DocumentMessage:
|
||||
if data, err := v.Download(); err == nil {
|
||||
fileName = v.Info.Id + "." + strings.TrimPrefix(strings.TrimPrefix(v.Type, "application/"), "document/")
|
||||
path, err := saveAttachment(data, fileName, open)
|
||||
return path, err
|
||||
} else {
|
||||
return fileName, err
|
||||
}
|
||||
case whatsapp.AudioMessage:
|
||||
if data, err := v.Download(); err == nil {
|
||||
fileName = v.Info.Id + "." + strings.TrimPrefix(v.Type, "audio/")
|
||||
path, err := saveAttachment(data, fileName, open)
|
||||
return path, err
|
||||
} else {
|
||||
return fileName, err
|
||||
}
|
||||
case whatsapp.VideoMessage:
|
||||
if data, err := v.Download(); err == nil {
|
||||
fileName = v.Info.Id + "." + strings.TrimPrefix(v.Type, "video/")
|
||||
path, err := saveAttachment(data, fileName, open)
|
||||
return path, err
|
||||
} else {
|
||||
return fileName, err
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", errors.New("No attachments found")
|
||||
}
|
||||
|
||||
// helper to save an attachment and open it if specified
|
||||
func saveAttachment(data []byte, fileName string, openIt bool) (string, error) {
|
||||
path := GetHomeDir() + "Downloads" + string(os.PathSeparator) + fileName
|
||||
err := ioutil.WriteFile(path, data, 0644)
|
||||
if err == nil {
|
||||
if openIt {
|
||||
open.Run(path)
|
||||
}
|
||||
} else {
|
||||
return path, err
|
||||
}
|
||||
return path, nil
|
||||
return arr
|
||||
}
|
||||
|
||||
16
release.sh
16
release.sh
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
# get verison from main.go VERSION string
|
||||
if [ $# -eq 0 ]; then
|
||||
VERSION=$(cat main.go|grep "VERSION string"| awk -v FS="(\")" '{print $2}')
|
||||
else
|
||||
@@ -11,6 +12,7 @@ LINUXF=whatscli-$VERSION-linux.zip
|
||||
MACF=whatscli-$VERSION-macos.zip
|
||||
RASPIF=whatscli-$VERSION-raspberrypi.zip
|
||||
|
||||
# build zip files with binaries
|
||||
GOOS=darwin go build -o whatscli
|
||||
zip $MACF whatscli
|
||||
rm whatscli
|
||||
@@ -24,6 +26,7 @@ GOOS=linux GOARCH=arm GOARM=5 go build -o whatscli
|
||||
zip $RASPIF whatscli
|
||||
rm whatscli
|
||||
|
||||
# publish to github
|
||||
git pull
|
||||
LASTTAG=$(git describe --tags --abbrev=0)
|
||||
git log $LASTTAG..HEAD --no-decorate --pretty=format:"- %s" --abbrev-commit > changes.txt
|
||||
@@ -31,3 +34,16 @@ vim changes.txt
|
||||
gh release create $VERSION $LINUXF $MACF $WINF $RASPIF -F changes.txt -t $VERSION
|
||||
rm changes.txt
|
||||
rm *.zip
|
||||
|
||||
# update homebrew tap
|
||||
URL="https://github.com/normen/whatscli/archive/$VERSION.tar.gz"
|
||||
wget $URL
|
||||
SHASUM=$(shasum -a 256 $VERSION.tar.gz|awk '{print$1}')
|
||||
rm $VERSION.tar.gz
|
||||
cd ../../BrewCode/homebrew-tap
|
||||
sed -i bak "s/sha256 \".*/sha256 \"$SHASUM\"/" Formula/whatscli.rb
|
||||
sed -i bak "s!url \".*!url \"$URL\"!" Formula/whatscli.rb
|
||||
rm Formula/whatscli.rbbak
|
||||
git add -A
|
||||
git commit -m "update whatscli to $VERSION"
|
||||
git push
|
||||
|
||||
Reference in New Issue
Block a user