This Repo moved to https://codeberg.org/berzdev/fokus
Focus was developed to make our networked world more human-friendly.
Focus makes it possible to block distractions without using up a lot of willpower.
For example, computer systems can be blocked after a set period of use per day. Or disruptive internet sites can be blocked (YouTube, Amazon, Reddit…).
I personally use Fokus for the following use cases, for example:
- Block Instant Messengers after 10 minutes a day (Hetzner VM)
- No longer distracted by constant messages
- Peace of mind to live without being permanently available.
- More focused during the day
Requirements:
- Hetzner Cloud Account
- Hetzner Cloud API Token with
RW Access - Hetzner Cloud VServer + Firewall
- Download the repo
git clone ... - Edit
docker-compose.ymlwith your Hetzner API Key and Hetzner Firewall ID - Run
docker compose up -d - Now you should be able to make API calls
curl http://demohost/api/v1/service/status?token=yourtoken&service=chatxA service describes a system with which this API interacts.
Each service has a fixed time per day. After this time has elapsed, the service is set to “off” (switched off). For example, access to a VServer can be deactivated after X minutes.
At the moment following services are supported:
- Hetzner Cloud Firewall
One Hetzner Firewall service is currently defined inside the Code:
xyz := NewService("xyz", 0, 4).TypeHetznerFirewall(hetznerFirewall{token: os.Getenv("HETZNER_TOKEN"), id: os.Getenv("HETZNER_FW_ID")})API Basepath: http://host:8080/api/v1
Activates a service.
GET Parameter
| Parameter | Type | Definition | Req |
| --------- | ---- | ------------------------------- | ---- |
| token | str | Authentication token | true |
| service | str | Servicename | true |
CURL Bsp.
curl $APIPATH/service/on$APIAUTHDeactivate a service.
GET Parameter
| Parameter | Type | Definition | Req |
| --------- | ---- | ------------------------------- | ---- |
| token | str | Authentication token | true |
| service | str | Servicename | true |
CURL Bsp.
curl $APIPATH/service/off$APIAUTHGet the status of a service.
GET Parameter
| Parameter | Type | Definition | Req |
| --------- | ---- | ------------------------------- | ---- |
| token | str | Authentication token | true |
| service | str | Servicename | true |
CURL Bsp.
curl $APIPATH/service/status$APIAUTHSet the time per day to max. So you don’t have access to the service anymore for the whole day.
GET Parameter
| Parameter | Type | Definition | Req |
| --------- | ---- | ------------------------------- | ---- |
| token | str | Authentication token | true |
| service | str | Servicename | true |
CURL Bsp.
curl $APIPATH/service/limitfill$APIAUTHThis path provides a prometheus exporter for monitoring. Following custom metrics are implemented: apiActions backendFailure validationFailure authStatus