diff options
author | John Preston <johnprestonmail@gmail.com> | 2024-07-01 21:35:28 +0400 |
---|---|---|
committer | John Preston <johnprestonmail@gmail.com> | 2024-07-01 21:35:39 +0400 |
commit | f75429cbaa29fced007fabd2facc8541470fb40d (patch) | |
tree | 34c1d5c680dc4d3ebe33524ff64f62398094fb98 | |
parent | dc8c4a8332482bf6682dd601ac3b5a02e16c7285 (diff) |
Version 5.2.1: Shorten webview socket path.v5.2.1
Fixes #28106.
-rw-r--r-- | Telegram/SourceFiles/platform/linux/specific_linux.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 474f47746a..6d8a8ec54d 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "platform/linux/specific_linux.h" +#include "base/openssl_help.h" #include "base/random.h" #include "base/platform/base_platform_info.h" #include "base/platform/linux/base_linux_dbus_utilities.h" @@ -480,6 +481,16 @@ void InstallLauncher() { }); } +[[nodiscard]] QByteArray HashForSocketPath(const QByteArray &data) { + constexpr auto kHashForSocketPathLength = 24; + + const auto binary = openssl::Sha256(bytes::make_span(data)); + const auto base64 = QByteArray( + reinterpret_cast<const char*>(binary.data()), + binary.size()).toBase64(QByteArray::Base64UrlEncoding); + return base64.mid(0, kHashForSocketPathLength); +} + } // namespace namespace Platform { @@ -686,8 +697,8 @@ void start() { Webview::WebKitGTK::SetSocketPath(u"%1/%2-%3-webview-%4"_q.arg( QDir::tempPath(), - h, - QCoreApplication::applicationName(), + HashForSocketPath(d), + u"TD"_q,//QCoreApplication::applicationName(), - make path smaller. u"%1"_q).toStdString()); InstallLauncher(); |