Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FeatureRequest] Custom /download/ in url #155

Open
thmmsn opened this issue May 5, 2023 · 2 comments
Open

[FeatureRequest] Custom /download/ in url #155

thmmsn opened this issue May 5, 2023 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@thmmsn
Copy link

thmmsn commented May 5, 2023

Our Send installation is on domain https://send.a-very-very-long-domain-name.com/

Send url is https://send.a-very-very-long-domain-name.com/download/<some-long-code>/<long-code-again>

Request:

  • Change default /download/ to something else
  • Shorter url's

Example
https://send.a-very-very-long-domain-name.com/geE4xui

@thmmsn thmmsn changed the title [FeatureRequst] Change /download/ [FeatureRequst] Custom /download/ in url May 6, 2023
@timvisee
Copy link
Owner

timvisee commented May 6, 2023

/download/ can be shortened to /d/. Sadly I don't have time at this moment to implement this. Someone else may give it a shot in a PR in the meantime.

The basic tasks would probably be:

  • Add a configuration option to use short download URLs
  • If short download URLs are enabled, show /d/ URLs in the client after uploading.
  • Redirect /d/ to /download/, or use the same route for it.

Note that the only thing that can be shortened is the /download/ part. The ID and secret included after it cannot be shortened due to security reasons; most notably the private key after the #.

@timvisee timvisee added enhancement New feature or request help wanted Extra attention is needed labels May 6, 2023
@thmmsn thmmsn changed the title [FeatureRequst] Custom /download/ in url [FeatureRequest] Custom /download/ in url Jun 2, 2023
@thmmsn
Copy link
Author

thmmsn commented Jun 2, 2023

Instead of changing URL I made some changes to copyDialog.js and utils.js to copy formated text.

copyDialog.js

    function copy(event) {
      event.stopPropagation();
      copyToClipboard(url,name);
      event.target.textContent = state.translate('copiedUrl');
      setTimeout(close, 1000);
    }

utils.js

function copyToClipboard(str_url,str_name) {
 navigator.clipboard.write([
   new ClipboardItem({
     'text/plain': new Blob([str_url], { type: 'text/plain' }),
     'text/html': new Blob(['<a href="' + str_url + '"">' + str_name + '</a>'], { type: 'text/html' })
   })
 ])
}

The custom text/html could be one of the environment variables in the docker-compose.yml file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants