juanfont / headscale

An open source, self-hosted implementation of the Tailscale control server
BSD 3-Clause "New" or "Revised" License
22.21k stars 1.23k forks source link

[Improvement] use go-elem for HTML pages #2115

Open kradalby opened 1 week ago

kradalby commented 1 week ago

Use case

We currently have a couple of HTML files/template strings in the code using gotemplate and handcrafted HTML, its not a lot, and its fine, but a nice QoL improvement would be to make them nice, typed and generated.

Description

I have had quite a good experience with go-elem for this for some other projects, ergonomics are pretty good for writing HTML as functions, at least if we consider that it is Go and not something like Elm, Roc or Scala which might allow a bit nicer funcs.

Contribution

How can it be implemented?

I will eventually do this, but if someone is up for converting the HTML to go-elem, that would be a great PR/starter issue, make things neat and reusable.

amha-mersha commented 1 week ago

Hello @kradalby , I really would like to take this and work on it.

kradalby commented 1 week ago

@amha-mersha sounds good, I think we will not merge anything until after 0.23.0 goes in, but I think a good approach would be to make a PR converting something small, like https://github.com/juanfont/headscale/blob/main/hscontrol/handlers.go#L141-L168 would be a good start!

amha-mersha commented 1 week ago

Sure @kradalby , do you need to assign it to me or do I just do it and make a PR

kradalby commented 1 week ago

I assigned it so people know, but other than that you can make a PR.

amha-mersha commented 1 week ago

Thank you @kradalby for assigning me my first open-source contribution, I have finished it and made a PR. Are there other things I can work on.

kradalby commented 1 week ago

You can also start on https://github.com/juanfont/headscale/blob/main/hscontrol/templates/windows.html, and where it is called in the code. the more you can make functions to reuse the better