gossa icon indicating copy to clipboard operation
gossa copied to clipboard

[Pull request] Backend rewrite and many improvements

Open ViRb3 opened this issue 3 years ago • 2 comments

Hello! I love this project and I have been using it for a long time, but after looking at the code, I noticed multiple problems. I ended up rewriting the whole backend and I think it works much better now. My rewrite is fully backwards-compatible with your project.

You can find my rewrite here: https://github.com/ViRb3/gosses If you are interested, I would be happy to merge all my changes into this project.

Here are the major changes:

  • Echo is now used as the HTTP webserver, removing certain manual implementations.
  • zerolog is now used for logging, providing colorful, structured logs. Additionally, a -json flag has been added for pure JSON logs.
  • The frontend is now automatically embedded using Go 1.16's native implementation, removing the need for manual build steps.
  • All errors are now properly checked and handled instead of skipping them and hoping something would crash if there's a problem.
  • Path building is now accomplished using the standard path and filepath packages instead of manually appending strings. This ensures robust handling in all cases. Path traversal is also safeguarded by the standard packages.
  • ZIP files are now streamed directly to the client instead of building them in memory. This makes handling larger files much more effective.
  • ZIP file compression is disabled (Store), removing any performance impact.
  • Docker images are now multi-arch and support all major architectures instead of just amd64.
  • Dependabot is enabled for automatic dependency updates.
  • Automatic versioning is enabled through semantic-release.

Thanks!

ViRb3 avatar May 01 '21 22:05 ViRb3

Hey ! Thanks a lot for this :) Sorry for the slow reply, been busy these past few weeks, but I'll review that soon !

pldubouilh avatar May 12 '21 11:05 pldubouilh

hey - sorry for the slow turnout ! So I ended up pulling a lot of changes from your branch :+1:

  • zip changes (store & streaming)
  • errs handling & reformat
  • use native go embed
  • streamlined path building
  • cross platform dockerbuild

I didn't bring over the server & logging, to remain dependency-free. I'll think of maybe logging in Common Log Format at some point, so it's easy to mangle into another format through third party tool.

Also I managed to get reproducible builds ! (manage is a large statement for adding a single -trimpath to the build haha :) so I thought auto-release became less necessary - I cut a release or two a year, and it'd be trivial to compare the hashes to see that nothing nefarious happened from my end.

I co-authored you on the commits I pulled from your branch - feel free to keep me posted what you think of the changes, it's on PR #72. Thanks ! :)

pldubouilh avatar Nov 13 '21 12:11 pldubouilh