Commit graph

61 commits

Author SHA1 Message Date
6df3739dd8 move websocket vars and const to main.go 2024-11-21 09:33:29 +01:00
6100526610 add log message when removing stale client 2024-11-21 09:12:42 +01:00
71427f2879 fix logging 2024-11-21 09:12:42 +01:00
c1f158f42a merge ping and stale check 2024-11-21 09:12:42 +01:00
80ddfe57f4 add timeout consts in new file 2024-11-21 09:12:42 +01:00
e8cc2d1808 refactor: drop SendMessage() and merge into SendPermanentBroadCastMessage() 2024-11-21 09:12:42 +01:00
df98628d91 move ping from SendMessage() to RemoveStaleClients() 2024-11-21 08:27:15 +01:00
2faa95c162 remove client from list if stale 2024-11-20 22:01:56 +01:00
a0463ad817 comment updates 2024-11-20 21:52:08 +01:00
0ab0884508 add more Mutex Locks for Clients map 2024-11-20 21:51:58 +01:00
bf9b818940 move stale client check to RemoveStaleClients() 2024-11-20 21:50:43 +01:00
f4b1e7c808 add client.IsStale() 2024-11-20 21:26:17 +01:00
8295208a0b skip client after closing unresponsive client 2024-11-20 20:41:50 +01:00
18accba19a optimize ping/pong code 2024-11-20 20:39:32 +01:00
62b6ab81a5 remove duplicate logging 2024-11-20 20:33:26 +01:00
ed6902def0 init LastPong 2024-11-20 20:27:20 +01:00
6f60423c03 add more log output 2024-11-20 20:21:22 +01:00
409fd741dd move check for unresponsive clients to additional loops 2024-11-20 20:18:41 +01:00
15f6b0227a try to check for last ping connect 2024-11-20 20:15:24 +01:00
2d8816f4ba another try to remove vanished clients 2024-11-20 19:53:40 +01:00
370469de36 fix: remove client from active connections after write deadline
- add a constant for timeout duration in seconds
- set write deadline for client connections
- remove client from active connections on error
- log additional information when broadcasting fails

🤖
2024-11-20 14:07:00 +01:00
31179d4af4 break: update terminology from "Work" to "Focus"
- change mode from "Work" to "Focus" in server messages
- modify pomodoro configuration to use "Focus" instead of "Work"
- adjust default settings to reflect new terminology
- ensure all references to work duration are updated to focus duration
- update variable names in HTML and JavaScript for clarity

🤖
2024-11-18 19:14:42 +01:00
600d2ed2ff feat: implement centralized logging helper
- remove direct log usage
- create a new logging helper
- update all log calls to use the new Logger instance
- set timestamp to ISO8601

🤖
2024-11-04 20:33:25 +01:00
44a64bfce4 feat: handle X-Forward-For for log output
- add Gorilla handlers package for enhanced HTTP handling
- refactor HTTP server to use a new ServeMux for routing
- update ListenAndServe to utilize ProxyHeaders for better proxy support
- add RealIP field to client model
  - use RealIP fild for connect/disconnect log output
2024-11-03 11:17:23 +01:00
e7618b19ef feat: validate client settings and improve logging
- add a function to check if Pomodoro settings are valid
- log a warning for invalid client configurations
- log an info message for valid client configurations
- implement Stringer interface for PomodoroConfig model

🤖
2024-10-30 11:28:42 +01:00
f4fd37c551 feat: update logging for client connect and disconnect
- update logging to use ws.RemoteAddr()

🤖
2024-10-30 10:20:44 +01:00
0ee955189c feat: update client management to use local address as identifier
- change Clients map to use net.Addr as the key type
- update `HandleConnection()` to store clients using LocalAddr
- modify `handleClientCommands()` to delete clients by LocalAddr

🤖
2024-10-30 10:20:12 +01:00
ebb58a4489 feat: rename Client model to WebsocketClient
🤖
2024-10-30 09:57:09 +01:00
bdfd5c3b84 feat: remove unused client mutex
- remove unused Mutex from `models.Client` struct
- remove lock from `HandleConnection()`
- replace websocket.Conn with models.Client in `handleClientCommands()`

🤖
2024-10-30 08:09:41 +01:00
d0b1260f62 doc: add and improve comments 2024-10-30 07:39:30 +01:00
d83acc77b2 refactor: rename HandleConnections to HandleConnection
- rename function to better reflect its purpose

🤖
2024-10-29 20:21:00 +01:00
b8823acc97 refacor: replace shared.Message with shared.State
🤖
2024-10-29 18:46:00 +01:00
e2ab19066d format: update import statements order for consistency 2024-10-29 11:05:45 +01:00
3a6be4c187 feat: update settings handling for pomodoro configuration
- add `UpdateSettings()` to update pomodoro configuration
- refactor client command handling to use `UpdateSettings()`

🤖
2024-10-29 11:05:45 +01:00
c20d36d2d2 break: rename GoTomatoPomodoroConfig -> PomodoroConfig 2024-10-26 10:19:50 +02:00
16bc946a30 break: rename ClientCommand.PomodoroSettings -> .Settings 2024-10-26 10:19:44 +02:00
61b2f71bf3 break: rename ServerMessage.PomodoroSettings -> .Settings 2024-10-26 10:19:41 +02:00
899417b605 feat: replace standard log with charmbracelet/log
- update logging to use charmbracelet/log package
- improve log messages for server start and errors
- enhance client connection and disconnection logs

🤖
2024-10-26 00:15:02 +02:00
62fbb1d356 feat: add a ticker to manage broadcast timing 2024-10-25 23:18:46 +02:00
13d7cd0919 feat: add number of connected clients to log output 2024-10-24 22:48:45 +02:00
715fe60e1d refactor: better check for empty pomodoro client settings
- replace UnsetPomodoroConfig with empty struct check in client commands
- remove unused UnsetPomodoroConfig variable

🤖
2024-10-23 21:29:57 +02:00
cb6616f400 break: add updateSettings command to modify Pomodoro settings
- add `updateSettings` command to modify Pomodoro configuration
- remove ability to set Pomodoro configuration in `start` command
- update demo client
- update README

🤖
2024-10-22 08:51:22 +02:00
c6ce7d46ad feat: improve logging for client connects and disconnects
- add connection log to record client address on connect
- enhance disconnection log to include client address

🤖
2024-10-21 18:00:07 +02:00
f991ba885d feat: allow restrict Pomodoro via password
- introduce password flag in server command line options
- update clientCommand model
- add password requirement for controlling the Pomodoro timer
- document password in README
2024-10-21 17:29:04 +02:00
8deb642a7e fix: initialize pomodoroConfig from DefaultPomodoroConfig only once
🤖
2024-10-21 15:49:01 +02:00
a9d145ee71 feat: create shared config defaults
- add shared configuration defaults for server and pomodoro

🤖
2024-10-21 13:07:19 +02:00
28342058aa doc: update comments 2024-10-21 13:07:19 +02:00
6ffd9f1e38 refactor: move broadcast package to websocket
- update import paths to reflect the new package name
- change function call to use the new websocket package
- adjust client iteration to use the renamed Clients variable

🤖
2024-10-21 13:07:19 +02:00
aab6896c7d refactor: move broadcast.Message to shared.Message
- create a new shared state file to manage message state
- replace broadcast.Message with shared.Message in pomodoro logic
- update websocket client handling to use shared.Clients
- remove unnecessary broadcast imports from various files
- ensure consistent message handling across the application

🤖
2024-10-21 13:07:19 +02:00
234f3c17dc feat: simplify pomodoro functions by removing client parameter
- remove clients parameter from RunPomodoro function
- update startTimer to no longer require clients parameter
- modify ResetPomodoro to eliminate clients parameter
- adjust client_commands to reflect changes in function signatures

🤖
2024-10-21 13:07:19 +02:00