29 lines
No EOL
896 B
PHP
29 lines
No EOL
896 B
PHP
<?php
|
|
// AllDebrid API Configuration
|
|
if (!defined('ALLDEBRID_API_KEY')) {
|
|
define('ALLDEBRID_API_KEY', 'INSERT_ALLDEBRID_API_KEY_HERE');
|
|
}
|
|
if (!defined('ALLDEBRID_API_URL')) {
|
|
define('ALLDEBRID_API_URL', 'https://api.alldebrid.com/v4/');
|
|
}
|
|
|
|
// Rate limiting configuration
|
|
if (!defined('REQUESTS_PER_SECOND_LIMIT')) {
|
|
define('REQUESTS_PER_SECOND_LIMIT', 10); // 10 requests per second
|
|
}
|
|
if (!defined('REQUESTS_PER_MINUTE_LIMIT')) {
|
|
define('REQUESTS_PER_MINUTE_LIMIT', 500); // 500 requests per minute
|
|
}
|
|
|
|
// Start session if not already started
|
|
if (session_status() === PHP_SESSION_NONE) {
|
|
session_start();
|
|
}
|
|
|
|
// Initialize rate-limiting counters if they don't exist
|
|
if (!isset($_SESSION['request_count_second'])) {
|
|
$_SESSION['request_count_second'] = 0;
|
|
$_SESSION['request_count_minute'] = 0;
|
|
$_SESSION['last_request_time'] = time();
|
|
}
|
|
?>
|