nx: detect with requested header

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/685/head
Varun Patil 2023-06-02 20:05:34 -07:00
parent fbee0063ea
commit 089c5298c4
1 changed files with 4 additions and 0 deletions

View File

@ -413,6 +413,10 @@ class Util
public static function callerIsNative(): bool public static function callerIsNative(): bool
{ {
// Should not use IRequest here since this method is called during registration // Should not use IRequest here since this method is called during registration
if (array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER)) {
return 'gallery.memories' === $_SERVER['HTTP_X_REQUESTED_WITH'];
}
return false !== strpos($_SERVER['HTTP_USER_AGENT'] ?? '', 'MemoriesNative'); return false !== strpos($_SERVER['HTTP_USER_AGENT'] ?? '', 'MemoriesNative');
} }