break: rename GoTomatoPomodoroConfig
-> PomodoroConfig
This commit is contained in:
parent
0180aea8c1
commit
c20d36d2d2
5 changed files with 13 additions and 13 deletions
|
@ -9,7 +9,7 @@ var DefaultServerConfig = models.GoTomatoServerConfig{
|
||||||
ListenPort: 8080,
|
ListenPort: 8080,
|
||||||
}
|
}
|
||||||
|
|
||||||
var DefaultPomodoroConfig = models.GoTomatoPomodoroConfig{
|
var DefaultPomodoroConfig = models.PomodoroConfig{
|
||||||
Work: 25 * 60,
|
Work: 25 * 60,
|
||||||
ShortBreak: 5 * 60,
|
ShortBreak: 5 * 60,
|
||||||
LongBreak: 15 * 60,
|
LongBreak: 15 * 60,
|
||||||
|
|
|
@ -49,7 +49,7 @@ func handleClientCommands(ws *websocket.Conn) {
|
||||||
}
|
}
|
||||||
case "updateSettings":
|
case "updateSettings":
|
||||||
if !pomodoro.IsPomodoroOngoing() {
|
if !pomodoro.IsPomodoroOngoing() {
|
||||||
if clientCommand.Settings != (models.GoTomatoPomodoroConfig{}) {
|
if clientCommand.Settings != (models.PomodoroConfig{}) {
|
||||||
shared.Message.Settings = clientCommand.Settings
|
shared.Message.Settings = clientCommand.Settings
|
||||||
shared.Message.TimeLeft = clientCommand.Settings.Work
|
shared.Message.TimeLeft = clientCommand.Settings.Work
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
|
|
||||||
// ClientCommand represents a command from the client (start/stop).
|
// ClientCommand represents a command from the client (start/stop).
|
||||||
type ClientCommand struct {
|
type ClientCommand struct {
|
||||||
Command string `json:"command"` // comman send to the server
|
Command string `json:"command"` // comman send to the server
|
||||||
Password string `json:"password"` // pomodoro control password
|
Password string `json:"password"` // pomodoro control password
|
||||||
Settings GoTomatoPomodoroConfig `json:"settings"` // pomodoro config
|
Settings PomodoroConfig `json:"settings"` // pomodoro config
|
||||||
}
|
}
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package models
|
package models
|
||||||
|
|
||||||
type GoTomatoPomodoroConfig struct {
|
type PomodoroConfig struct {
|
||||||
Work int `json:"work"` // Length of work sessions in seconds
|
Work int `json:"work"` // Length of work sessions in seconds
|
||||||
ShortBreak int `json:"shortBreak"` // Length of short break in seconds
|
ShortBreak int `json:"shortBreak"` // Length of short break in seconds
|
||||||
LongBreak int `json:"longBreak"` // Length if ling break in seconds
|
LongBreak int `json:"longBreak"` // Length if ling break in seconds
|
||||||
|
|
|
@ -2,11 +2,11 @@ package models
|
||||||
|
|
||||||
// ServerMessage represents the data sent to the client via WebSocket.
|
// ServerMessage represents the data sent to the client via WebSocket.
|
||||||
type ServerMessage struct {
|
type ServerMessage struct {
|
||||||
Mode string `json:"mode"` // "Idle", "Work", "ShortBreak", "LongBreak" or "End"
|
Mode string `json:"mode"` // "Idle", "Work", "ShortBreak", "LongBreak" or "End"
|
||||||
Settings GoTomatoPomodoroConfig `json:"settings"` // The currrent pomodoro settings
|
Settings PomodoroConfig `json:"settings"` // The currrent pomodoro settings
|
||||||
Session int `json:"session"` // Current session number
|
Session int `json:"session"` // Current session number
|
||||||
TimeLeft int `json:"time_left"` // Remaining time in seconds
|
TimeLeft int `json:"time_left"` // Remaining time in seconds
|
||||||
Ongoing bool `json:"ongoing"` // Ongoing pomodoro
|
Ongoing bool `json:"ongoing"` // Ongoing pomodoro
|
||||||
Paused bool `json:"paused"` // Is timer paused
|
Paused bool `json:"paused"` // Is timer paused
|
||||||
ProtocolVersion string `json:"version"` // Version of the server
|
ProtocolVersion string `json:"version"` // Version of the server
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue