# README
A simple time tracker, in the spirit of time management approaches like:
Usage:
- Start the server (see below for flags).
go run github.com/zvold/zvold.github.io/src/[email protected]
- Start the client(s).
Open http://hostname:37177
in the browser. Use the optional URL parameter ?t=
to set the "target" work/rest ratio.
- Toggle the mode (
work
/rest
/off
) appropriately.
This can be done from any client. The state is maintained on the server, and clients are eventually consistent.
Refreshing the page will get the up-to-date state from the server.
The server accepts some command-line flags:
-
-port
to change the HTTP port the server will listen on. -
-https
to start an additional HTTPs server onport+1
. This expects SSL certificate filesserver.crt
andserver.key
to be present. -
-v
to enable more verbose server logs.
# Structs
JsonRequest struct represents the body of an HTTP POST request.
*NormalClock satisfies the Clock interface.
The set of remote hosts (IP + user agent) seen during the operation.
State struct represents the full state of the punch clock.
WsClient is a mutex-protected pointer to `websocket.Conn`.
WsClients is a mutex-protected set of all connected websocket clients.
# Interfaces
Clock interface is injected for better testing.
# Type aliases
ModeType is an enum representing the possible "modes": work, rest and off.