diff --git a/.gitignore b/.gitignore
index 5ee2497..2201ae4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1 @@
GoTomato
-
-dist/
diff --git a/.goreleaser.yaml b/.goreleaser.yaml
deleted file mode 100644
index 77a3e60..0000000
--- a/.goreleaser.yaml
+++ /dev/null
@@ -1,43 +0,0 @@
-# vim: set ts=2 sw=2 tw=0 fo=cnqoj
-# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
-
-version: 2
-
-before:
- hooks:
- - go mod tidy
-
-builds:
- - goos:
- - linux
- goarch:
- - amd64
- - arm64
- env:
- - CGO_ENABLED=0
- ldflags:
- - -s -w -X {{.ModulePath}}/internal/metadata.GoTomatoVersion={{.Version}}
-
-upx:
- - enabled: true
- compress: best
- lzma: true
-
-changelog:
- use: gitea
- filters:
- exclude:
- - "chore: bump version to"
-
-archives:
- - format: binary
-
-release:
- gitea:
- owner: pomodoro
- name: GoTomato
- mode: replace
-
-gitea_urls:
- download: http://git.smsvc.net
- api: http://git.smsvc.net/api/v1
diff --git a/.renovaterc.json b/.renovaterc.json
index aceb001..ff27ef5 100644
--- a/.renovaterc.json
+++ b/.renovaterc.json
@@ -2,11 +2,5 @@
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>infrastructure/renovate-config"
- ],
- "packageRules": [
- {
- "matchManagers": ["gomod"],
- "semanticCommitType": "chore"
- }
]
}
diff --git a/README.md b/README.md
index 596cb46..15e4f08 100644
--- a/README.md
+++ b/README.md
@@ -34,17 +34,17 @@ Here are the available commands:
| `pause` | Pauses the current session | `{"command": "pause", "password": ""}` |
| `resume` | Resumes a paused session | `{"command": "resume", "password": ""}` |
| `reset` | Stops and resets the current session | `{"command": "reset", "password": ""}` |
-| `updateSettings` | Update Pomodoro settings | `{"command": "updateSettings", "password": "", "settings": {"focus": 600, "shortBreak": 60, "longBreak": 300, "sessions": 2}}` |
+| `updateSettings` | Update Pomodoro settings | `{"command": "updateSettings", "password": "", "settings": {"work": 600, "shortBreak": 60, "longBreak": 300, "sessions": 2}}` |
#### Update Settings Command (`updateSettings`)
-The `updateSettings` command allows clients to modify the Pomodoro timer configuration, including the length of focus sessions, short breaks, long breaks, and the total number of sessions in a cycle. This command must include a valid password to be accepted by the server. The updateSettings command can be used when the timer is stopped.
+The `updateSettings` command allows clients to modify the Pomodoro timer configuration, including the length of work sessions, short breaks, long breaks, and the total number of sessions in a cycle. This command must include a valid password to be accepted by the server. The updateSettings command can be used when the timer is stopped.
- Fields in the `settings` Object:
- - `focus`: Length of the focus session (in seconds).
+ - `work`: Length of the work session (in seconds).
- `shortBreak`: Length of the short break (in seconds).
- `longBreak`: Length of the long break (in seconds).
- - `sessions`: Total number of focus/break sessions in the Pomodoro cycle.
+ - `sessions`: Total number of work/break sessions in the Pomodoro cycle.
All fields are mandatory and may not be ommitted.
@@ -52,14 +52,14 @@ All fields are mandatory and may not be ommitted.
The server periodically (every second) sends JSON-encoded messages to all connected clients to update them on the current state of the Pomodoro session. These messages contain the following fields:
-- mode: Indicates the current phase of the Pomodoro session ("Focus", "ShortBreak", "LongBreak", "End" or "Idle").
+- mode: Indicates the current phase of the Pomodoro session ("Work", "ShortBreak", "LongBreak", "End" or "Idle").
- "End" is send only once, after all sessions are finished
- settings: Contains the current Pomodoro settings:
- - focus: Length of the focus session in seconds (e.g., 1500 for 25 minutes).
+ - work: Length of the work session in seconds (e.g., 1500 for 25 minutes).
- shortBreak: Length of the short break in seconds (e.g., 300 for 5 minutes).
- longBreak: Length of the long break in seconds (e.g., 900 for 15 minutes).
- - sessions: The total number of focus/break sessions (e.g., 4).
-- session: The current session number (e.g., 1 for the first focus session).
+ - sessions: The total number of work/break sessions (e.g., 4).
+- session: The current session number (e.g., 1 for the first work session).
- time_left: The remaining time for the current mode, in seconds (e.g., 900 for 15 minutes).
- ongoing: Whether a Pomodoro session is currently ongoing.
- paused: Whether the timer is paused.
@@ -67,11 +67,11 @@ The server periodically (every second) sends JSON-encoded messages to all connec
| Message Type | Example |
| --- | --- |
-| Welcome Message | {"mode":"Idle", "settings":{"focus":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":1500, "ongoing":false, "paused":false, "version":"0"} |
-| Session Running | {"mode":"Focus", "settings":{"focus":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":1, "time_left":900, "ongoing":true, "paused":false, "version":"0"} |
-| Session Running | {"mode":"ShortBreak", "settings":{"focus":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":50, "ongoing":true, "paused":false, "version":"0"} |
-| Session Paused | {"mode":"Focus", "settings":{"focus":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":456, "ongoing":true, "paused":true, "version":"0"} |
-| Session End/Reset | {"mode":"End", "settings":{"focus":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":0, "ongoing":false, "paused":false, "version":"0"} |
+| Welcome Message | {"mode":"Idle", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":1500, "ongoing":false, "paused":false, "version":"v0"} |
+| Session Running | {"mode":"Work", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":1, "time_left":900, "ongoing":true, "paused":false, "version":"v0"} |
+| Session Running | {"mode":"ShortBreak", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":50, "ongoing":true, "paused":false, "version":"v0"} |
+| Session Paused | {"mode":"Work", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":456, "ongoing":true, "paused":true, "version":"v0"} |
+| Session End/Reset | {"mode":"End", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":0, "ongoing":false, "paused":false, "version":"v0"} |
## Testing
diff --git a/Taskfile.yml b/Taskfile.yml
deleted file mode 100644
index 8efbf3a..0000000
--- a/Taskfile.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-# yaml-language-server: $schema=https://taskfile.dev/schema.json
-#
-# github.com/go-task/task/v3/cmd/task@latest
-# Requirements:
-# github.com/caarlos0/svu@latest
-# github.com/goreleaser/goreleaser/v2@latest
-
-version: '3'
-
-tasks:
-
- release:
- desc: Create and publish an new release
- vars:
- RELEASE:
- sh: svu next
- BRANCH:
- sh: git branch --show-current
- COMMIT:
- sh: git rev-parse --short --verify {{.BRANCH}}
- preconditions:
- - sh: test "{{.BRANCH}}" == "main"
- msg: "You must be on the main branch to release"
- prompt: Create new release {{.RELEASE}} from {{.COMMIT}}@{{.BRANCH}}?
- cmds:
- - git tag {{.RELEASE}}
- - git push
- - git push origin tag {{.RELEASE}}
- - goreleaser release --clean
-
- snapshot:
- desc: Create a local snapshot release
- cmds:
- - goreleaser release --clean --snapshot
diff --git a/cmd/server/main.go b/cmd/server/main.go
index 78c5c99..126ec2f 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -3,11 +3,10 @@ package server
import (
"flag"
"fmt"
- "github.com/gorilla/handlers"
+ "github.com/charmbracelet/log"
"net/http"
"os"
- "git.smsvc.net/pomodoro/GoTomato/internal/helper"
"git.smsvc.net/pomodoro/GoTomato/internal/metadata"
"git.smsvc.net/pomodoro/GoTomato/internal/shared"
"git.smsvc.net/pomodoro/GoTomato/internal/websocket"
@@ -16,27 +15,20 @@ import (
var (
// define CLI flags
- listenAddress = flag.String("listenAddress", shared.DefaultServerConfig.ListenAddress, "IP address to listen on")
- listenPort = flag.Int("listenPort", shared.DefaultServerConfig.ListenPort, "Port to listen on")
- password = flag.String("password", "", "Control password for pomodoro session (optional)")
- showVersion = flag.Bool("version", false, "Output version")
+ listenAddress = flag.String("listenAddress", shared.DefaultServerConfig.ListenAddress, "IP address to listen on")
+ listenPort = flag.Int("listenPort", shared.DefaultServerConfig.ListenPort, "Port to listen on")
+ password = flag.String("password", "", "Control password for pomodoro session (optional)")
+ showVersionFlag = flag.Bool("version", false, "Output version")
)
// Start the pomodoro server
func Start() {
- // Update usage output
- flag.Usage = func() {
- fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", "GoTomato")
- flag.PrintDefaults()
- fmt.Println("\nPoint your client to 'ws://
-
-
+
+
@@ -64,7 +64,7 @@