Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.env and performance improvements #45

Merged
merged 13 commits into from
Jan 20, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
* Changes for use .env file and not a php with sensible data
  • Loading branch information
vitormattos committed Jan 15, 2017
commit 211996932f5e17e64a9ff31b1b2e192383ff3751
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NUMBER=+5521999596772
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ _site
.idea/
*.iml

# Eclipse
.buildpath
.project
.settings

# VI
*.swp

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -76,3 +84,6 @@ web_API.log
db_connect.php
sessions
docs_md

# .evn
.env
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"phpseclib/phpseclib": "^2.0",
"paragonie/constant_time_encoding": "^1|^2",
"paragonie/random_compat": "^2.0",
"php": ">=5.6.0"
"php": ">=5.6.0",
"vlucas/phpdotenv": "^2.4"
},
"authors": [
{
Expand Down
61 changes: 56 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions testing.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@
$MadelineProto = \danog\MadelineProto\Serialization::deserialize('session.madeline');

if (file_exists('number.php') && $MadelineProto === false) {
include_once 'number.php';
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
$MadelineProto = new \danog\MadelineProto\API($settings);

$checkedPhone = $MadelineProto->auth->checkPhone(// auth.checkPhone becomes auth->checkPhone
[
'phone_number' => $number,
'phone_number' => getenv('NUMBER'),
]
);
\danog\MadelineProto\Logger::log($checkedPhone);
$sentCode = $MadelineProto->phone_login($number);
$sentCode = $MadelineProto->phone_login(getenv('NUMBER'));
\danog\MadelineProto\Logger::log($sentCode);
echo 'Enter the code you received: ';
$code = fgets(STDIN, (isset($sentCode['type']['length']) ? $sentCode['type']['length'] : 5) + 1);
Expand Down