Git Product home page Git Product logo

heartbeat's Introduction

Last Online Total Beats Docker Build CodeFactor

A service to see when a device was last active. Works by pinging the server every minute, from any device, as long as said device is unlocked and being used (ie, you typed or used the mouse in the last two minutes).

Contributing

Contributions to fix code are welcome, as are any improvements.

See USAGE.md for compiling + running + testing instructions.

Running server or client in production

See DOCS.md#running-server-in-production for more information.

API

See DOCS.md#api for more information.

heartbeat's People

Contributors

5ht2 avatar dependabot[bot] avatar emeraldsnorlax avatar lmaotrigine avatar not-super-nova avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

heartbeat's Issues

Refactor todos

  • Readd embeds
  • Switch to env vars
  • Rewrite current config system
  • Readd total visits support
  • Add multi-device support
  • Maybe re-do website frontend?
  • Change successful beat behavior to how it was before (returning unix timestamp)
  • Allow multiple tokens
  • Total uptime on stats page

Add a (since) line

So people don't have to do timezone conversion in their heads, it would display a relative time

Random SIGSEGV

This is most likely user error, since I'm not very familiar with Docker.

I cloned the repo, ran HB_PATH=$HOME/heartbeat/config docker compose up --build. This didn't work because for some reason there's no internet access within the compose build thing, so I had to add network: "host" to services.server.build in docker-compose.yml.

After this, it built successfully, but the moment I did curl localhost:6060 it panicked with this:

heartbeat-server-1    | panic: runtime error: invalid memory address or nil pointer dereference
heartbeat-server-1    | [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x76e082]
heartbeat-server-1    | 
heartbeat-server-1    | goroutine 13 [running]:
heartbeat-server-1    | main.RequestHandler(0xc0000ad080)
heartbeat-server-1    |         /heartbeat/handlers.go:35 +0x1e2
heartbeat-server-1    | github.com/valyala/fasthttp.CompressHandlerLevel.func1(0xc0000ad080)
heartbeat-server-1    |         /go/pkg/mod/github.com/valyala/[email protected]/server.go:503 +0x3c
heartbeat-server-1    | github.com/valyala/fasthttp.(*Server).serveConn(0xc0000fe200, 0x894e30, 0xc0000100b0, 0x0, 0x0)
heartbeat-server-1    |         /go/pkg/mod/github.com/valyala/[email protected]/server.go:2266 +0x15ab
heartbeat-server-1    | github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc000083860, 0xc000050720)
heartbeat-server-1    |         /go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:223 +0xba
heartbeat-server-1    | github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc000083860, 0xc000050720, 0x790ee0, 0xc000050720)
heartbeat-server-1    |         /go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:195 +0x35
heartbeat-server-1    | created by github.com/valyala/fasthttp.(*workerPool).getCh
heartbeat-server-1    |         /go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:194 +0x11f
heartbeat-server-1 exited with code 2

Any help would be appreciated.

Thanks.

Tasker link only imports profile without associated tasks

The taskernet link in the README only imports the Display unlocked profile, which sets a variable to True.

The ping task isn't imported at all.

It would be great if there was a separate link to import this task, or at least the steps needed to configure the task were explained.

Map support - required functionality

  • Scramble / don't show location unless authenticated, for privacy
  • Config flag, defaulted to "off"
  • CSS - current mods look scuffed
  • Javascript - indentation wasn't working and I gave up, this now needs fixing

Switch to a real DB

I'm having way too many issues with redis persistence, and honestly, a beats key in a redisjson database with 265020 values (it is literally a json array with 265,020 values in the root key) is not the best way to go about this. This is exactly the sort of thing SQL is for and I wish I knew that when I decided to write this project 2 years ago, so it's time to fix it (after Christmas, ideally).

Automatically detect port from env

Currently, you must edit both config/.env and docker-compose.yml to change the port of a Docker container. This is confusing to the user (and to me, when I forget about it).

Grabbing the port from config/.env would be ideal.

Currently we have HB_ADDR=0.0.0.0:6060, which is part of what we need. We could make the 6060 part a HB_PORT variable in config/.env if Docker supports expanding env vars.

Testing it needed to ensure if this is possible.

"Longest missing beat" doesn't work as intended

I'll do my best to explain this, but from what I understand right now it'll set the "record longest missing beat" if

  • Device A has a longer missing beat than record
  • But Device B has sent a recent beat

This behavior is unexpected, because the "current missing beat" is Device B's, since it is the most recent. Which means that you have not been missing for longer than record, only Device A has been missing that long.

This behavior differs from before and doesn't make sense because "record longest missing beat" would imply from all devices, not just one.

Possible solution..? Check if the current missing beat is longer than record, I think

Hardcoded Config

Demonstration

For example, I moved the heartbeat executable to my ~/.local/bin, and I added that directory to the $PATH. Now, when I run heartbeat, it will display an error about open config/.env: no such file or directory.

Solution

This can only be fixed by changing the source code, and recompiling.

Suggestion

I suggest heatbeat should use a global config file stored in ~/.config/heartbeat/env or you can pass in the directory of the config through command arguments.

Discord Webhook

Sends a message to the webhook when there is a new beat, or longest recorded absence is updated.

Setup Go Modules

Setup go modules as they're mandatory in Go 16

..or something like that

Switch to GH Containers

Github has support for storing your Docker images on Github, instead of Docker Hub. The GH Action that we're using currently does not need you to change much to add support for this.

The reasoning behind this is that Docker now only allows 1 personal access token for pushing your containers, and org plans are paid. Given this push to pay for Docker Hub (which enforces poor security practices), it would be better to switch to GH for hosting the images.

  • Switch Action and Makefile
  • Update update.sh script

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.