Download Url Token Question

JoeGamers

Member
YetiShare User
Feb 16, 2019
37
1
8
35

Attachments

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
Ignore my last post, I see this is in presales.

These token links only last for 24 hours, so they won't work after then.

In addition, there's also an option in the code to limit them by IP if you'd prefer. The only restriction is that the document viewer plugin doesn't yet work in the IP restricted mode. (as it uses Google to view the documents and the IP from Google changes)

Thanks,
Adam.
 

JoeGamers

Member
YetiShare User
Feb 16, 2019
37
1
8
35
¿Significa que puedo asignar un token para cada IP y evitar así el problema de la pérdida de enlaces y recursos?
¿Puedo cambiar la cantidad de horas de caducidad de cada grifo?
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
It's in the code, you need to uncomment a line in the code to enable it.
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
Have a look in:
Code:
/core/includes/file.class.php
Search for:
Code:
// check token
You'll see:
PHP:
// $tokenData = $db->getRow('SELECT id, user_id, ip_address, file_id, download_speed, max_threads, file_transfer FROM download_token WHERE file_id = ' . $db->escape($this->id) . ' AND ip_address=' . $db->quote(coreFunctions::getUsersIPAddress()) . ' AND token = ' . $db->quote($downloadToken) . ' LIMIT 1');
$tokenData = $db->getRow('SELECT id, user_id, ip_address, file_id, download_speed, max_threads, file_transfer FROM download_token WHERE file_id = ' . $db->escape($this->id) . ' AND  token = ' . $db->quote($downloadToken) . ' LIMIT 1');
Uncomment the first line and comment out (or remove) the second. This will restrict the download by IP address.

Thanks,
Adam.
 

yametesenpai

Member
YetiShare User
Oct 26, 2020
56
7
8
Have a look in:
Code:
/core/includes/file.class.php
Search for:
Code:
// check token
You'll see:
PHP:
// $tokenData = $db->getRow('SELECT id, user_id, ip_address, file_id, download_speed, max_threads, file_transfer FROM download_token WHERE file_id = ' . $db->escape($this->id) . ' AND ip_address=' . $db->quote(coreFunctions::getUsersIPAddress()) . ' AND token = ' . $db->quote($downloadToken) . ' LIMIT 1');
$tokenData = $db->getRow('SELECT id, user_id, ip_address, file_id, download_speed, max_threads, file_transfer FROM download_token WHERE file_id = ' . $db->escape($this->id) . ' AND  token = ' . $db->quote($downloadToken) . ' LIMIT 1');
Uncomment the first line and comment out (or remove) the second. This will restrict the download by IP address.

Thanks,
Adam.
how can i store the ip for 5 minutes? 1 day storation is too long. users might cheat
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
You can't without changing the code. If a download manager requests another chunk after 5 minutes, it'll break it.