Add building.md

Switch to scanning runes in client since go fmt scanning ignores spaces because of excellent design
This commit is contained in:
Kevin F 2023-01-05 01:10:57 -06:00
parent e921331ef5
commit f089202286
3 changed files with 24 additions and 1 deletions

15
Building.md Normal file
View File

@ -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`

View File

@ -91,13 +91,18 @@ We read keys from stdin and send them to the server until we get EOF
for { for {
var key string 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 != nil {
if err == io.EOF { if err == io.EOF {
break break
} }
log.Fatal(err) log.Fatal(err)
} }
fmt.Println("send" + strings.Replace(key, " ", "space", 10))
err = client.WriteMessage(websocket.TextMessage, []byte(key)) err = client.WriteMessage(websocket.TextMessage, []byte(key))
if err != nil { if err != nil {
log.Fatal("write:", err) log.Fatal("write:", err)

View File

@ -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. 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? ## Why a smart keyboard?
@ -85,6 +87,7 @@ Then we can start the web server and listen for websocket connections.
"fmt" "fmt"
"io" "io"
"strings" "strings"
"bufio"
"log" "log"
@{gorilla/websocket import string} @{gorilla/websocket import string}
"keyboard.voidnet.tech/server" "keyboard.voidnet.tech/server"