Pārlūkot izejas kodu

Update ProfileController, refactor profile embeds

Daniel Supernault 1 gadu atpakaļ
vecāks
revīzija
8b8b1ffc5c

+ 4 - 4
app/Http/Controllers/ProfileController.php

@@ -172,7 +172,7 @@ class ProfileController extends Controller
 
 
         $user = $this->getCachedUser($username);
         $user = $this->getCachedUser($username);
 
 
-        abort_if(!$user, 404);
+        abort_if(! $user, 404);
 
 
         return redirect($user->url());
         return redirect($user->url());
     }
     }
@@ -254,7 +254,7 @@ class ProfileController extends Controller
 
 
         abort_if(! $profile || $profile['locked'] || ! $profile['local'], 404);
         abort_if(! $profile || $profile['locked'] || ! $profile['local'], 404);
 
 
-        $aiCheck = Cache::remember('profile:ai-check:spam-login:'.$profile['id'], 86400, function () use ($profile) {
+        $aiCheck = Cache::remember('profile:ai-check:spam-login:'.$profile['id'], 3600, function () use ($profile) {
             $uid = User::whereProfileId($profile['id'])->first();
             $uid = User::whereProfileId($profile['id'])->first();
             if (! $uid) {
             if (! $uid) {
                 return true;
                 return true;
@@ -348,7 +348,7 @@ class ProfileController extends Controller
             return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
             return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
         }
         }
 
 
-        $aiCheck = Cache::remember('profile:ai-check:spam-login:'.$profile->id, 86400, function () use ($profile) {
+        $aiCheck = Cache::remember('profile:ai-check:spam-login:'.$profile->id, 3600, function () use ($profile) {
             $exists = AccountInterstitial::whereUserId($profile->user_id)->where('is_spam', 1)->count();
             $exists = AccountInterstitial::whereUserId($profile->user_id)->where('is_spam', 1)->count();
             if ($exists) {
             if ($exists) {
                 return true;
                 return true;
@@ -373,7 +373,7 @@ class ProfileController extends Controller
 
 
     public function stories(Request $request, $username)
     public function stories(Request $request, $username)
     {
     {
-        abort_if(!(bool) config_cache('instance.stories.enabled') || ! $request->user(), 404);
+        abort_if(! (bool) config_cache('instance.stories.enabled') || ! $request->user(), 404);
         $profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
         $profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
         $pid = $profile->id;
         $pid = $profile->id;
         $authed = Auth::user()->profile_id;
         $authed = Auth::user()->profile_id;

+ 2 - 2
resources/views/profile/embed.blade.php

@@ -8,7 +8,7 @@
     <title>{{ $title ?? config_cache('app.name', 'Pixelfed') }}</title>
     <title>{{ $title ?? config_cache('app.name', 'Pixelfed') }}</title>
     <meta property="og:site_name" content="{{ config_cache('app.name', 'pixelfed') }}">
     <meta property="og:site_name" content="{{ config_cache('app.name', 'pixelfed') }}">
     <meta property="og:title" content="{{ $title ?? config_cache('app.name', 'pixelfed') }}">
     <meta property="og:title" content="{{ $title ?? config_cache('app.name', 'pixelfed') }}">
-    <meta property="og:type" content="article">
+    <meta property="og:type" content="profile">
     <meta property="og:url" content="{{$profile['url']}}">
     <meta property="og:url" content="{{$profile['url']}}">
     <meta name="medium" content="image">
     <meta name="medium" content="image">
     <meta name="theme-color" content="#10c5f8">
     <meta name="theme-color" content="#10c5f8">
@@ -43,7 +43,7 @@
                         <p class="mb-0 text-muted text-uppercase small font-weight-bold">Followers</p>
                         <p class="mb-0 text-muted text-uppercase small font-weight-bold">Followers</p>
                     </div>
                     </div>
                     <div class="text-center">
                     <div class="text-center">
-                        <p class="mb-0"><a href="/i/intent/follow?user={{$profile['username']}}" class="btn btn-primary btn-sm py-1 px-4 text-uppercase font-weight-bold" target="_blank">Follow</a></p>
+                        <p class="mb-0"><a href="{{config('app.url')}}/i/intent/follow?user={{$profile['username']}}" class="btn btn-primary btn-sm py-1 px-4 text-uppercase font-weight-bold" target="_blank">Follow</a></p>
                     </div>
                     </div>
                 </div>
                 </div>
                 <div class="row mt-4 mb-1 embed-row"></div>
                 <div class="row mt-4 mb-1 embed-row"></div>