mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Changes for mobile app
This commit is contained in:
parent
ced119a52e
commit
dd83391bea
@ -431,7 +431,7 @@ if (! defined('APP_NAME')) {
|
|||||||
define('TEST_PASSWORD', 'password');
|
define('TEST_PASSWORD', 'password');
|
||||||
define('API_SECRET', 'API_SECRET');
|
define('API_SECRET', 'API_SECRET');
|
||||||
define('DEFAULT_API_PAGE_SIZE', 15);
|
define('DEFAULT_API_PAGE_SIZE', 15);
|
||||||
define('MAX_API_PAGE_SIZE', 500);
|
define('MAX_API_PAGE_SIZE', 10000);
|
||||||
|
|
||||||
define('IOS_DEVICE', env('IOS_DEVICE', ''));
|
define('IOS_DEVICE', env('IOS_DEVICE', ''));
|
||||||
define('ANDROID_DEVICE', env('ANDROID_DEVICE', ''));
|
define('ANDROID_DEVICE', env('ANDROID_DEVICE', ''));
|
||||||
|
@ -95,6 +95,14 @@ class AccountApiController extends BaseAPIController
|
|||||||
$transformer = new UserAccountTransformer($user->account, $request->serializer, $request->token_name);
|
$transformer = new UserAccountTransformer($user->account, $request->serializer, $request->token_name);
|
||||||
$data = $this->createCollection($users, $transformer, 'user_account');
|
$data = $this->createCollection($users, $transformer, 'user_account');
|
||||||
|
|
||||||
|
if (request()->include_static) {
|
||||||
|
$data = [
|
||||||
|
'accounts' => $data,
|
||||||
|
'static' => Utils::getStaticData(),
|
||||||
|
'version' => NINJA_VERSION,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
return $this->response($data);
|
return $this->response($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,14 +120,7 @@ class AccountApiController extends BaseAPIController
|
|||||||
|
|
||||||
public function getStaticData()
|
public function getStaticData()
|
||||||
{
|
{
|
||||||
$data = [];
|
return $this->response(Utils::getStaticData());
|
||||||
|
|
||||||
$cachedTables = unserialize(CACHED_TABLES);
|
|
||||||
foreach ($cachedTables as $name => $class) {
|
|
||||||
$data[$name] = Cache::get($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->response($data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserAccounts(Request $request)
|
public function getUserAccounts(Request $request)
|
||||||
|
@ -37,6 +37,8 @@ class ApiCheck
|
|||||||
if ($secret = env(API_SECRET)) {
|
if ($secret = env(API_SECRET)) {
|
||||||
$requestSecret = Request::header('X-Ninja-Secret') ?: ($request->api_secret ?: '');
|
$requestSecret = Request::header('X-Ninja-Secret') ?: ($request->api_secret ?: '');
|
||||||
$hasApiSecret = hash_equals($requestSecret, $secret);
|
$hasApiSecret = hash_equals($requestSecret, $secret);
|
||||||
|
} elseif (Utils::isSelfHost()) {
|
||||||
|
$hasApiSecret = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($loggingIn) {
|
if ($loggingIn) {
|
||||||
|
@ -501,6 +501,18 @@ class Utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getStaticData()
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
$cachedTables = unserialize(CACHED_TABLES);
|
||||||
|
foreach ($cachedTables as $name => $class) {
|
||||||
|
$data[$name] = Cache::get($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getFromCache($id, $type)
|
public static function getFromCache($id, $type)
|
||||||
{
|
{
|
||||||
$cache = Cache::get($type);
|
$cache = Cache::get($type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user