tale / headplane

An advanced UI for juanfont/headscale
MIT License
132 stars 6 forks source link

Expiry information #10

Closed Gurkengewuerz closed 4 months ago

Gurkengewuerz commented 4 months ago

Hey @tale,

thank you for your work on this nice looking admin ui for the latest alpha of headscale!

I am recreating my network using preauth keys with a 5 years expiration

docker compose exec headscale headscale preauthkey create --user <username> --expiration 5y --reusable

After registering the node I have a fully connected node with the given expiration of 0001-01-01 00:00:00 and Expired no. 2024-05-18_14-43-01

But the UI shows an expired tag. 2024-05-18_14-44-33

Maybe the API also sends the expired column?

Keep up your work its awesome!

tale commented 4 months ago

The API doesn't actually send the expired column, it's calculated here: https://github.com/juanfont/headscale/blob/main/hscontrol/types/node.go#L138. I'll fix this soon!

tale commented 4 months ago

Following up, I'm actually not sure what an expired date looks like on here. Because JS engines traditionally have had interesting Date parsing, 0001-01-01 00:00:00 becomes January 1, 2001. My thinking is I might need to add a date library to check if its a valid datestamp after 1970.

tale commented 4 months ago

3bd5cc99aa3b1ee7649e6979cb55726f8477b77f fixes it for me (available in 0.1.8). Can you confirm this also resolves the issue for you?

Gurkengewuerz commented 4 months ago

I'm on the latest docker image and it does not work for me. My headscale Version is on 0.23.0-alpha11. I can confirm that my non expiring nodes sends 0001-01-01T00:00:00Z in the routes/_data.machines._index route which is different from 0001-01-01 00:00:00.

tale commented 4 months ago

Ugh, okay, I just pushed a fix for it, but it might be a little while before I cut a release. If you want to try it now, ghcr.io/tale/headplane:edge.

Gurkengewuerz commented 4 months ago

Looks good to me now. :)

tale commented 4 months ago

Stable in 0.1.9.