From e3cafeaf9292f67459ff1d186f68283bfaedf2ae Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 31 Jan 2022 00:27:37 +0100 Subject: Add dependencies/vendor (whatsapp) --- .../Baozisoftware/qrcode-terminal-go/.gitignore | 24 ---- .../Baozisoftware/qrcode-terminal-go/LICENSE | 29 ---- .../Baozisoftware/qrcode-terminal-go/README.md | 39 ------ .../qrcode-terminal-go/qrcodeTerminal.go | 155 --------------------- 4 files changed, 247 deletions(-) delete mode 100644 vendor/github.com/Baozisoftware/qrcode-terminal-go/.gitignore delete mode 100644 vendor/github.com/Baozisoftware/qrcode-terminal-go/LICENSE delete mode 100644 vendor/github.com/Baozisoftware/qrcode-terminal-go/README.md delete mode 100644 vendor/github.com/Baozisoftware/qrcode-terminal-go/qrcodeTerminal.go (limited to 'vendor/github.com/Baozisoftware') diff --git a/vendor/github.com/Baozisoftware/qrcode-terminal-go/.gitignore b/vendor/github.com/Baozisoftware/qrcode-terminal-go/.gitignore deleted file mode 100644 index daf913b1..00000000 --- a/vendor/github.com/Baozisoftware/qrcode-terminal-go/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof diff --git a/vendor/github.com/Baozisoftware/qrcode-terminal-go/LICENSE b/vendor/github.com/Baozisoftware/qrcode-terminal-go/LICENSE deleted file mode 100644 index 72223a6e..00000000 --- a/vendor/github.com/Baozisoftware/qrcode-terminal-go/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2017, Baozisoftware -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/Baozisoftware/qrcode-terminal-go/README.md b/vendor/github.com/Baozisoftware/qrcode-terminal-go/README.md deleted file mode 100644 index 40e850ad..00000000 --- a/vendor/github.com/Baozisoftware/qrcode-terminal-go/README.md +++ /dev/null @@ -1,39 +0,0 @@ - -# qrcode-terminal-go -QRCode terminal for golang. - -# Example -```go -package main - -import "github.com/Baozisoftware/qrcode-terminal-go" - -func main() { - Test1() - Test2() -} - -func Test1(){ - content := "Hello, 世界" - obj := qrcodeTerminal.New() - obj.Get(content).Print() -} - -func Test2(){ - content := "https://github.com/Baozisoftware/qrcode-terminal-go" - obj := qrcodeTerminal.New2(qrcodeTerminal.ConsoleColors.BrightBlue,qrcodeTerminal.ConsoleColors.BrightGreen,qrcodeTerminal.QRCodeRecoveryLevels.Low) - obj.Get([]byte(content)).Print() -} -``` - -## Screenshots -### Windows XP -![winxp](https://github.com/Baozisoftware/qrcode-terminal-go/blob/master/screenshots/winxp.png) -### Windows 7 -![win7](https://github.com/Baozisoftware/qrcode-terminal-go/blob/master/screenshots/win7.png) -### Windows 10 -![win10](https://github.com/Baozisoftware/qrcode-terminal-go/blob/master/screenshots/win10.png) -### Ubuntu -![ubuntu](https://github.com/Baozisoftware/qrcode-terminal-go/blob/master/screenshots/ubuntu.png) -### macOS -![macos](https://github.com/Baozisoftware/qrcode-terminal-go/blob/master/screenshots/macos.png) diff --git a/vendor/github.com/Baozisoftware/qrcode-terminal-go/qrcodeTerminal.go b/vendor/github.com/Baozisoftware/qrcode-terminal-go/qrcodeTerminal.go deleted file mode 100644 index 6d0f64f3..00000000 --- a/vendor/github.com/Baozisoftware/qrcode-terminal-go/qrcodeTerminal.go +++ /dev/null @@ -1,155 +0,0 @@ -package qrcodeTerminal - -import ( - "fmt" - - "github.com/skip2/go-qrcode" - "github.com/mattn/go-colorable" - "image/png" - nbytes "bytes" -) - -type consoleColor string -type consoleColors struct { - NormalBlack consoleColor - NormalRed consoleColor - NormalGreen consoleColor - NormalYellow consoleColor - NormalBlue consoleColor - NormalMagenta consoleColor - NormalCyan consoleColor - NormalWhite consoleColor - BrightBlack consoleColor - BrightRed consoleColor - BrightGreen consoleColor - BrightYellow consoleColor - BrightBlue consoleColor - BrightMagenta consoleColor - BrightCyan consoleColor - BrightWhite consoleColor -} -type qrcodeRecoveryLevel qrcode.RecoveryLevel -type qrcodeRecoveryLevels struct { - Low qrcodeRecoveryLevel - Medium qrcodeRecoveryLevel - High qrcodeRecoveryLevel - Highest qrcodeRecoveryLevel -} - -var ( - ConsoleColors consoleColors = consoleColors{ - NormalBlack: "\033[38;5;0m \033[0m", - NormalRed: "\033[38;5;1m \033[0m", - NormalGreen: "\033[38;5;2m \033[0m", - NormalYellow: "\033[38;5;3m \033[0m", - NormalBlue: "\033[38;5;4m \033[0m", - NormalMagenta: "\033[38;5;5m \033[0m", - NormalCyan: "\033[38;5;6m \033[0m", - NormalWhite: "\033[38;5;7m \033[0m", - BrightBlack: "\033[48;5;0m \033[0m", - BrightRed: "\033[48;5;1m \033[0m", - BrightGreen: "\033[48;5;2m \033[0m", - BrightYellow: "\033[48;5;3m \033[0m", - BrightBlue: "\033[48;5;4m \033[0m", - BrightMagenta: "\033[48;5;5m \033[0m", - BrightCyan: "\033[48;5;6m \033[0m", - BrightWhite: "\033[48;5;7m \033[0m"} - QRCodeRecoveryLevels = qrcodeRecoveryLevels{ - Low: qrcodeRecoveryLevel(qrcode.Low), - Medium: qrcodeRecoveryLevel(qrcode.Medium), - High: qrcodeRecoveryLevel(qrcode.High), - Highest: qrcodeRecoveryLevel(qrcode.Highest)} -) - -type QRCodeString string - -func (v *QRCodeString) Print() { - fmt.Fprint(outer, *v) -} - -type qrcodeTerminal struct { - front consoleColor - back consoleColor - level qrcodeRecoveryLevel -} - -func (v *qrcodeTerminal) Get(content interface{}) (result *QRCodeString) { - var qr *qrcode.QRCode - var err error - if t, ok := content.(string); ok { - qr, err = qrcode.New(t, qrcode.RecoveryLevel(v.level)) - } else if t, ok := content.([]byte); ok { - qr, err = qrcode.New(string(t), qrcode.RecoveryLevel(v.level)) - } - if qr != nil && err == nil { - data := qr.Bitmap() - result = v.getQRCodeString(data) - } - return -} - -func (v *qrcodeTerminal) Get2(bytes []byte) (result *QRCodeString) { - data, err := parseQR(bytes) - if err == nil { - result = v.getQRCodeString(data) - } - return -} - -func New2(front, back consoleColor, level qrcodeRecoveryLevel) *qrcodeTerminal { - obj := qrcodeTerminal{front: front, back: back, level: level} - return &obj -} - -func New() *qrcodeTerminal { - front, back, level := ConsoleColors.BrightBlack, ConsoleColors.BrightWhite, QRCodeRecoveryLevels.Medium - return New2(front, back, level) -} - -func (v *qrcodeTerminal) getQRCodeString(data [][]bool) (result *QRCodeString) { - str := "" - for ir, row := range data { - lr := len(row) - if ir == 0 || ir == 1 || ir == 2 || - ir == lr-1 || ir == lr-2 || ir == lr-3 { - continue - } - for ic, col := range row { - lc := len(data) - if ic == 0 || ic == 1 || ic == 2 || - ic == lc-1 || ic == lc-2 || ic == lc-3 { - continue - } - if col { - str += fmt.Sprint(v.front) - } else { - str += fmt.Sprint(v.back) - } - } - str += fmt.Sprintln() - } - obj := QRCodeString(str) - result = &obj - return -} - -func parseQR(bytes []byte) (data [][]bool, err error) { - r := nbytes.NewReader(bytes) - img, err := png.Decode(r) - if err == nil { - rect := img.Bounds() - mx, my := rect.Max.X, rect.Max.Y - data = make([][]bool, mx) - for x := 0; x < mx; x++ { - data[x] = make([]bool, my) - for y := 0; y < my; y++ { - c := img.At(x, y) - r, _, _, _ := c.RGBA() - data[x][y] = r == 0 - } - } - } - return -} - -var outer = colorable.NewColorableStdout() -- cgit v1.2.3