diff --git a/.env.example b/.env.example index 1ec62a08..d9408374 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ -NUMBER=+5521999596772 +MTPROTO_NUMBER=+123456789 +MTPROTO_SETTINGS=[] \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9e28dd72..744c0f01 100644 --- a/.gitignore +++ b/.gitignore @@ -72,7 +72,6 @@ target/ *.swp vendor *bak -number.php token.php *~uploading* session.mad diff --git a/testing.php b/testing.php index 51140ede..9a6439e3 100755 --- a/testing.php +++ b/testing.php @@ -12,25 +12,28 @@ If not, see . */ require_once 'vendor/autoload.php'; -$settings = []; if (file_exists('web_data.php')) { require_once 'web_data.php'; } $MadelineProto = \danog\MadelineProto\Serialization::deserialize('session.madeline'); -if (file_exists('number.php') && $MadelineProto === false) { +if (file_exists('.env')) { $dotenv = new Dotenv\Dotenv(__DIR__); $dotenv->load(); +} +$settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: []; + +if ($MadelineProto === false) { $MadelineProto = new \danog\MadelineProto\API($settings); $checkedPhone = $MadelineProto->auth->checkPhone(// auth.checkPhone becomes auth->checkPhone [ - 'phone_number' => getenv('NUMBER'), + 'phone_number' => getenv('MTPROTO_NUMBER'), ] ); \danog\MadelineProto\Logger::log($checkedPhone); - $sentCode = $MadelineProto->phone_login(getenv('NUMBER')); + $sentCode = $MadelineProto->phone_login(getenv('MTPROTO_NUMBER')); \danog\MadelineProto\Logger::log($sentCode); echo 'Enter the code you received: '; $code = fgets(STDIN, (isset($sentCode['type']['length']) ? $sentCode['type']['length'] : 5) + 1);