#102: possibility to set API key

This commit is contained in:
Claude 2013-11-10 13:10:40 +01:00
parent 5341c7901d
commit 9804cb15ee
2 changed files with 14 additions and 0 deletions

View File

@ -105,6 +105,15 @@ $config['backup_pass'] = '';
**/
$config['per_page'] = 15;
/**
* API key
*
* Require a key to interact with the API.
* Append to all API requests: ?apikey=[yourkey]
*
**/
$config['apikey'] = '';
/**
* Anti spam
*

View File

@ -25,6 +25,11 @@ class Api extends Main
{
die("The API has been disabled\n");
}
if (config_item('apikey') != $this->input->get('apikey'))
{
die("Invalid API key\n");
}
}
function index()