pull/7370/head
Your Name 5 days ago
parent fe295aa157
commit 6beab304a0

@ -26,8 +26,6 @@ final class AdminInviteCommand extends Command
/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{

@ -36,8 +36,6 @@ final class BackupToCloud extends Command
/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{

@ -30,8 +30,6 @@ class ImportEmojis extends Command
/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{

@ -110,6 +110,7 @@ class SendUpdateActor extends Command
$instance->actors_last_synced_at = now();
$instance->save();
$this->info('Finished!');
return Command::SUCCESS;
return Command::SUCCESS;

@ -32,8 +32,6 @@ class ExportLanguages extends Command
/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{

@ -27,8 +27,6 @@ class FixMediaDriver extends Command
/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{

@ -33,8 +33,6 @@ class GarbageCollectorDatabaseSession extends Command
/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{

@ -55,11 +55,12 @@ class PushGatewayRefresh extends Command
$this->line(' ');
$this->line('For more info, visit https://docs.pixelfed.org/running-pixelfed/push-notifications.html');
$this->line(' ');
return;
return;
}
exit;
return;
}
}

@ -24,8 +24,6 @@ class UserCheckPassword extends Command
/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{

@ -134,6 +134,7 @@ class AccountController extends Controller
if ($request->wantsJson()) {
return response()->json($res);
}
return redirect()->back();
}
@ -185,6 +186,7 @@ class AccountController extends Controller
if ($request->wantsJson()) {
return response()->json($res);
}
return redirect()->back();
}
@ -270,6 +272,7 @@ class AccountController extends Controller
if ($request->wantsJson()) {
return response()->json($res);
}
return redirect()->back();
}
@ -320,6 +323,7 @@ class AccountController extends Controller
if ($request->wantsJson()) {
return response()->json($res);
}
return redirect()->back();
}

@ -792,6 +792,7 @@ trait AdminReportController
return [200];
}
return null;
}
@ -1070,6 +1071,7 @@ trait AdminReportController
return [200];
}
return null;
}
@ -1222,6 +1224,7 @@ trait AdminReportController
return [200];
}
return null;
}

@ -865,12 +865,12 @@ trait AdminSettingsController
$visibility = $request->input('disk_config.visibility');
$url = $request->input('disk_config.url');
$endpoint = $request->input('disk_config.endpoint');
if (!str_contains($key, '*') && $key != config_cache($dkey.'key')) {
if (! str_contains($key, '*') && $key != config_cache($dkey.'key')) {
array_push($changes, 'key');
} else {
$ckey = config_cache($dkey.'key');
}
if (!str_contains($secret, '*') && $secret != config_cache($dkey.'secret')) {
if (! str_contains($secret, '*') && $secret != config_cache($dkey.'secret')) {
array_push($changes, 'secret');
} else {
$csecret = config_cache($dkey.'secret');

@ -560,6 +560,7 @@ class AdminController extends Controller
if ($pg) {
return $query->latest();
}
return $query->groupBy('shortcode')->latest();
}
if ($sort == 'local') {
@ -584,6 +585,7 @@ class AdminController extends Controller
$q = $q->groupBy('shortcode');
}
}
return $q;
}
})
@ -711,6 +713,7 @@ class AdminController extends Controller
if ($filter === 'newest') {
return $q->orderByDesc('id');
}
return $q;
})
->cursorPaginate(10)

@ -27,6 +27,7 @@ class AdminShadowFilterController extends Controller
if ($filter == 'inactive') {
return $q->whereActive(false);
}
return $q;
}, function ($q, $filter) {
return $q->whereActive(true);

@ -601,6 +601,7 @@ class AdminApiController extends Controller
AccountService::del($profile->id);
DeleteRemoteProfilePipeline::dispatch($profile)->onQueue('high');
}
return [
'status' => 200,
'msg' => 'deleted',
@ -678,8 +679,7 @@ class AdminApiController extends Controller
->save();
$profile->no_autolink = ! $profile->no_autolink;
$profile->save();
}
else {
} else {
$profile->{$action} = filter_var($request->input('value'), FILTER_VALIDATE_BOOLEAN);
$profile->save();
@ -736,6 +736,7 @@ class AdminApiController extends Controller
if ($filter === 'all') {
return $query;
}
return $query->where($filter, true);
})
->when($sortBy, function ($query, $sortBy) use ($sort) {

@ -1580,6 +1580,7 @@ class ApiV1Controller extends Controller
return $this->json($res, 200, ['Link' => $link]);
}
return $this->json($res);
}
@ -2739,6 +2740,7 @@ class ApiV1Controller extends Controller
return response()->json([], 206);
}
Cache::set('pf:services:apiv1:home:cached:coldbootcheck:'.$pid, 1, 86400);
return response()->json([], 206);
}

@ -156,6 +156,7 @@ class RegisterController extends Controller
return view('auth.register');
}
return view('auth.register');
}
if ((bool) config_cache('instance.curated_registration.enabled') && config('instance.curated_registration.state.fallback_on_closed_reg')) {

@ -231,7 +231,6 @@ class CustomFilterController extends Controller
* Convert Mastodon filter_action string to internal action value
*
* @param string $filterAction
* @return int
*/
private function filterActionToAction($filterAction): int
{

@ -105,6 +105,7 @@ class FederationController extends Controller
return response()->json($webfinger, 200, [], JSON_UNESCAPED_SLASHES)
->header('Access-Control-Allow-Origin', '*');
}
return response('', 400);
}
$hash = hash('sha256', $resource);
@ -112,7 +113,7 @@ class FederationController extends Controller
if ($cached = Cache::get($key)) {
return response()->json($cached, 200, [], JSON_UNESCAPED_SLASHES);
}
if (!str_contains($resource, $domain)) {
if (! str_contains($resource, $domain)) {
return response('', 400);
}
$parsed = Nickname::normalizeProfileUrl($resource);
@ -205,13 +206,13 @@ class FederationController extends Controller
return;
}
}
return;
}
if (isset($obj['type']) && in_array($obj['type'], ['Follow', 'Accept'])) {
dispatch(new InboxValidator($username, $headers, $payload))->onQueue('follow');
}
else {
} else {
dispatch(new InboxValidator($username, $headers, $payload))->onQueue('high');
}
}
@ -261,13 +262,13 @@ class FederationController extends Controller
return;
}
}
return;
}
if (isset($obj['type']) && in_array($obj['type'], ['Follow', 'Accept'])) {
dispatch(new InboxWorker($headers, $payload))->onQueue('follow');
}
else {
} else {
dispatch(new InboxWorker($headers, $payload))->onQueue('shared');
}
}

@ -254,6 +254,7 @@ class GroupsPostController extends Controller
if ($request->wantsJson()) {
return response()->json(['Status successfully deleted.']);
}
return redirect($user->url());
}

@ -276,8 +276,10 @@ class ImportPostController extends Controller
if ($exts->contains('jpg', 'png', 'webp')) {
return 'photo:video:album';
}
return 'video:album';
}
return 'photo:album';
}
if ($exts->isEmpty()) {
@ -290,6 +292,7 @@ class ImportPostController extends Controller
if (in_array($ext, ['mp4'])) {
return 'video';
}
return 'photo';
}
@ -316,6 +319,7 @@ class ImportPostController extends Controller
if (! $abortOnFail) {
return true;
}
return true;
}

@ -143,6 +143,7 @@ class ProfileController extends Controller
if ($carousel) {
return view('profile.show_carousel', ['profile' => $profile, 'settings' => $settings]);
}
return view('profile.show', ['profile' => $profile, 'settings' => $settings]);
}
@ -160,6 +161,7 @@ class ProfileController extends Controller
->whereUsername($username)
->first();
}
return Profile::withTrashed()
->whereNull(['domain', 'status'])
->whereUsername($username)

@ -45,6 +45,7 @@ class PublicApiController extends Controller
if (! $user) {
return [];
}
return AccountService::get($user->profile_id);
}
@ -482,6 +483,7 @@ class PublicApiController extends Controller
->values()
->toArray();
}
return Status::select(
'id',
'uri',
@ -858,6 +860,7 @@ class PublicApiController extends Controller
return $isFollowing ? ['public', 'unlisted', 'private'] : ['public', 'unlisted'];
}
return ['public', 'unlisted'];
}

@ -556,6 +556,7 @@ class RemoteAuthController extends Controller
if ($user) {
return ['id' => (string) $user->profile_id];
}
return [];
}
try {
@ -563,6 +564,7 @@ class RemoteAuthController extends Controller
if ($profile) {
return ['id' => (string) $profile->id];
}
return [];
} catch (RequestException|\Exception) {
return [];

@ -25,6 +25,7 @@ class SiteController extends Controller
if ($request->user() !== null) {
return $this->homeTimeline($request);
}
return $this->homeGuest();
}

@ -35,10 +35,13 @@ class AccountInterstitial
return response()->json($res, 403);
}
return redirect('/i/warning');
}
return $next($request);
}
return $next($request);
}
}

@ -101,14 +101,17 @@ class DeleteWorker implements ShouldQueue
return 1;
}
// Signature verification failed, exit.
return 1;
}
// Remote user doesn't exist, exit early.
return 1;
return 1;
}
return 1;
}
$profile = null;
@ -117,6 +120,7 @@ class DeleteWorker implements ShouldQueue
return 1;
}
return 1;
}
@ -195,6 +199,7 @@ class DeleteWorker implements ShouldQueue
if ($verified == 1) {
return true;
}
return false;
}
}

@ -160,6 +160,7 @@ class InboxWorker implements ShouldQueue
if ($verified == 1) {
return true;
}
return false;
}

@ -69,8 +69,6 @@ class AdminNewAutospam extends Mailable
/**
* Get the attachments for the message.
*
* @return array
*/
public function attachments(): array
{

@ -90,8 +90,6 @@ class AdminNewReport extends Mailable
/**
* Get the attachments for the message.
*
* @return array
*/
public function attachments(): array
{

@ -57,8 +57,6 @@ class ConfirmAppEmail extends Mailable
/**
* Get the attachments for the message.
*
* @return array
*/
public function attachments(): array
{

@ -225,7 +225,7 @@ class Profile extends Model
return url('/storage/avatars/default.jpg');
}
if (!str_starts_with($path, 'public')) {
if (! str_starts_with($path, 'public')) {
return url('/storage/avatars/default.jpg');
}

@ -17,8 +17,6 @@ class CustomFilterPolicy
/**
* Determine whether the user can view the custom filter.
*
* @return bool
*/
public function view(User $user, CustomFilter $filter): bool
{
@ -35,8 +33,6 @@ class CustomFilterPolicy
/**
* Determine whether the user can update the custom filter.
*
* @return bool
*/
public function update(User $user, CustomFilter $filter): bool
{
@ -45,8 +41,6 @@ class CustomFilterPolicy
/**
* Determine whether the user can delete the custom filter.
*
* @return bool
*/
public function delete(User $user, CustomFilter $filter): bool
{

@ -11,7 +11,7 @@ class CaptchaServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->singleton('captcha.manager', fn ($app): \App\Services\Captcha\CaptchaManager => new CaptchaManager($app));
$this->app->singleton('captcha.manager', fn ($app): CaptchaManager => new CaptchaManager($app));
$this->app->alias('captcha.manager', CaptchaManager::class);
}

@ -148,8 +148,10 @@ class ActiveSharedInboxService
if ($res['version'] === self::CACHE_FILE_VERSION) {
return $res;
}
return false;
}
return false;
}

@ -292,7 +292,6 @@ class FollowerService
* @param int $profileId
* @param int $limit
* @param int|null $cursor
* @return array
*/
public static function getMutualsForDM($profileId, $limit = 20, $cursor = null): array
{

@ -121,6 +121,7 @@ class NotificationAppGatewayService
} catch (RequestException|Exception) {
return null;
}
return null;
}
}

@ -84,10 +84,10 @@ class SearchApiV2Service
$rawQuery = $initalQuery ? $initalQuery : $this->query->input('q');
$query = $rawQuery.'%';
$webfingerQuery = $query;
if (Str::substrCount($rawQuery, '@') == 1 && !str_starts_with($rawQuery, '@')) {
if (Str::substrCount($rawQuery, '@') == 1 && ! str_starts_with($rawQuery, '@')) {
$query = '@'.$query;
}
if (!str_starts_with($webfingerQuery, '@')) {
if (! str_starts_with($webfingerQuery, '@')) {
$webfingerQuery = '@'.$webfingerQuery;
}
$banned = InstanceService::getBannedDomains() ?? [];
@ -234,16 +234,17 @@ class SearchApiV2Service
if (Str::contains($query, 'i/web/profile/')) {
return $this->resolveLocalProfileId();
}
return $this->resolveLocalProfile();
}
if (! Helpers::validateUrl($query) && !str_contains($query, '@')) {
if (! Helpers::validateUrl($query) && ! str_contains($query, '@')) {
return $default;
}
if (
! Str::startsWith($query, 'http') &&
Str::substrCount($query, '@') == 1 &&
str_contains($query, '@') &&
!str_starts_with($query, '@')
! str_starts_with($query, '@')
) {
try {
$res = WebfingerService::lookup('@'.$query, $mastodonMode);
@ -264,6 +265,7 @@ class SearchApiV2Service
return $default;
}
return $default;
}
if (Str::substrCount($query, '@') == 2) {
@ -286,6 +288,7 @@ class SearchApiV2Service
return $default;
}
return $default;
}
if ($sid = Status::whereUri($query)->first()) {
@ -361,6 +364,7 @@ class SearchApiV2Service
'statuses' => [],
];
}
return $default;
}

@ -541,6 +541,7 @@ class Helpers
if (json_last_error() === JSON_ERROR_NONE) {
return $res;
}
return false;
});
}

@ -425,7 +425,6 @@ class Autolink extends Regex
*
* @param string $tweet
* @param array $entities
* @return string
*
* @since 1.1.0
*/
@ -502,7 +501,6 @@ class Autolink extends Regex
* convert Object to Array.
*
* @param mixed $obj
* @return array
*/
protected function object2array($obj): array
{
@ -693,7 +691,6 @@ class Autolink extends Regex
}
/**
* @param array $entity
* @param string $tweet
* @return string
*
@ -726,7 +723,6 @@ class Autolink extends Regex
}
/**
* @param array $entity
* @return string
*
* @since 1.1.0
@ -762,7 +758,6 @@ class Autolink extends Regex
}
/**
* @param array $entity
* @param string $tweet
* @return string
*
@ -787,8 +782,6 @@ class Autolink extends Regex
/**
* @param string $text
* @param array $attributes
* @return string
*
* @since 1.1.0
*/
@ -823,7 +816,6 @@ class Autolink extends Regex
* html escape.
*
* @param string $text
* @return string
*/
protected function escapeHTML($text): string
{

@ -332,7 +332,7 @@ class Extractor extends Regex
}
$needle = $this->extractURLWithoutProtocol() ? '.' : ':';
if (!str_contains($tweet, $needle)) {
if (! str_contains($tweet, $needle)) {
return [];
}
@ -525,7 +525,6 @@ class Extractor extends Regex
* This returns a new array with no overlapping entities.
*
* @param array $entities
* @return array
*/
public function removeOverlappingEntities($entities): array
{
@ -546,10 +545,6 @@ class Extractor extends Regex
/**
* sort by entity start index.
*
* @param array $a
* @param array $b
* @return int
*/
protected function sortEntites(array $a, array $b): int
{

@ -114,7 +114,7 @@ class HitHighlighter extends Regex
$highlightTweet = '';
$tags = ['<'.$this->tag.'>', '</'.$this->tag.'>'];
// Check whether we can simply replace or whether we need to chunk...
if (!str_contains($tweet, '<')) {
if (! str_contains($tweet, '<')) {
$ti = 0; // tag increment (for added tags)
$highlightTweet = $tweet;
foreach ($hits as $hit) {

@ -24,7 +24,6 @@ class StringUtils
* @param int $start
* @param int $length
* @param string $encoding
* @return string
*/
public static function substr($str, $start, $length = null, $encoding = 'UTF-8'): string
{
@ -41,7 +40,6 @@ class StringUtils
*
* @param string $str
* @param string $encoding
* @return int
*/
public static function strlen($str, $encoding = 'UTF-8'): int
{

@ -385,6 +385,7 @@ class Validator extends Regex
if (! $optional) {
return ($string || $string === '') && $found && $matches[0] === $string;
}
return ! (($string || $string === '') && (! $found || $matches[0] !== $string));
}
}

Loading…
Cancel
Save