diff options
| author | horus | 2026-03-27 18:22:00 +0100 |
|---|---|---|
| committer | horus | 2026-03-27 18:22:00 +0100 |
| commit | 51df8f1b6ae6d9848e125fad6970bf2a107fecd3 (patch) | |
| tree | 029d9aab7fc790541a7fa7ce4f1bc5e287f550d4 /app | |
| parent | 54ef8f3b68efd19dfbbcc21f041105f90976085a (diff) | |
| download | curious-51df8f1b6ae6d9848e125fad6970bf2a107fecd3.tar.gz | |
Update to Laravel 10
Diffstat (limited to 'app')
| -rw-r--r-- | app/Http/Kernel.php | 2 | ||||
| -rw-r--r-- | app/Http/Middleware/TrustProxies.php | 10 | ||||
| -rw-r--r-- | app/Libraries/Helper.php | 20 |
3 files changed, 21 insertions, 11 deletions
diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index c3640f3..09ccbc9 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -15,7 +15,7 @@ class Kernel extends HttpKernel */ protected $middleware = [ \App\Http\Middleware\TrustProxies::class, - \Fruitcake\Cors\HandleCors::class, + \Illuminate\Http\Middleware\HandleCors::class, \App\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index 3625f37..3e347db 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -2,7 +2,8 @@ namespace App\Http\Middleware; -use Fideloper\Proxy\TrustProxies as Middleware; +#use Fideloper\Proxy\TrustProxies as Middleware; +use Illuminate\Http\Middleware\TrustProxies as Middleware; use Illuminate\Http\Request; class TrustProxies extends Middleware @@ -19,5 +20,10 @@ class TrustProxies extends Middleware * * @var int */ - protected $headers = Request::HEADER_X_FORWARDED_ALL; + protected $headers = + Request::HEADER_X_FORWARDED_FOR | + Request::HEADER_X_FORWARDED_HOST | + Request::HEADER_X_FORWARDED_PORT | + Request::HEADER_X_FORWARDED_PROTO | + Request::HEADER_X_FORWARDED_AWS_ELB; } diff --git a/app/Libraries/Helper.php b/app/Libraries/Helper.php index 8164887..924c1db 100644 --- a/app/Libraries/Helper.php +++ b/app/Libraries/Helper.php @@ -2,6 +2,7 @@ namespace App\Libraries; use App\Libraries\Helper; use Carbon\Carbon; +use Rumenx\Feed\FeedFactory; class Helper { public static function escapeLike($string){ @@ -37,7 +38,7 @@ class Helper { break; } // create new feed - $feed = \App::make("feed"); + $feed = FeedFactory::create(); // multiple feeds are supported // if you are using caching you should set different cache keys for your feeds @@ -50,13 +51,13 @@ class Helper { { // set your feed's title, description, link, pubdate and language - $feed->title = $feed_title; - $feed->description = $feed_description; - #$feed->logo = 'http://yoursite.tld/logo.jpg'; - $feed->link = url('feed/' . $title); + $feed->setTitle($feed_title); + $feed->setDescription($feed_description); + #$feed->setLogo('http://yoursite.tld/logo.jpg'); + $feed->setLink(url('feed/' . $title)); $feed->setDateFormat('datetime'); // 'datetime', 'timestamp' or 'carbon' - $feed->pubdate = $model[0]->created_at; - $feed->lang = 'en'; + $feed->setPubdate($model[0]->created_at); + $feed->setLang('en'); $feed->setShortening(false); // true or false if ( "mastodon" == $title || "mastodon_test" == $title ) { @@ -172,7 +173,10 @@ class Helper { // first param is the feed format // optional: second param is cache duration (value of 0 turns off caching) // optional: you can set custom cache key with 3rd param as string - return $feed->render('atom', $cache, 'feed_' . $title); + $xml = $feed->render('atom', $cache, 'feed_' . $title); + return response($xml, 200, [ + 'Content-Type' => 'application/xml' + ]); } public static function first_sentence($content, $max_len = NULL) { |
