Skip to content

Add GitHub authentication for API requests, to prevent limits. #41

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

Merged
merged 1 commit into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ TG_PATHS='{"download": "${TG_DOWNLOADS_DIR}", "upload": "${TG_UPLOADS_DIR}"}'
# Webhook secrets
TG_WEBHOOK_SECRET_GITHUB='github-secret'

# GitHub API token
TG_GITHUB_AUTH_USER='github-user'
TG_GITHUB_AUTH_TOKEN='github-token'

# Telegram Payments
TG_PAYMENT_PROVIDER_TOKEN='123:TEST:abc'

Expand Down
1 change: 1 addition & 0 deletions public/webhooks/github.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ function parseReleaseBody($body, $user, $repo): string
}, $body);

$github_client = new Client();
$github_client->authenticate(getenv('TG_GITHUB_AUTH_USER'), getenv('TG_GITHUB_AUTH_TOKEN'));
$github_client->addCache(new Pool(new MySQL(
new PDO('mysql:dbname=' . getenv('TG_DB_DATABASE') . ';host=' . getenv('TG_DB_HOST'), getenv('TG_DB_USER'), getenv('TG_DB_PASSWORD'))
)));
Expand Down