mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Check more protocols while adding link (#28407)
This commit is contained in:
parent
b962d2b550
commit
187c2dda20
1 changed files with 10 additions and 5 deletions
|
@ -63,6 +63,12 @@ constexpr auto kParseLinksTimeout = crl::time(1000);
|
||||||
constexpr auto kTypesDuration = 4 * crl::time(1000);
|
constexpr auto kTypesDuration = 4 * crl::time(1000);
|
||||||
constexpr auto kCodeLanguageLimit = 32;
|
constexpr auto kCodeLanguageLimit = 32;
|
||||||
|
|
||||||
|
constexpr auto kLinkProtocols = {
|
||||||
|
"http://",
|
||||||
|
"https://",
|
||||||
|
"tonsite://"
|
||||||
|
};
|
||||||
|
|
||||||
// For mention / custom emoji tags save and validate selfId,
|
// For mention / custom emoji tags save and validate selfId,
|
||||||
// ignore tags for different users.
|
// ignore tags for different users.
|
||||||
[[nodiscard]] Fn<QString(QStringView)> FieldTagMimeProcessor(
|
[[nodiscard]] Fn<QString(QStringView)> FieldTagMimeProcessor(
|
||||||
|
@ -152,11 +158,10 @@ void EditLinkBox(
|
||||||
return startLink.trimmed();
|
return startLink.trimmed();
|
||||||
}
|
}
|
||||||
const auto clipboard = QGuiApplication::clipboard()->text().trimmed();
|
const auto clipboard = QGuiApplication::clipboard()->text().trimmed();
|
||||||
if (clipboard.startsWith("http://")
|
const auto starts = [&](const auto &protocol) {
|
||||||
|| clipboard.startsWith("https://")) {
|
return clipboard.startsWith(protocol);
|
||||||
return clipboard;
|
};
|
||||||
}
|
return std::ranges::any_of(kLinkProtocols, starts) ? clipboard : QString();
|
||||||
return QString();
|
|
||||||
}();
|
}();
|
||||||
const auto url = Ui::AttachParentChild(
|
const auto url = Ui::AttachParentChild(
|
||||||
content,
|
content,
|
||||||
|
|
Loading…
Add table
Reference in a new issue