feat: bypass client-side restrictions & minor adjustments

This commit is contained in:
AlexeyZavar 2025-02-04 16:11:52 +03:00
parent 292de83c35
commit 53392d6e5d
3 changed files with 5 additions and 35 deletions

View file

@ -1284,7 +1284,7 @@ void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout*> container) {
updateLabel(settings->recentStickersCount);
slider->setPseudoDiscrete(
100 + 1,
200 + 1,
// thx tg
[=](int amount)
{

View file

@ -92,49 +92,19 @@ UnavailableReason UnavailableReason::Sensitive() {
QString UnavailableReason::Compute(
not_null<Main::Session*> session,
const std::vector<UnavailableReason> &list) {
const auto &skip = IgnoredReasons(session);
auto &&filtered = ranges::views::all(
list
) | ranges::views::filter([&](const Data::UnavailableReason &reason) {
return !reason.sensitive()
&& !ranges::contains(skip, reason.reason);
});
const auto first = filtered.begin();
return (first != filtered.end()) ? first->text : QString();
return {};
}
bool UnavailableReason::IgnoreSensitiveMark(
not_null<Main::Session*> session) {
return ranges::contains(
IgnoredReasons(session),
UnavailableReason::Sensitive().reason);
return true;
}
// We should get a full restriction in "{full}: {reason}" format and we
// need to find an "-all" tag in {full}, otherwise ignore this restriction.
std::vector<UnavailableReason> UnavailableReason::Extract(
const MTPvector<MTPRestrictionReason> *list) {
if (!list) {
return {};
}
return ranges::views::all(
list->v
) | ranges::views::filter([](const MTPRestrictionReason &restriction) {
return restriction.match([&](const MTPDrestrictionReason &data) {
const auto platform = data.vplatform().v;
return false
#ifdef OS_MAC_STORE
|| (platform == "ios"_q)
#elif defined OS_WIN_STORE // OS_MAC_STORE
|| (platform == "ms"_q)
#endif // OS_MAC_STORE || OS_WIN_STORE
|| (platform == "all"_q);
});
}) | ranges::views::transform([](const MTPRestrictionReason &restriction) {
return restriction.match([&](const MTPDrestrictionReason &data) {
return UnavailableReason{ qs(data.vreason()), qs(data.vtext()) };
});
}) | ranges::to_vector;
return {};
}
bool ApplyBotMenuButton(

View file

@ -172,7 +172,7 @@ maxMediaSize: 430px;
maxStickerSize: 224px;
maxAnimatedEmojiSize: 112px;
maxGifSize: 320px;
maxVideoMessageSize: 320px;
maxVideoMessageSize: 360px;
maxSignatureSize: 144px;
maxWallPaperWidth: 160px;
maxWallPaperHeight: 240px;