partage: An HTTP based file sharing system
──────────────────────────────────────────────────────────────────────
In the past weeks, I had to share files with a company that didn't fit
in an email. We're reaching 2022, yet sharing big files anonymously
remains a pain in the ass…

So I started looking around for self-hosted solutions, and it turns out
there are quite a few [0] !
My need was a simple solution that runs on OpenBSD, and that I could
link to my family and friends so they can share stuff with me. It must
be fairly straightforward to use, with sane default and a low barrier
of entry.
I first settled on linx-server [1]. It works well without javascript,
is fairly simple to install and can interact with httpd(8) over fastcgi!

The only thing I missed was the ability to chroot and run with
restricted privileges, so I decided to hack those features in. I never
really wrote any Go before, but I quickly realized how rich the
standard library is! Reading and understanding the code felt familiar
coming from C. I quickly added the features I needed, and setup my
server.

I kept reading the code by curiosity, and that's when my NIH syndrom
triggered…

A few days later, partage [2] was born!

Partage is a simple HTTP server that accept uploads over PUT and POST
requests, and store files under randomized names. Each file is set to
expire after a defined amount of time, and an external tool
(partage-trash(1)) can be used to "collect" expired files (usually in a
cronjob).

A nice looking landing page is provided by default (with minimal CSS
and Javascript) for marketing purposes, but the server can totally work
without a front-end.

Overall, writing this software was very cool! I'm truly amazed at how
simple to use Go is, and how similar to C it feels. The standard
libraries are complete, and cross-compiling is a breeze. I'll
definitely consider it again for future projects!
--
~wgs

[0]: https://github.com/awesome-selfhosted/awesome-selfhosted
[1]: https://github.com/ZizzyDizzyMC/linx-server
[2]: gopher://z3bra.org/0/projects/partage.txt

20211021.1434