From 7f7e64406937cc64cef246e669688f792bfe95cb Mon Sep 17 00:00:00 2001 From: flashwave <me@flash.moe> Date: Sun, 9 Feb 2025 00:28:28 +0000 Subject: [PATCH] Fixed detections. --- VERSION | 2 +- public-legacy/profile.php | 4 ++-- src/Parsers/Parsers.php | 2 +- src/Users/Assets/AssetsRoutes.php | 9 ++------- src/Users/Assets/UserBackgroundAsset.php | 7 ------- 5 files changed, 6 insertions(+), 18 deletions(-) diff --git a/VERSION b/VERSION index 7442955b..f9d9d8c4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -20250207.1 +20250208 diff --git a/public-legacy/profile.php b/public-legacy/profile.php index 329e6c78..9a940d1d 100644 --- a/public-legacy/profile.php +++ b/public-legacy/profile.php @@ -78,7 +78,7 @@ $canEdit = !$viewingAsGuest && ((!$isBanned && $viewingOwnProfile) || $viewerInf )); $avatarAsset = new UserAvatarAsset($userInfo); $backgroundInfo = $msz->profileCtx->backgrounds->getProfileBackground($userInfo); -$backgroundAsset = new UserBackgroundAsset($userInfo, $backgroundInfo); +$backgroundAsset = new UserBackgroundAsset($userInfo); $aboutInfo = $msz->profileCtx->about->getProfileAbout($userInfo); $sigInfo = $msz->forumCtx->signatures->getSignature($userInfo); @@ -298,7 +298,7 @@ if($isEditing) { } } - $backgroundAsset = new UserBackgroundAsset($userInfo, $backgroundInfo); + $backgroundAsset = new UserBackgroundAsset($userInfo); } } diff --git a/src/Parsers/Parsers.php b/src/Parsers/Parsers.php index c0d4498e..c9952601 100644 --- a/src/Parsers/Parsers.php +++ b/src/Parsers/Parsers.php @@ -2,7 +2,7 @@ namespace Misuzu\Parsers; final class Parsers { - /** @var array<int, ParserInterface> */ + /** @var array<''|'bb'|'md', ParserInterface> */ private static array $instances = []; public static function instance(TextFormat|string $format): ParserInterface { diff --git a/src/Users/Assets/AssetsRoutes.php b/src/Users/Assets/AssetsRoutes.php index f3292abe..4982e17b 100644 --- a/src/Users/Assets/AssetsRoutes.php +++ b/src/Users/Assets/AssetsRoutes.php @@ -8,7 +8,6 @@ use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerCommon}; use Index\Urls\{UrlFormat,UrlRegistry,UrlSource,UrlSourceCommon}; use Misuzu\Perm; use Misuzu\Auth\AuthInfo; -use Misuzu\Profile\ProfileContext; use Misuzu\Users\{UsersContext,UserInfo}; class AssetsRoutes implements RouteHandler, UrlSource { @@ -17,8 +16,7 @@ class AssetsRoutes implements RouteHandler, UrlSource { public function __construct( private AuthInfo $authInfo, private UrlRegistry $urls, - private UsersContext $usersCtx, - private ProfileContext $profileCtx + private UsersContext $usersCtx ) {} private function canViewAsset(HttpRequest $request, UserInfo $assetUser): bool { @@ -65,10 +63,7 @@ class AssetsRoutes implements RouteHandler, UrlSource { } catch(InvalidArgumentException $ex) {} if(!empty($userInfo)) { - $userAssetInfo = new UserBackgroundAsset( - $userInfo, - $this->profileCtx->backgrounds->getProfileBackground($userInfo) - ); + $userAssetInfo = new UserBackgroundAsset($userInfo); if($userAssetInfo->isPresent() && $this->canViewAsset($request, $userInfo)) $assetInfo = $userAssetInfo; } diff --git a/src/Users/Assets/UserBackgroundAsset.php b/src/Users/Assets/UserBackgroundAsset.php index 1aba37fb..055e960a 100644 --- a/src/Users/Assets/UserBackgroundAsset.php +++ b/src/Users/Assets/UserBackgroundAsset.php @@ -11,13 +11,6 @@ class UserBackgroundAsset extends UserImageAsset { private const MAX_HEIGHT = 2160; private const MAX_BYTES = 1500000; - public function __construct( - UserInfo $userInfo, - private ?ProfileBackgroundInfo $bgInfo - ) { - parent::__construct($userInfo); - } - public function getMaxWidth(): int { global $cfg; return $cfg->getInteger('background.max_width', self::MAX_WIDTH);