mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +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 kCodeLanguageLimit = 32;
|
||||
|
||||
constexpr auto kLinkProtocols = {
|
||||
"http://",
|
||||
"https://",
|
||||
"tonsite://"
|
||||
};
|
||||
|
||||
// For mention / custom emoji tags save and validate selfId,
|
||||
// ignore tags for different users.
|
||||
[[nodiscard]] Fn<QString(QStringView)> FieldTagMimeProcessor(
|
||||
|
@ -152,11 +158,10 @@ void EditLinkBox(
|
|||
return startLink.trimmed();
|
||||
}
|
||||
const auto clipboard = QGuiApplication::clipboard()->text().trimmed();
|
||||
if (clipboard.startsWith("http://")
|
||||
|| clipboard.startsWith("https://")) {
|
||||
return clipboard;
|
||||
}
|
||||
return QString();
|
||||
const auto starts = [&](const auto &protocol) {
|
||||
return clipboard.startsWith(protocol);
|
||||
};
|
||||
return std::ranges::any_of(kLinkProtocols, starts) ? clipboard : QString();
|
||||
}();
|
||||
const auto url = Ui::AttachParentChild(
|
||||
content,
|
||||
|
|
Loading…
Add table
Reference in a new issue