Browse Source

Merge pull request #2771 from pixelfed/staging

Staging
daniel 4 years ago
parent
commit
bbb1ffe821

+ 6 - 0
CHANGELOG.md

@@ -9,6 +9,8 @@
 - Profile pronouns ([fabb57a9](https://github.com/pixelfed/pixelfed/commit/fabb57a9))
 - Hashtag timeline api support ([241ae036](https://github.com/pixelfed/pixelfed/commit/241ae036))
 - New admin dashboard layout ([eb7d5a4e](https://github.com/pixelfed/pixelfed/commit/eb7d5a4e))
+- Fresh about page layout ([92dc7af6](https://github.com/pixelfed/pixelfed/commit/92dc7af6))
+- Instance Rules ([a4efbb75](https://github.com/pixelfed/pixelfed/commit/a4efbb75))
 
 ### Updated
 - Updated AdminController, fix variable name in updateSpam method. ([6edaf940](https://github.com/pixelfed/pixelfed/commit/6edaf940))
@@ -95,6 +97,10 @@
 - Updated ComposeController, bail on empty attachments. ([061b145b](https://github.com/pixelfed/pixelfed/commit/061b145b))
 - Updated landing and about page. ([92dc7af6](https://github.com/pixelfed/pixelfed/commit/92dc7af6))
 - Updated AdminStatsService, fix postgres bug. ([af719135](https://github.com/pixelfed/pixelfed/commit/af719135))
+- Updated api, remove auth requirement for hashtag timeline. ([c8e43c60](https://github.com/pixelfed/pixelfed/commit/c8e43c60))
+- Updated NotificationCard component, fix default value. ([78ad4e77](https://github.com/pixelfed/pixelfed/commit/78ad4e77))
+- Updated Timeline component, show counts and make sidebar footer lighter. ([0788bffa](https://github.com/pixelfed/pixelfed/commit/0788bffa))
+- Updated AuthServiceProvider, increase default token + refresh token lifetime. ([178ed63d](https://github.com/pixelfed/pixelfed/commit/178ed63d))
 -  ([](https://github.com/pixelfed/pixelfed/commit/))
 
 ## [v0.10.10 (2021-01-28)](https://github.com/pixelfed/pixelfed/compare/v0.10.9...v0.10.10)

+ 46 - 45
app/Exceptions/Handler.php

@@ -4,55 +4,56 @@ namespace App\Exceptions;
 
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
 use Throwable;
+use League\OAuth2\Server\Exception\OAuthServerException;
 
 class Handler extends ExceptionHandler
 {
-    /**
-     * A list of the exception types that are not reported.
-     *
-     * @var array
-     */
-    protected $dontReport = [
-        //
-    ];
+	/**
+	 * A list of the exception types that are not reported.
+	 *
+	 * @var array
+	 */
+	protected $dontReport = [
+		OAuthServerException::class
+	];
 
-    /**
-     * A list of the inputs that are never flashed for validation exceptions.
-     *
-     * @var array
-     */
-    protected $dontFlash = [
-        'password',
-        'password_confirmation',
-    ];
+	/**
+	 * A list of the inputs that are never flashed for validation exceptions.
+	 *
+	 * @var array
+	 */
+	protected $dontFlash = [
+		'password',
+		'password_confirmation',
+	];
 
-    /**
-     * Report or log an exception.
-     *
-     * @param \Exception $exception
-     *
-     * @return void
-     */
-    public function report(Throwable $exception)
-    {
-        parent::report($exception);
-    }
+	/**
+	 * Report or log an exception.
+	 *
+	 * @param \Exception $exception
+	 *
+	 * @return void
+	 */
+	public function report(Throwable $exception)
+	{
+		parent::report($exception);
+	}
 
-    /**
-     * Render an exception into an HTTP response.
-     *
-     * @param \Illuminate\Http\Request $request
-     * @param \Exception               $exception
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function render($request, Throwable $exception)
-    {
-        if ($request->wantsJson())
-            return response()->json(
-                ['error' => $exception->getMessage()],
-                method_exists($exception, 'getStatusCode') ? $exception->getStatusCode() : 500
-            );
-        return parent::render($request, $exception);
-    }
+	/**
+	 * Render an exception into an HTTP response.
+	 *
+	 * @param \Illuminate\Http\Request $request
+	 * @param \Exception               $exception
+	 *
+	 * @return \Illuminate\Http\Response
+	 */
+	public function render($request, Throwable $exception)
+	{
+		if ($request->wantsJson())
+			return response()->json(
+				['error' => $exception->getMessage()],
+				method_exists($exception, 'getStatusCode') ? $exception->getStatusCode() : 500
+			);
+		return parent::render($request, $exception);
+	}
 }

+ 0 - 2
app/Http/Controllers/Api/ApiV1Controller.php

@@ -1988,8 +1988,6 @@ class ApiV1Controller extends Controller
      */
     public function timelineHashtag(Request $request, $hashtag)
     {
-        abort_if(!$request->user(), 403);
-
         $this->validate($request,[
           'page'        => 'nullable|integer|max:40',
           'min_id'      => 'nullable|integer|min:0|max:' . PHP_INT_MAX,

+ 6 - 6
app/Providers/AuthServiceProvider.php

@@ -26,10 +26,10 @@ class AuthServiceProvider extends ServiceProvider
     {
         $this->registerPolicies();
 
-        if(config('pixelfed.oauth_enabled')) {
+        if(config_cache('pixelfed.oauth_enabled') == true) {
             Passport::routes(null, ['middleware' => ['twofactor', \Fruitcake\Cors\HandleCors::class]]);
-            Passport::tokensExpireIn(now()->addDays(config('instance.oauth.token_expiration', 15)));
-            Passport::refreshTokensExpireIn(now()->addDays(config('instance.oauth.refresh_expiration', 30)));
+            Passport::tokensExpireIn(now()->addDays(config('instance.oauth.token_expiration', 356)));
+            Passport::refreshTokensExpireIn(now()->addDays(config('instance.oauth.refresh_expiration', 400)));
             Passport::enableImplicitGrant();
             if(config('instance.oauth.pat.enabled')) {
                 Passport::personalAccessClientId(config('instance.oauth.pat.id'));
@@ -48,8 +48,8 @@ class AuthServiceProvider extends ServiceProvider
             ]);
         }
 
-        Gate::define('viewWebSocketsDashboard', function ($user = null) {
-            return $user->is_admin;
-        });
+        // Gate::define('viewWebSocketsDashboard', function ($user = null) {
+        //     return $user->is_admin;
+        // });
     }
 }

+ 8 - 2
resources/assets/js/components/NotificationCard.vue

@@ -20,7 +20,7 @@
 					<div class="media-body font-weight-light small">
 						<div v-if="n.type == 'favourite'">
 							<p class="my-0">
-								<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> liked your 
+								<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> liked your
 								<span v-if="n.status.hasOwnProperty('media_attachments')">
 									<a class="font-weight-bold" v-bind:href="n.status.url" :id="'fvn-' + n.id">post</a>.
 									<b-popover :target="'fvn-' + n.id" title="" triggers="hover" placement="top" boundary="window">
@@ -86,6 +86,12 @@
 					<p class="mb-0 small font-weight-bold">0 Notifications!</p>
 				</div>
 			</div>
+			<div v-else class="card-body px-0 py-0" style="max-height: 240px;">
+				<div class="text-lighter text-center py-3">
+					<p class="mb-0"><i class="fas fa-inbox fa-3x"></i></p>
+					<p class="mb-0 small font-weight-bold">No notifications yet</p>
+				</div>
+			</div>
 		</div>
 	</transition>
 </div>
@@ -253,4 +259,4 @@
 			}
 		}
 	}
-</script>
+</script>

+ 30 - 12
resources/assets/js/components/Timeline.vue

@@ -355,6 +355,22 @@
 									</div>
 								</div> -->
 							</div>
+							<div class="card-footer bg-transparent border-0 pt-0 pb-1">
+                                <div class="d-flex justify-content-between text-center">
+                                    <span class="cursor-pointer" @click="redirect(profile.url)">
+                                        <p class="mb-0 font-weight-bold">{{formatCount(profile.statuses_count)}}</p>
+                                        <p class="mb-0 small text-muted">Posts</p>
+                                    </span>
+                                    <span class="cursor-pointer" @click="redirect(profile.url+'?md=followers')">
+                                        <p class="mb-0 font-weight-bold">{{formatCount(profile.followers_count)}}</p>
+                                        <p class="mb-0 small text-muted">Followers</p>
+                                    </span>
+                                    <span class="cursor-pointer" @click="redirect(profile.url+'?md=following')">
+                                        <p class="mb-0 font-weight-bold">{{formatCount(profile.following_count)}}</p>
+                                        <p class="mb-0 small text-muted">Following</p>
+                                    </span>
+                                </div>
+                            </div>
 						</div>
 
 						<div v-show="modes.notify == true && !loading" class="mb-4">
@@ -388,18 +404,17 @@
 						</div>
 
 						<footer>
-							<div class="container pb-5">
-								<p class="mb-0 text-uppercase font-weight-bold text-muted small">
-									<a href="/site/about" class="text-dark pr-2">About</a>
-									<a href="/site/help" class="text-dark pr-2">Help</a>
-									<a href="/site/language" class="text-dark pr-2">Language</a>
-									<a href="/discover/profiles" class="text-dark pr-2">Profiles</a>
-									<a href="/discover/places" class="text-dark pr-2">Places</a>
-									<a href="/site/privacy" class="text-dark pr-2">Privacy</a>
-									<a href="/site/terms" class="text-dark pr-2">Terms</a>
+							<div class="container px-0 pb-5">
+								<p class="mb-2 small text-justify">
+									<a href="/site/about" class="text-lighter pr-2">About</a>
+									<a href="/site/help" class="text-lighter pr-2">Help</a>
+									<a href="/site/language" class="text-lighter pr-2">Language</a>
+									<a href="/discover/places" class="text-lighter pr-2">Places</a>
+									<a href="/site/privacy" class="text-lighter pr-2">Privacy</a>
+									<a href="/site/terms" class="text-lighter pr-2">Terms</a>
 								</p>
-								<p class="mb-0 text-uppercase font-weight-bold text-muted small">
-									<a href="http://pixelfed.org" class="text-muted" rel="noopener" title="" data-toggle="tooltip">Powered by Pixelfed</a>
+								<p class="mb-0 text-uppercase text-muted small">
+									<a href="http://pixelfed.org" class="text-lighter" rel="noopener" title="" data-toggle="tooltip">Powered by Pixelfed</a>
 								</p>
 							</div>
 						</footer>
@@ -898,7 +913,10 @@
 							})
 						}
 					]
-				}
+				},
+				discover_min_id: 0,
+				discover_max_id: 0,
+				discover_feed: []
 			}
 		},