psi-4ward / psitransfer

Simple open source self-hosted file sharing solution.
BSD 2-Clause "Simplified" License
1.45k stars 211 forks source link

Question - Make auto generated share URLs shorter? #280

Open jamess60 opened 1 year ago

jamess60 commented 1 year ago

Hi all

My instance has very low volumes of traffic/users, but I quite often use it to move files in/out of vms and remote sessions that I cant always copy paste into.

Is there a way to make the auto generated urls shorter for convenience? Even 2 characters would suffice for my needs

Maytrok commented 11 months ago

hey james,

you may use an bucked id ( ?sid=ab)

I think the code that generate the random id is

function getSid() { // support setting an explicit SID by location search param const match = document.location.search.match(/sid=([^&]+)/); if (match) { return match[1]; } else { return md5(uuid()).toString().substr(0, 12); } }

As you can see it`s a hardcoded length.

jamess60 commented 11 months ago

Hi @Maytrok - Thanks for sharing! I see you linked pull #283 - does this mean there is now an ENV for this?

jamess60 commented 10 months ago

I see this was added to the readme! Closing issue :) PSITRANSFER_RANDOM_DOWNLOAD_SID_LENGTH

jamess60 commented 2 months ago

@Maytrok

Reopening as I only just found the time to test...

Looks like the #283 merge has conflicts - did it ever go ahead? I cant see a reference to sid length in the config.js and adding this env to docker compose does nothing

jamess60 commented 2 weeks ago

Bump - any news on this?

Maytrok commented 3 days ago

@jamess60 the repo owner seems to not care about my PRs and merge other prs that create a merge conflict with mine. i`ve resolve the conflict now, but i don't have small hopes that the pr will be merged. If you really want that feature, you should be able to clone my forked repo and switch to the 'env-to-shorten-download-url' branch. Note: Ive not tested the docker version