Skip to content

Commit

Permalink
Merge pull request #11 from nutgram/fix-octane
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasss93 authored Sep 7, 2023
2 parents eccbd9d + 44b5f02 commit 2f8eee4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/NutgramServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
use Illuminate\Contracts\Cache\Repository as Cache;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\ServiceProvider;
use Nutgram\Laravel\RunningMode\LaravelWebhook;
use Psr\Log\LoggerInterface;
use SergiX44\Nutgram\Configuration;
use SergiX44\Nutgram\Nutgram;
use SergiX44\Nutgram\RunningMode\Polling;
use SergiX44\Nutgram\RunningMode\Webhook;
use SergiX44\Nutgram\Telegram\Types\Media\File;
use SergiX44\Nutgram\Testing\FakeNutgram;

Expand Down Expand Up @@ -55,10 +55,10 @@ public function register()
if ($app->runningInConsole()) {
$bot->setRunningMode(Polling::class);
} else {
$webhook = Webhook::class;
$webhook = LaravelWebhook::class;
if (config('nutgram.safe_mode', false)) {
// take into account the trust proxy Laravel configuration
$webhook = new Webhook(fn () => $app->make('request')?->ip());
$webhook = new LaravelWebhook(fn () => $app->make('request')?->ip());
}

$bot->setRunningMode($webhook);
Expand Down
13 changes: 13 additions & 0 deletions src/RunningMode/LaravelWebhook.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Nutgram\Laravel\RunningMode;

use SergiX44\Nutgram\RunningMode\Webhook;

class LaravelWebhook extends Webhook
{
protected function input(): ?string
{
return request()?->getContent();
}
}

0 comments on commit 2f8eee4

Please sign in to comment.