Fixed detections.

This commit is contained in:
flash 2025-02-09 00:28:28 +00:00
parent f39e1230c5
commit 7f7e644069
5 changed files with 6 additions and 18 deletions

View file

@ -1 +1 @@
20250207.1 20250208

View file

@ -78,7 +78,7 @@ $canEdit = !$viewingAsGuest && ((!$isBanned && $viewingOwnProfile) || $viewerInf
)); ));
$avatarAsset = new UserAvatarAsset($userInfo); $avatarAsset = new UserAvatarAsset($userInfo);
$backgroundInfo = $msz->profileCtx->backgrounds->getProfileBackground($userInfo); $backgroundInfo = $msz->profileCtx->backgrounds->getProfileBackground($userInfo);
$backgroundAsset = new UserBackgroundAsset($userInfo, $backgroundInfo); $backgroundAsset = new UserBackgroundAsset($userInfo);
$aboutInfo = $msz->profileCtx->about->getProfileAbout($userInfo); $aboutInfo = $msz->profileCtx->about->getProfileAbout($userInfo);
$sigInfo = $msz->forumCtx->signatures->getSignature($userInfo); $sigInfo = $msz->forumCtx->signatures->getSignature($userInfo);
@ -298,7 +298,7 @@ if($isEditing) {
} }
} }
$backgroundAsset = new UserBackgroundAsset($userInfo, $backgroundInfo); $backgroundAsset = new UserBackgroundAsset($userInfo);
} }
} }

View file

@ -2,7 +2,7 @@
namespace Misuzu\Parsers; namespace Misuzu\Parsers;
final class Parsers { final class Parsers {
/** @var array<int, ParserInterface> */ /** @var array<''|'bb'|'md', ParserInterface> */
private static array $instances = []; private static array $instances = [];
public static function instance(TextFormat|string $format): ParserInterface { public static function instance(TextFormat|string $format): ParserInterface {

View file

@ -8,7 +8,6 @@ use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerCommon};
use Index\Urls\{UrlFormat,UrlRegistry,UrlSource,UrlSourceCommon}; use Index\Urls\{UrlFormat,UrlRegistry,UrlSource,UrlSourceCommon};
use Misuzu\Perm; use Misuzu\Perm;
use Misuzu\Auth\AuthInfo; use Misuzu\Auth\AuthInfo;
use Misuzu\Profile\ProfileContext;
use Misuzu\Users\{UsersContext,UserInfo}; use Misuzu\Users\{UsersContext,UserInfo};
class AssetsRoutes implements RouteHandler, UrlSource { class AssetsRoutes implements RouteHandler, UrlSource {
@ -17,8 +16,7 @@ class AssetsRoutes implements RouteHandler, UrlSource {
public function __construct( public function __construct(
private AuthInfo $authInfo, private AuthInfo $authInfo,
private UrlRegistry $urls, private UrlRegistry $urls,
private UsersContext $usersCtx, private UsersContext $usersCtx
private ProfileContext $profileCtx
) {} ) {}
private function canViewAsset(HttpRequest $request, UserInfo $assetUser): bool { private function canViewAsset(HttpRequest $request, UserInfo $assetUser): bool {
@ -65,10 +63,7 @@ class AssetsRoutes implements RouteHandler, UrlSource {
} catch(InvalidArgumentException $ex) {} } catch(InvalidArgumentException $ex) {}
if(!empty($userInfo)) { if(!empty($userInfo)) {
$userAssetInfo = new UserBackgroundAsset( $userAssetInfo = new UserBackgroundAsset($userInfo);
$userInfo,
$this->profileCtx->backgrounds->getProfileBackground($userInfo)
);
if($userAssetInfo->isPresent() && $this->canViewAsset($request, $userInfo)) if($userAssetInfo->isPresent() && $this->canViewAsset($request, $userInfo))
$assetInfo = $userAssetInfo; $assetInfo = $userAssetInfo;
} }

View file

@ -11,13 +11,6 @@ class UserBackgroundAsset extends UserImageAsset {
private const MAX_HEIGHT = 2160; private const MAX_HEIGHT = 2160;
private const MAX_BYTES = 1500000; private const MAX_BYTES = 1500000;
public function __construct(
UserInfo $userInfo,
private ?ProfileBackgroundInfo $bgInfo
) {
parent::__construct($userInfo);
}
public function getMaxWidth(): int { public function getMaxWidth(): int {
global $cfg; global $cfg;
return $cfg->getInteger('background.max_width', self::MAX_WIDTH); return $cfg->getInteger('background.max_width', self::MAX_WIDTH);