feat: refactor shared.Message to a channel

- 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
This commit is contained in:
Sebastian Mark 2024-10-27 10:41:31 +01:00
parent cc24dd6775
commit bbc9977f1c
10 changed files with 108 additions and 82 deletions

View file

@ -1,7 +1,7 @@
package helper
import (
"git.smsvc.net/pomodoro/ChronoTomato/pkg/models"
ChronoTomato "git.smsvc.net/pomodoro/ChronoTomato/pkg/models"
"github.com/charmbracelet/log"
"gopkg.in/yaml.v3"
"os"
@ -9,8 +9,8 @@ import (
"strings"
)
func ParseConfig(filename string) models.ConfigFile {
var config models.ConfigFile
func ParseConfig(filename string) ChronoTomato.Config {
var config ChronoTomato.Config
if strings.HasPrefix(filename, "~/") {
dirname, _ := os.UserHomeDir()
filename = filepath.Join(dirname, filename[2:])
@ -19,7 +19,7 @@ func ParseConfig(filename string) models.ConfigFile {
if err != nil {
log.Warn("Error opening config file!", "reason", err)
log.Warn("Using defaults")
return models.ConfigFile{
return ChronoTomato.Config{
URL: "ws://localhost:8080/ws",
}
}