about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/common/common/nix/default.nix8
-rw-r--r--modules/common/common/nix/patches/tdesktop-no-ads.patch45
2 files changed, 51 insertions, 2 deletions
diff --git a/modules/common/common/nix/default.nix b/modules/common/common/nix/default.nix
index 43586d3..29db931 100644
--- a/modules/common/common/nix/default.nix
+++ b/modules/common/common/nix/default.nix
@@ -95,8 +95,12 @@ with lib; {
             plugins = with kubernetes-helmPlugins; [helm-secrets];
           };
 
-        alejandra = super.alejandra.overrideAttrs (_: _: {
-          patches = [./patches/alejandra-no-ads.patch];
+        alejandra = super.alejandra.overrideAttrs (_: final: {
+          patches = final.patches ++ [./patches/alejandra-no-ads.patch];
+        });
+
+        tdesktop = super.tdesktop.overrideAttrs (_: final: {
+          patches = final.patches ++ [./patches/tdesktop-no-ads.patch];
         });
 
         openmw = super.openmw.overrideAttrs (_: final: {
diff --git a/modules/common/common/nix/patches/tdesktop-no-ads.patch b/modules/common/common/nix/patches/tdesktop-no-ads.patch
new file mode 100644
index 0000000..d066066
--- /dev/null
+++ b/modules/common/common/nix/patches/tdesktop-no-ads.patch
@@ -0,0 +1,45 @@
+diff --git i/Telegram/SourceFiles/data/data_sponsored_messages.cpp w/Telegram/SourceFiles/data/data_sponsored_messages.cpp
+index fa21af469..263ea3e61 100644
+--- i/Telegram/SourceFiles/data/data_sponsored_messages.cpp
++++ w/Telegram/SourceFiles/data/data_sponsored_messages.cpp
+@@ -179,39 +179,7 @@ bool SponsoredMessages::canHaveFor(not_null<History*> history) const {
+ }
+ 
+ void SponsoredMessages::request(not_null<History*> history, Fn<void()> done) {
+-	if (!canHaveFor(history)) {
+-		return;
+-	}
+-	auto &request = _requests[history];
+-	if (request.requestId || TooEarlyForRequest(request.lastReceived)) {
+-		return;
+-	}
+-	{
+-		const auto it = _data.find(history);
+-		if (it != end(_data)) {
+-			auto &list = it->second;
+-			// Don't rebuild currently displayed messages.
+-			const auto proj = [](const Entry &e) {
+-				return e.item != nullptr;
+-			};
+-			if (ranges::any_of(list.entries, proj)) {
+-				return;
+-			}
+-		}
+-	}
+-	const auto channel = history->peer->asChannel();
+-	Assert(channel != nullptr);
+-	request.requestId = _session->api().request(
+-		MTPchannels_GetSponsoredMessages(
+-			channel->inputChannel)
+-	).done([=](const MTPmessages_sponsoredMessages &result) {
+-		parse(history, result);
+-		if (done) {
+-			done();
+-		}
+-	}).fail([=] {
+-		_requests.remove(history);
+-	}).send();
++	return;
+ }
+ 
+ void SponsoredMessages::parse(

Consider giving Nix/NixOS a try! <3