mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Merge remote-tracking branch 'origin/main' into feat/vcs-factory
# Conflicts: # composer.lock
This commit is contained in:
commit
da0690460f
9 files changed
+41
-152
No files matched your search
@@ -39,8 +39,6 @@ use Appwrite\Utopia\Database\Validator\CustomId;
|
||||
use Appwrite\Utopia\Database\Validator\Queries\Identities;
|
||||
use Appwrite\Utopia\Request;
|
||||
use Appwrite\Utopia\Response;
|
||||
use libphonenumber\NumberParseException;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use Utopia\Auth\Hashes\Sha;
|
||||
use Utopia\Auth\Proofs\Code as ProofsCode;
|
||||
use Utopia\Auth\Proofs\Password as ProofsPassword;
|
||||
@@ -65,6 +63,7 @@ use Utopia\Emails\Email;
|
||||
use Utopia\Emails\Validator\Email as EmailValidator;
|
||||
use Utopia\Http\Http;
|
||||
use Utopia\Locale\Locale;
|
||||
use Utopia\Messaging\Adapter\SMS\GEOSMS\CallingCode;
|
||||
use Utopia\Platform\Enum;
|
||||
use Utopia\Storage\Validator\FileName;
|
||||
use Utopia\System\System;
|
||||
@@ -3169,15 +3168,9 @@ Http::post('/v1/account/tokens/phone')
|
||||
providerType: MESSAGE_TYPE_SMS,
|
||||
));
|
||||
|
||||
$helper = PhoneNumberUtil::getInstance();
|
||||
try {
|
||||
$countryCode = $helper->parse($phone)->getCountryCode();
|
||||
|
||||
if (!empty($countryCode)) {
|
||||
$usage->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1);
|
||||
}
|
||||
} catch (NumberParseException $e) {
|
||||
// Ignore invalid phone number for country code stats
|
||||
$countryCode = CallingCode::fromPhoneNumber($phone);
|
||||
if (!empty($countryCode)) {
|
||||
$usage->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1);
|
||||
}
|
||||
$usage->addMetric(METRIC_AUTH_METHOD_PHONE, 1);
|
||||
}
|
||||
@@ -4516,15 +4509,9 @@ Http::post('/v1/account/verifications/phone')
|
||||
providerType: MESSAGE_TYPE_SMS,
|
||||
));
|
||||
|
||||
$helper = PhoneNumberUtil::getInstance();
|
||||
try {
|
||||
$countryCode = $helper->parse($phone)->getCountryCode();
|
||||
|
||||
if (!empty($countryCode)) {
|
||||
$usage->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1);
|
||||
}
|
||||
} catch (NumberParseException $e) {
|
||||
// Ignore invalid phone number for country code stats
|
||||
$countryCode = CallingCode::fromPhoneNumber($phone);
|
||||
if (!empty($countryCode)) {
|
||||
$usage->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1);
|
||||
}
|
||||
$usage->addMetric(METRIC_AUTH_METHOD_PHONE, 1);
|
||||
}
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@
|
||||
"utopia-php/locale": "0.8.*",
|
||||
"utopia-php/lock": "0.2.*",
|
||||
"utopia-php/logger": "0.8.*",
|
||||
"utopia-php/messaging": "^1.3",
|
||||
"utopia-php/messaging": "^2.0",
|
||||
"utopia-php/migration": "1.17.*",
|
||||
"utopia-php/platform": "^1.0@RC",
|
||||
"utopia-php/pools": "1.*",
|
||||
|
||||
Generated
+17
-91
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "7c47a07b7c261e80a7e12374619f5237",
|
||||
"content-hash": "71622f20d2344f54090357f8275af661",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/jwt",
|
||||
@@ -605,84 +605,6 @@
|
||||
},
|
||||
"time": "2025-08-12T10:13:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "giggsey/libphonenumber-for-php-lite",
|
||||
"version": "9.0.23",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/giggsey/libphonenumber-for-php-lite.git",
|
||||
"reference": "e8f6f896c1bef398136849934a934904bd9bf072"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/giggsey/libphonenumber-for-php-lite/zipball/e8f6f896c1bef398136849934a934904bd9bf072",
|
||||
"reference": "e8f6f896c1bef398136849934a934904bd9bf072",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"symfony/polyfill-mbstring": "^1.17"
|
||||
},
|
||||
"conflict": {
|
||||
"giggsey/libphonenumber-for-php": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-dom": "*",
|
||||
"friendsofphp/php-cs-fixer": "^3.71",
|
||||
"infection/infection": "^0.29|^0.31.0",
|
||||
"nette/php-generator": "^4.1",
|
||||
"php-coveralls/php-coveralls": "^2.7",
|
||||
"phpstan/extension-installer": "^1.4.3",
|
||||
"phpstan/phpstan": "^2.1.7",
|
||||
"phpstan/phpstan-deprecation-rules": "^2.0.1",
|
||||
"phpstan/phpstan-phpunit": "^2.0.4",
|
||||
"phpstan/phpstan-strict-rules": "^2.0.3",
|
||||
"phpunit/phpunit": "^10.5.45",
|
||||
"symfony/console": "^6.4",
|
||||
"symfony/filesystem": "^6.4",
|
||||
"symfony/process": "^6.4"
|
||||
},
|
||||
"suggest": {
|
||||
"giggsey/libphonenumber-for-php": "Use libphonenumber-for-php for geocoding, carriers, timezones and matching"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "9.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"libphonenumber\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Joshua Gigg",
|
||||
"email": "giggsey@gmail.com",
|
||||
"homepage": "https://giggsey.com/"
|
||||
}
|
||||
],
|
||||
"description": "A lite version of giggsey/libphonenumber-for-php, which is a PHP Port of Google's libphonenumber",
|
||||
"homepage": "https://github.com/giggsey/libphonenumber-for-php-lite",
|
||||
"keywords": [
|
||||
"geocoding",
|
||||
"geolocation",
|
||||
"libphonenumber",
|
||||
"mobile",
|
||||
"phonenumber",
|
||||
"validation"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/giggsey/libphonenumber-for-php-lite/issues",
|
||||
"source": "https://github.com/giggsey/libphonenumber-for-php-lite"
|
||||
},
|
||||
"time": "2026-01-30T12:33:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "google/protobuf",
|
||||
"version": "v4.33.6",
|
||||
@@ -4459,30 +4381,34 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/messaging",
|
||||
"version": "1.3.0",
|
||||
"version": "2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/messaging.git",
|
||||
"reference": "63a27be589fd998ad8489d66e570640c7cce9425"
|
||||
"reference": "8890c3b2e94bdf832c17fd3d7832cdf01b933eb7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/messaging/zipball/63a27be589fd998ad8489d66e570640c7cce9425",
|
||||
"reference": "63a27be589fd998ad8489d66e570640c7cce9425",
|
||||
"url": "https://api.github.com/repos/utopia-php/messaging/zipball/8890c3b2e94bdf832c17fd3d7832cdf01b933eb7",
|
||||
"reference": "8890c3b2e94bdf832c17fd3d7832cdf01b933eb7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"ext-openssl": "*",
|
||||
"giggsey/libphonenumber-for-php-lite": "9.0.23",
|
||||
"php": ">=8.1.0",
|
||||
"phpmailer/phpmailer": "6.9.1",
|
||||
"ext-swoole": "*",
|
||||
"php": ">=8.5.0",
|
||||
"phpmailer/phpmailer": "^6.9",
|
||||
"psr/http-client": "^1.0",
|
||||
"psr/http-message": "^1.1 || ^2.0",
|
||||
"utopia-php/client": "^0.2",
|
||||
"utopia-php/telemetry": "^0.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/pint": "1.*",
|
||||
"phpstan/phpstan": "1.*",
|
||||
"phpunit/phpunit": "11.*"
|
||||
"laravel/pint": "^1.0",
|
||||
"phpstan/phpstan": "^2.0",
|
||||
"phpunit/phpunit": "^11.0",
|
||||
"swoole/ide-helper": "^6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@@ -4505,9 +4431,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/messaging/issues",
|
||||
"source": "https://github.com/utopia-php/messaging/tree/1.3.0"
|
||||
"source": "https://github.com/utopia-php/messaging/tree/2.0.0"
|
||||
},
|
||||
"time": "2026-07-14T07:21:08+00:00"
|
||||
"time": "2026-07-14T10:22:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/migration",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"preset": "psr12",
|
||||
"exclude": [
|
||||
"./app/sdks",
|
||||
"./tests/resources/functions",
|
||||
"./app/console"
|
||||
"app/sdks",
|
||||
"tests/resources/functions",
|
||||
"app/console"
|
||||
],
|
||||
"rules": {
|
||||
"array_indentation": true,
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
namespace Appwrite\Auth\Validator;
|
||||
|
||||
use libphonenumber\NumberParseException;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use Utopia\Messaging\Adapter\SMS\GEOSMS\CallingCode;
|
||||
use Utopia\Validator;
|
||||
|
||||
/**
|
||||
@@ -14,12 +13,10 @@ use Utopia\Validator;
|
||||
class Phone extends Validator
|
||||
{
|
||||
protected bool $allowEmpty;
|
||||
protected PhoneNumberUtil $helper;
|
||||
|
||||
public function __construct(bool $allowEmpty = false)
|
||||
{
|
||||
$this->allowEmpty = $allowEmpty;
|
||||
$this->helper = PhoneNumberUtil::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,9 +48,7 @@ class Phone extends Validator
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->helper->parse($value);
|
||||
} catch (NumberParseException $e) {
|
||||
if (CallingCode::fromPhoneNumber($value) === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@ use Appwrite\Template\Template;
|
||||
use Appwrite\Usage\Context;
|
||||
use Appwrite\Utopia\Request;
|
||||
use Appwrite\Utopia\Response;
|
||||
use libphonenumber\NumberParseException;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use Utopia\Auth\Proofs\Code as ProofsCode;
|
||||
use Utopia\Auth\Proofs\Token as ProofsToken;
|
||||
use Utopia\Database\Database;
|
||||
@@ -30,6 +28,7 @@ use Utopia\Database\Document;
|
||||
use Utopia\Database\Helpers\Permission;
|
||||
use Utopia\Database\Helpers\Role;
|
||||
use Utopia\Locale\Locale;
|
||||
use Utopia\Messaging\Adapter\SMS\GEOSMS\CallingCode;
|
||||
use Utopia\Platform\Enum;
|
||||
use Utopia\Platform\Scope\HTTP;
|
||||
use Utopia\Storage\Validator\FileName;
|
||||
@@ -196,15 +195,9 @@ class Create extends Action
|
||||
providerType: MESSAGE_TYPE_SMS,
|
||||
));
|
||||
|
||||
$helper = PhoneNumberUtil::getInstance();
|
||||
try {
|
||||
$countryCode = $helper->parse($phone)->getCountryCode();
|
||||
|
||||
if (!empty($countryCode)) {
|
||||
$usage->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1);
|
||||
}
|
||||
} catch (NumberParseException $e) {
|
||||
// Ignore invalid phone number for country code stats
|
||||
$countryCode = CallingCode::fromPhoneNumber($phone);
|
||||
if (!empty($countryCode)) {
|
||||
$usage->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1);
|
||||
}
|
||||
$usage->addMetric(METRIC_AUTH_METHOD_PHONE, 1);
|
||||
break;
|
||||
|
||||
@@ -17,8 +17,6 @@ use Appwrite\Template\Template;
|
||||
use Appwrite\Usage\Context;
|
||||
use Appwrite\Utopia\Database\Documents\User;
|
||||
use Appwrite\Utopia\Response;
|
||||
use libphonenumber\NumberParseException;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use Utopia\Auth\Proofs\Password;
|
||||
use Utopia\Auth\Proofs\Token;
|
||||
use Utopia\Database\Database;
|
||||
@@ -35,6 +33,7 @@ use Utopia\Database\Validator\UID;
|
||||
use Utopia\Emails\Email;
|
||||
use Utopia\Emails\Validator\Email as EmailValidator;
|
||||
use Utopia\Locale\Locale;
|
||||
use Utopia\Messaging\Adapter\SMS\GEOSMS\CallingCode;
|
||||
use Utopia\Platform\Scope\HTTP;
|
||||
use Utopia\System\System;
|
||||
use Utopia\Validator\ArrayList;
|
||||
@@ -450,15 +449,9 @@ class Create extends Action
|
||||
providerType: 'SMS',
|
||||
));
|
||||
|
||||
$helper = PhoneNumberUtil::getInstance();
|
||||
try {
|
||||
$countryCode = $helper->parse($phone)->getCountryCode();
|
||||
|
||||
if (! empty($countryCode)) {
|
||||
$usage->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1);
|
||||
}
|
||||
} catch (NumberParseException $e) {
|
||||
// Ignore invalid phone number for country code stats
|
||||
$countryCode = CallingCode::fromPhoneNumber($phone);
|
||||
if (! empty($countryCode)) {
|
||||
$usage->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1);
|
||||
}
|
||||
$usage->addMetric(METRIC_AUTH_METHOD_PHONE, 1);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ use Appwrite\Event\Message\Usage;
|
||||
use Appwrite\Event\Publisher\Usage as UsagePublisher;
|
||||
use Appwrite\Messaging\Status as MessageStatus;
|
||||
use Appwrite\Usage\Context as UsageContext;
|
||||
use libphonenumber\NumberParseException;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use Swoole\Runtime;
|
||||
use Utopia\Config\Config;
|
||||
use Utopia\Database\Database;
|
||||
@@ -30,6 +28,7 @@ use Utopia\Messaging\Adapter\Push\FCM;
|
||||
use Utopia\Messaging\Adapter\SMS as SMSAdapter;
|
||||
use Utopia\Messaging\Adapter\SMS\Fast2SMS;
|
||||
use Utopia\Messaging\Adapter\SMS\GEOSMS;
|
||||
use Utopia\Messaging\Adapter\SMS\GEOSMS\CallingCode;
|
||||
use Utopia\Messaging\Adapter\SMS\Inforu;
|
||||
use Utopia\Messaging\Adapter\SMS\Mock;
|
||||
use Utopia\Messaging\Adapter\SMS\Msg91;
|
||||
@@ -811,12 +810,7 @@ class Messaging extends Action
|
||||
$from = System::getEnv('_APP_SMS_FROM', '');
|
||||
Span::add('message.from', $from);
|
||||
|
||||
try {
|
||||
$phoneNumber = PhoneNumberUtil::getInstance()->parse($recipients[0] ?? '');
|
||||
Span::add('message.country_code', $phoneNumber->getCountryCode());
|
||||
} catch (NumberParseException $e) {
|
||||
Span::add('message.country_code', 'unknown');
|
||||
}
|
||||
Span::add('message.country_code', CallingCode::fromPhoneNumber($recipients[0] ?? '') ?? 'unknown');
|
||||
|
||||
$sms = new SMS(
|
||||
$recipients,
|
||||
|
||||
@@ -21,6 +21,7 @@ class Console extends Adapter
|
||||
|
||||
public function __construct(protected Database $database)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
|
||||
Reference in new issue
Block a user