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

Url Shortener POST Request #1284

Open
stefanman125 opened this issue Apr 14, 2024 · 2 comments
Open

Url Shortener POST Request #1284

stefanman125 opened this issue Apr 14, 2024 · 2 comments
Assignees

Comments

@stefanman125
Copy link

The problem

The URL Shortening functionality only seems to work for URL shorteners that take the long URL and API key through a GET request.

I am using self hosting shlink, but its GET request functionality seems to be deprecated.

The solution

Can an option for using a link shortener that takes a POST request be added?

Alternatives

An alternative could be a field in the config that simply displays the shortened URL as the output of a script that runs on the host when a shortened URL is requested. Such a script can simply run a curl command and specify POST request body parameters, then regex the result.

@elrido
Copy link
Contributor

elrido commented Apr 15, 2024

Sure, go ahead and raise a pull request with your suggested change. I assume you would like to make it a configuration option? It will require some creativity to communicate the configuration option from the backend to the frontend code, maybe in a similar way like the compression setting is passed down into the template for the client side application to pick it up?

$page->assign('COMPRESSION', $this->_conf->getKey('compression'));

<body role="document" data-compression="<?php echo rawurlencode($COMPRESSION); ?>"<?php

if ($('body').data('compression') !== 'none') {

@rugk
Copy link
Member

rugk commented May 5, 2024

Alternatively or in addition one could make a server-side proxy for proxying the request the existing ones: https://github.com/PrivateBin/PrivateBin/blob/da8b6a2c672fa39a7d5ef715108200c974cea34c/lib/YourlsProxy.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants