From f08920228689ab1713dc77f05822a6010436b3cb Mon Sep 17 00:00:00 2001 From: Kevin F Date: Thu, 5 Jan 2023 01:10:57 -0600 Subject: [PATCH] Add building.md Switch to scanning runes in client since go fmt scanning ignores spaces because of excellent design --- Building.md | 15 +++++++++++++++ Client.md | 7 ++++++- ReadMe.md | 3 +++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 Building.md diff --git a/Building.md b/Building.md new file mode 100644 index 0000000..df646b4 --- /dev/null +++ b/Building.md @@ -0,0 +1,15 @@ +# Building (Linux) + +1. Aquire [srcweave](https://github.com/justinmeiners/srcweave). (see below for installation instructions) +2. Aquire golang +3. Run `make build` + + + +## Installing srcweave + +1. Install sbcl (steel bank common lisp) +2. Install quicklisp (instructions: [https://quicklisp.org/beta/](https://quicklisp.org/beta/]) +3. `git clone https://github.com/justinmeiners/srcweave` +4. `cd srcweave` +5. `make; make install` \ No newline at end of file diff --git a/Client.md b/Client.md index e5208dc..57284c7 100644 --- a/Client.md +++ b/Client.md @@ -91,13 +91,18 @@ We read keys from stdin and send them to the server until we get EOF for { var key string - _, err := fmt.Scanln(&key) + reader := bufio.NewReader(os.Stdin) + + rune, _, err := reader.ReadRune() //:= fmt.Scan(&key) + key = string(rune) + if err != nil { if err == io.EOF { break } log.Fatal(err) } + fmt.Println("send" + strings.Replace(key, " ", "space", 10)) err = client.WriteMessage(websocket.TextMessage, []byte(key)) if err != nil { log.Fatal("write:", err) diff --git a/ReadMe.md b/ReadMe.md index a7e3c04..9c1369a 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -16,6 +16,8 @@ The goal of this particular daemon is not to perfectly emulate a HID, so it may A client is included that simply connects and authenticates. It is meant to be used with unix philosophy modules, for example a password manager wrapper. A UI could then wrap the client and said modules. +**See [Building.md](Building.md) for instructions on how to build this [literate](https://en.wikipedia.org/wiki/Literate_programming) project.** + ## Why a smart keyboard? @@ -85,6 +87,7 @@ Then we can start the web server and listen for websocket connections. "fmt" "io" "strings" + "bufio" "log" @{gorilla/websocket import string} "keyboard.voidnet.tech/server"