diff --git a/htdocs/application/config/stikked.php.default b/htdocs/application/config/stikked.php.default index 9f63304..e337282 100644 --- a/htdocs/application/config/stikked.php.default +++ b/htdocs/application/config/stikked.php.default @@ -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 * diff --git a/htdocs/application/controllers/api.php b/htdocs/application/controllers/api.php index 2e4af1a..bcc7ee4 100644 --- a/htdocs/application/controllers/api.php +++ b/htdocs/application/controllers/api.php @@ -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()