Sebastian Mark
bbc9977f1c
- remove `shared` package and shared.Message - rename `notifications` package to `frontend` - introduce a channel send the received ServerMessages to the frontend handler(s) - move keyhandler to goroutine - simplify password handling in Start function - update import names when importing from GoTomoto
24 lines
567 B
Go
24 lines
567 B
Go
package frontend
|
|
|
|
import (
|
|
ChronoTomato "git.smsvc.net/pomodoro/ChronoTomato/pkg/models"
|
|
GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
|
"github.com/gorilla/websocket"
|
|
)
|
|
|
|
var message GoTomato.ServerMessage
|
|
|
|
func Handler(conn *websocket.Conn, config ChronoTomato.Config, channel <-chan GoTomato.ServerMessage) {
|
|
keyhandler_quit := make(chan bool, 1)
|
|
go keyhandler(conn, config, &message, keyhandler_quit)
|
|
|
|
for {
|
|
select {
|
|
case message = <-channel:
|
|
desktopNotifications(message)
|
|
terminalOutput(message)
|
|
case <-keyhandler_quit:
|
|
return
|
|
}
|
|
}
|
|
}
|