feat: update protocol version handling
- add ProtocolVersion variable to metadata package
- don't set `ServerMessage.ProtocolVersion` in `main`
- update `ServerMessage` default to include ProtocolVersion
🤖
This commit is contained in:
parent
ffc994126b
commit
1a47c0607b
3 changed files with 12 additions and 9 deletions
|
@ -10,7 +10,6 @@ import (
|
||||||
"github.com/charmbracelet/log"
|
"github.com/charmbracelet/log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Start() {
|
func Start() {
|
||||||
|
@ -21,10 +20,9 @@ func Start() {
|
||||||
showVersionFlag := flag.Bool("version", false, "Output version")
|
showVersionFlag := flag.Bool("version", false, "Output version")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
shared.Message.ProtocolVersion = strings.Split(metadata.GoTomatoVersion, ".")[0]
|
|
||||||
if *showVersionFlag {
|
if *showVersionFlag {
|
||||||
fmt.Printf("App-Version: %s\n", metadata.GoTomatoVersion)
|
fmt.Printf("App-Version: %s\n", metadata.GoTomatoVersion)
|
||||||
fmt.Printf("Protocol-Version: %s\n", shared.Message.ProtocolVersion)
|
fmt.Printf("Protocol-Version: %s\n", metadata.ProtocolVersion)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
package metadata
|
package metadata
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
const GoTomatoVersion = "v0.0.3" // The GoTomato Version
|
const GoTomatoVersion = "v0.0.3" // The GoTomato Version
|
||||||
|
var ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0]
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
package shared
|
package shared
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"git.smsvc.net/pomodoro/GoTomato/internal/metadata"
|
||||||
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Message = models.ServerMessage{
|
var Message = models.ServerMessage{
|
||||||
Mode: "Idle",
|
Mode: "Idle",
|
||||||
Settings: DefaultPomodoroConfig,
|
Settings: DefaultPomodoroConfig,
|
||||||
Session: 0,
|
Session: 0,
|
||||||
TimeLeft: DefaultPomodoroConfig.Work,
|
TimeLeft: DefaultPomodoroConfig.Work,
|
||||||
Ongoing: false,
|
Ongoing: false,
|
||||||
Paused: false,
|
Paused: false,
|
||||||
|
ProtocolVersion: metadata.ProtocolVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
var PomodoroPassword string
|
var PomodoroPassword string
|
||||||
|
|
Loading…
Reference in a new issue