go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.38k stars 5.43k forks source link

Move all template files completely outside the binary #28724

Closed VetheonGames closed 8 months ago

VetheonGames commented 8 months ago

Feature Description

In the current state, customizing Gitea is an infuriating and objectively terrible experience. This could be made much much much easier by simply reading the template files from outside the binary, instead of packing them into the binary.

I think that Gitea's biggest selling point is it's ability to truly be totally customized, unlike things like Gitlab.

However, trying to properly fully customize Gitea is probably the worst experience I've ever had trying to theme a webapp.

I have had better experiences theming Pterodactyl Panel, cPanel, and WHMCS.

I believe that the reason for this frustration is the decision to include the template files only inside the binary. So, I would suggest that the template files (all of them) should be moved outside the binary, so that they can be edited or replaced directly by the system administrator/developer, rather than leaning on the poorly documented, and frustrating to use templating system. Also, it would allow customizations to persist through updates to the binary/docker image. Which currently (at least for the docker image) they don't.

If enough people are interested in this, I am even willing to code it and open a PR for it myself. I am only making the feature request to ensure it's not already in the plans/people actually want the feature.

Screenshots

No response

eeyrjmr commented 8 months ago

I disagee. Another one of gitea's selling points is the update process is simple, as in just replace the SINGLE exe

If the runtime then layed out into the filesystem the template directory just to make a subset of users.life easier, what is it todo on an upgrade? What file should be replaced?

delvh commented 8 months ago

Not just the update process, but also especially the installation. If we remove the templates, it won't be easy anymore to setup a new instance if you've never used Gitea before.

VetheonGames commented 8 months ago

If the runtime then layed out into the filesystem the template directory just to make a subset of users.life easier, what is it todo on an upgrade? What file should be replaced?

You assume this would mean to completely remove the embedded files from the binary. My idea was to just write out the template files to the filesystem and re-write them if necessary. Easy peasey.

Not just the update process, but also especially the installation.

How so exactly? Literally nothing about the codebase really needs to change other than to add a function to write the files outside the binary in the filesystem, and refactor htmlrenderer.go load them from there instead of the embedded ones. Setup, installation, and updates need not be affected if it's implemented correctly.

lafriks commented 8 months ago

There is already cli method to copy template out from binary to custom dir and it can be modified and used by gitea but it is hard to keep it up to date with new versions as they can break things so I would be very careful with that

lafriks commented 8 months ago

https://docs.gitea.com/administration/customizing-gitea#customizing-gitea-pages-and-resources

VetheonGames commented 8 months ago

I'll just keep maintaining my custom fork that bypasses the whole customization system and reads exclusively form the file system. It's not that big a deal. In less than an hours work I have a working version so, it's nbd

lunny commented 8 months ago

I'll just keep maintaining my custom fork that bypasses the whole customization system and reads exclusively form the file system. It's not that big a deal. In less than an hours work I have a working version so, it's nbd

But then you will have to spend much time to follow upstream. Using ./gitea embed, you can extract the right templates and just modify them(It assume the modified templates are less). Even if templates changed, the changes you need to modify is less.