summaryrefslogtreecommitdiff
path: root/classes/api.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-05-18 16:54:33 +0300
committerAndrew Dolgov <[email protected]>2021-05-18 16:54:33 +0300
commit2adf364c2c46cb8da446ae1a310599e31c53926a (patch)
treed3411f16ccf85d0cf35634b9e342cf6e8997a501 /classes/api.php
parent9f6237a1b8ecbd6aea7c9de14ffef91e0b2ba463 (diff)
provide base configuration object in login response to skip on initial getConfig
Diffstat (limited to 'classes/api.php')
-rwxr-xr-xclasses/api.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/classes/api.php b/classes/api.php
index 88e964b7c..18743d56d 100755
--- a/classes/api.php
+++ b/classes/api.php
@@ -74,7 +74,12 @@ class API extends Handler {
if ($uid = UserHelper::find_user_by_login($login)) {
if (get_pref(Prefs::ENABLE_API_ACCESS, $uid)) {
if (UserHelper::authenticate($login, $password, false, Auth_Base::AUTH_SERVICE_API)) {
+
+ // needed for _get_config()
+ UserHelper::load_user_plugins($_SESSION['uid']);
+
$this->_wrap(self::STATUS_OK, array("session_id" => session_id(),
+ "config" => $this->_get_config(),
"api_level" => self::API_LEVEL));
} else {
$this->_wrap(self::STATUS_ERR, array("error" => self::E_LOGIN_ERROR));
@@ -370,7 +375,7 @@ class API extends Handler {
}
}
- function getConfig() {
+ private function _get_config() {
$config = [
"icons_dir" => Config::get(Config::ICONS_DIR),
"icons_url" => Config::get(Config::ICONS_URL)
@@ -383,6 +388,12 @@ class API extends Handler {
->where('owner_uid', $_SESSION['uid'])
->count();
+ return $config;
+ }
+
+ function getConfig() {
+ $config = $this->_get_config();
+
$this->_wrap(self::STATUS_OK, $config);
}