stonith404 / pingvin-share

A self-hosted file sharing platform that combines lightness and beauty, perfect for seamless and efficient file sharing.
https://stonith404.github.io/pingvin-share/
BSD 2-Clause "Simplified" License
3.19k stars 229 forks source link

πŸš€ Feature: Truncate Long Share Links #479

Open fmunim opened 4 months ago

fmunim commented 4 months ago

πŸ”– Feature description

Truncate the shares for Directly sharing and the share page to a shorter url

🎀 Pitch

Currently the direct share link and regular share link:

Direct Share: https://domain/api/shares/Q5MTUyN/files/4ecb4db0-2993-481a-84ab-5932d99a8151?download=false Regular Share: https://domain/s/Q5MTUyN

Is too long!

It should be just:

Direct Share: https://domin/D-XXRandomStringXX Regular Share: https://domain/XXRandomStringXX

fmunim commented 3 months ago

@stonith404 Any update on this or any comments?

stonith404 commented 3 months ago

Yeah file links are definitely too long. Nevertheless this isn't really something that I want to prioritize as it's not really intended to share file links directly. Additionally, implementing this this would require significant effort as it would involve revising the database structure. As a workaround, you could use a self-hosted URL shortener like Shlink.

But I'm open if someone wants to contribute to this feature :)

Regarding share links, what would you suggest to make it shorter? The /s/ can't really be omitted as the share id could then collide with website paths. For example, if you create a share with the id upload, it won't be accessible as http://domain/upload is already a page. Or do you have another suggestion?

fmunim commented 3 months ago

Yeah file links are definitely too long. Nevertheless this isn't really something that I want to prioritize as it's not really intended to share file links directly. Additionally, implementing this this would require significant effort as it would involve revising the database structure. As a workaround, you could use a self-hosted URL shortener like Shlink.

But I'm open if someone wants to contribute to this feature :)

Regarding share links, what would you suggest to make it shorter? The /s/ can't really be omitted as the share id could then collide with website paths. For example, if you create a share with the id upload, it won't be accessible as http://domain/upload is already a page. Or do you have another suggestion?

Funnily I already use Shlink because the direct URL is too long >.<, but I understand.

For short share links---isn't share ids just random characters? maybe you can enforce that to deter collision?

stonith404 commented 3 months ago

For short share links---isn't share ids just random characters? maybe you can enforce that to deter collision?

No, the share ID can be set manually to create a link that is, for example, easy to remember.

fmunim commented 3 months ago

For short share links---isn't share ids just random characters? maybe you can enforce that to deter collision?

No, the share ID can be set manually to create a link that is, for example, easy to remember.

Maybe you can just blacklist certain words?

stonith404 commented 3 months ago

Yeah that would be a possible solution but in my opinion this change doesn't make sense to implement as it would add unnecessary complexity just for omitting 3 characters from the URL. The benefits of shortening the links are minimal compared to the potential issues it could introduce.

E.g some users have firewalls in front of Pingvin Share that only allow requests to domain.com/s/* paths. Changing this would complicate their firewall setup since they’d have to manually update it every time a new page is added, which is extra work for them.

fmunim commented 3 months ago

Yeah that would be a possible solution but in my opinion this change doesn't make sense to implement as it would add unnecessary complexity just for omitting 3 characters from the URL. The benefits of shortening the links are minimal compared to the potential issues it could introduce.

E.g some users have firewalls in front of Pingvin Share that only allow requests to domain.com/s/* paths. Changing this would complicate their firewall setup since they’d have to manually update it every time a new page is added, which is extra work for them.

I see, so I guess only feasible change here would be the longer url to a shorter one...but its complicated. I will see If I can do a pull request...would have to look at the code. But thank you for your time!