diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp
index 3d839958f6..71d1e38125 100644
--- a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp
+++ b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp
@@ -95,6 +95,18 @@ struct NativeMessage {
return u"https://web.telegram.org:443/blank.html"_q;
}
+// Loaded locally with ExternalShellTopUrl() as the base URI, so that
+// the shell document gets the web.telegram.org origin (required by
+// Mini Apps frame-ancestors) without any network requests, that may
+// fail in case web.telegram.org is not accessible from the network.
+[[nodiscard]] QString ExternalShellTopHtml() {
+ return u"
"_q;
+}
+
+void NavigateToExternalShellTop(not_null window) {
+ window->loadHtml(ExternalShellTopHtml(), ExternalShellTopUrl());
+}
+
[[nodiscard]] TextWithEntities WebviewErrorText(
const QString &text,
const Webview::Available &information) {
@@ -1564,7 +1576,7 @@ bool Panel::showWebview(Args &&args, const Webview::ThemeParams ¶ms) {
const auto url = args.url;
if (_externalShell) {
_externalShellBootstrapped = false;
- _webview->window.navigate(ExternalShellTopUrl());
+ NavigateToExternalShellTop(&_webview->window);
} else {
_webview->window.navigate(url);
_widget->setBackAllowed(allowBack);
@@ -1904,7 +1916,7 @@ void Panel::handleExternalShellMenuAction(const QString &id) {
}
showWebviewProgress();
updateThemeParams(params);
- _webview->window.navigate(ExternalShellTopUrl());
+ NavigateToExternalShellTop(&_webview->window);
}
},
.terms = [=] {
diff --git a/Telegram/lib_webview b/Telegram/lib_webview
index da983122e8..73b541e968 160000
--- a/Telegram/lib_webview
+++ b/Telegram/lib_webview
@@ -1 +1 @@
-Subproject commit da983122e89310e19ac9f9bf2b66dfb659c0d07a
+Subproject commit 73b541e9682fa0cf952c0bb9f42121c0ac0a11bc