• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

Yourls Url shortener not working

Status
Not open for further replies.

subojac

Chevereto Member
Hey,

So I've installed the script here img.mykak.us and I've got my YOURLS shortener at mykak.us
Anyhow, I've filled in the YOURLS shorteners details in the config and when I upload a image a short url is created and I can see it in the YOURLS admin panel, but the short url field is blank.

Any suggestions on how I get this to show, bit of a noob. My API is publicly accessible, but I've tried it with the secret key, username and password and without. Every time a url is created on mykak.us, but it never shows in chevereto.

Here's my current config:

Code:
$config['short_url'] = true; // Values: true|false

*Edit*
Just noticed I posted in the wrong section, please excuse
$config['short_url_service'] = 'custom'; // Values: tinyurl | google | isgd | bitly | custom

$config['custom_short_url_api'] = 'http://mykak.us/yourls-api.php?format=simple&action=shorturl&url='; // Example: http://yoursite.com/yourls-api.php?format=simple&action=shorturl&username=<USERNAME>&password=<PASSWORD>&url=

$config['custom_short_url_service'] = 'MyKAK.us';
 
Something weird is happening... Some times a direct API request is just blank... Maybe you have a issue with the memory on your server.

Chevereto returns just what the api returns, I will check it deeper on the night. Try to whitelist the chevereto.com domain and not touch a lot the settings of yourls.
 
I've checked the server and it's returning the requests fine if I manually add a url and use the api. I've also used the api from another Yourls site that's configured almost exactly like mine http://api.mrte.ch/ and it also doesn't work.
 
Rodolfo said:
Something weird is happening... Some times a direct API request is just blank... Maybe you have a issue with the memory on your server.

Chevereto returns just what the api returns, I will check it deeper on the night. Try to whitelist the chevereto.com domain and not touch a lot the settings of yourls.

Okay, so, I've figured out what the problem is, the api isn't fast enough for chevereto and the short url just isn't there because it was to slow. I've created a temporary fix using php sleep in shorturl.php to make the script sleep for 20sec so the short url is ready. This is oly temporary and makes things take very long, what can I add to the script so it just waits for the url and then continues instead of waiting for a preset amount of time like it does with my fix. Not that great with php so I'm going to need some help coming up with a permanent solution.

Here's my temporary fix in shorturl.php

Code:
if(chevereto_config('short_url_service')=='custom' and check_value(chevereto_config('custom_short_url_api'))) {
    $ShortURL->custom_service_api = chevereto_config('custom_short_url_api');
    sleep(20);
 
That can be improved on the curl request of the shorturl class, try to tune up the timeout I think that I can add +30s more on that function ;)
 
Rodolfo said:
That can be improved on the curl request of the shorturl class, try to tune up the timeout I think that I can add +30s more on that function ;)

Sorry not exactly sure what you want me to do? Where do I add the 30s?
 
includes/classes/class.shorturl.php

Find:
PHP:
curl_setopt($ch, CURLOPT_TIMEOUT, 120);

Change 120 for the secs that you need.
 
Status
Not open for further replies.
Back
Top