szabodanika / microbin

A secure, configurable file-sharing and URL shortening web app written in Rust.
https://microbin.eu
BSD 3-Clause "New" or "Revised" License
2.65k stars 163 forks source link

[Feature Request] Auth mode that is readonly unless signed in #106

Closed wychwitch closed 1 year ago

wychwitch commented 1 year ago

Hello! I love this program, but I was curious if I could configure it to be readonly if you're not logged in ? (using the --auth to set the credentials)

So logging in is optional for viewing pastas, but if you want to create any you need to auth with the username and/or password set with --auth?

I can't seem to find an option for this, since setting --auth makes accessing it at all password-protected, and w/o auth anyone can make new pastas which I would love to restrict

Thanks for making such a great app!! it's 3am so I may have just completely missed this configuration hahaha

edit: renamed so it's clear that this is now a formal request!

thehijacker commented 1 year ago

Another vote for this. I wish to use this as selfhosted pastebin and to share pastas with my friends, but I do not want them to make their own pastas. If I set credentials they are needed also for viewing pastas. But without credentials they should download file, read pastas and nothing else.

Can this be added?

ghost commented 1 year ago

Another vote for this. Would love for this feature to get implemented.

jl-678 commented 1 year ago

+1 for this. I am looking at the same use case as the other posters. (e.g. private Pastebin used to share info publicly.) Microbin is perfect for this, but it needs this feature to effectively fill this role. Thank you!

Ember-ruby commented 1 year ago

as a temporary measure you can put /create, /edit, and /remove behind basic http auth, if you use caddy it has pretty good documentation on doing so, or just use this in your caddyfile;

@somename {
    path /edit/*
    path /pastalist
    path /remove/*
    path /upload
}

basicauth @somename {
    <username and hash, refer to https://caddyserver.com/docs/caddyfile/directives/basicauth#basicauth>
}

you can see this working at bin.blobfox.coffee

pcgeek86 commented 1 year ago

+1 I'd love to self-host this, but not without some kind of auth mechanism.