mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-06 03:42:56 +00:00
Fix webapps on Linux without access to web.telegram.org.
This commit is contained in:
@@ -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"<!DOCTYPE html><html><head></head><body></body></html>"_q;
|
||||
}
|
||||
|
||||
void NavigateToExternalShellTop(not_null<Webview::Window*> 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 = [=] {
|
||||
|
||||
+1
-1
Submodule Telegram/lib_webview updated: da983122e8...73b541e968
Reference in New Issue
Block a user