2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Add confirmation on first webview open.

This commit is contained in:
John Preston
2022-04-06 11:45:51 +04:00
parent 73c5988e7e
commit 646682b6a0
6 changed files with 101 additions and 13 deletions

View File

@@ -2797,6 +2797,31 @@ bool Account::isBotTrustedPayment(PeerId botId) {
&& ((i->second & BotTrustFlag::Payment) != 0);
}
void Account::markBotTrustedOpenWebView(PeerId botId) {
if (isBotTrustedOpenWebView(botId)) {
return;
}
const auto i = _trustedBots.find(botId);
if (i == end(_trustedBots)) {
_trustedBots.emplace(
botId,
BotTrustFlag::NoOpenGame | BotTrustFlag::OpenWebView);
} else {
i->second |= BotTrustFlag::OpenWebView;
}
writeTrustedBots();
}
bool Account::isBotTrustedOpenWebView(PeerId botId) {
if (!_trustedBotsRead) {
readTrustedBots();
_trustedBotsRead = true;
}
const auto i = _trustedBots.find(botId);
return (i != end(_trustedBots))
&& ((i->second & BotTrustFlag::OpenWebView) != 0);
}
bool Account::encrypt(
const void *src,
void *dst,