This commit is contained in:
Charlotte 🦝 Delenk 2023-08-09 10:43:24 +01:00
parent bb06b315dd
commit aa14dd4d0f
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
6 changed files with 33 additions and 49 deletions

View file

@ -1,10 +1,10 @@
{ {
"url": "https://akkoma.dev/AkkomaGang/akkoma.git", "url": "https://akkoma.dev/AkkomaGang/akkoma.git",
"rev": "59af68c60014e87cbd46c5aa798065adfeb6c8f0", "rev": "e7788f3c827c9d13a680eef98b3127294dd9f614",
"date": "2023-08-05T14:11:27+01:00", "date": "2023-08-08T22:42:57+01:00",
"path": "/nix/store/idk900v8jhrdimpinc9filn5xamps3hs-akkoma", "path": "/nix/store/60n3dqka0dj37k6iinz64dk4ln9hb39f-akkoma",
"sha256": "05fir3whsjksgcg5dmz99riic877fwm274g71hw99bzypab9a7aj", "sha256": "1dbn12c2h3rs1k3s978b5sj3izamm30vbrxbvjk91gw857ydj949",
"hash": "sha256-Uh2Vlrr+r5Q4DOeRIyp35yAWY07p11Yee3pKDfnI0RU=", "hash": "sha256-iSTZ/CmIv5Cm3KvntcGoVf04pC4LnaTHDDoPKJgIdrU=",
"fetchLFS": false, "fetchLFS": false,
"fetchSubmodules": false, "fetchSubmodules": false,
"deepClone": false, "deepClone": false,

View file

@ -259,11 +259,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1691309005, "lastModified": 1691568519,
"narHash": "sha256-am/1S8c+Uirq1OcZ+N9auuHvTL6cyeZsbZqTuVdFHzU=", "narHash": "sha256-8C0f+Z3QOKb5zcvDdfys/aHU85kAwsGpYlB9Dc5/4P8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4d0cb68e29ae0137c3d659edaa6baacf9a79f9ae", "rev": "73a383e05ad819ef777d9a79ea8cdb3c38ceba28",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -4,25 +4,11 @@
fetchFromGitHub, fetchFromGitHub,
}: let }: let
source = builtins.fromJSON (builtins.readFile ./source.json); source = builtins.fromJSON (builtins.readFile ./source.json);
python = python3.override {
packageOverrides = self: super: {
dask = super.dask.overridePythonAttrs (_: {
installCheckPhase = "true";
});
pyarrow = super.pyarrow.overridePythonAttrs (old: {
installCheckPhase = "true";
});
tifffile = super.tifffile.overridePythonAttrs (old: {
installCheckPhase = "true";
});
};
};
in in
python.pkgs.buildPythonPackage rec { python3.pkgs.buildPythonPackage rec {
pname = "mautrix-telegram"; pname = "mautrix-telegram";
version = source.date; version = source.date;
disabled = python.pythonOlder "3.8"; disabled = python3.pythonOlder "3.8";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "mautrix"; owner = "mautrix";
@ -37,14 +23,14 @@ in
--replace "asyncpg>=0.20,<0.27" "asyncpg>=0.20" --replace "asyncpg>=0.20,<0.27" "asyncpg>=0.20"
''; '';
propagatedBuildInputs = with python.pkgs; [ propagatedBuildInputs = with python3.pkgs; [
ruamel-yaml ruamel-yaml
python-magic python-magic
CommonMark CommonMark
aiohttp aiohttp
yarl yarl
(python.pkgs.callPackage ../../python/mautrix.nix {}) (python3.pkgs.callPackage ../../python/mautrix.nix {})
(python.pkgs.callPackage ../../python/tulir-telethon.nix {}) (python3.pkgs.callPackage ../../python/tulir-telethon.nix {})
asyncpg asyncpg
Mako Mako
# optional # optional
@ -72,7 +58,7 @@ in
description = "A Matrix-Telegram hybrid puppeting/relaybot bridge"; description = "A Matrix-Telegram hybrid puppeting/relaybot bridge";
license = licenses.agpl3Plus; license = licenses.agpl3Plus;
platforms = platforms.linux; platforms = platforms.linux;
broken = !(python.pkgs ? cryptg); broken = !(python3.pkgs ? cryptg);
}; };
passthru.updateScript = [ passthru.updateScript = [
../../scripts/update-git.sh ../../scripts/update-git.sh

View file

@ -1,8 +1,8 @@
diff --git a/mautrix_telegram/portal.py b/mautrix_telegram/portal.py diff --git a/mautrix_telegram/portal.py b/mautrix_telegram/portal.py
index 3b6a81e..c6277a7 100644 index 701b3eb..8a266bc 100644
--- a/mautrix_telegram/portal.py --- a/mautrix_telegram/portal.py
+++ b/mautrix_telegram/portal.py +++ b/mautrix_telegram/portal.py
@@ -1626,6 +1626,36 @@ class Portal(DBPortal, BasePortal): @@ -1822,6 +1822,35 @@ class Portal(DBPortal, BasePortal):
msgtype=content.msgtype, msgtype=content.msgtype,
) )
@ -34,36 +34,34 @@ index 3b6a81e..c6277a7 100644
+ for sticker in stickers.documents: + for sticker in stickers.documents:
+ if sticker.id == int(metadata["id"]): + if sticker.id == int(metadata["id"]):
+ return sticker + return sticker
+
+ +
async def _handle_matrix_file( async def _handle_matrix_file(
self, self,
sender: u.User, sender: u.User,
@@ -1646,6 +1676,7 @@ class Portal(DBPortal, BasePortal): @@ -1842,6 +1871,7 @@ class Portal(DBPortal, BasePortal):
w = h = None w = h = None
max_image_size = self.config["bridge.image_as_file_size"] * 1000**2 max_image_size = self.config["bridge.image_as_file_size"] * 1000**2
max_image_pixels = self.config["bridge.image_as_file_pixels"] max_image_pixels = self.config["bridge.image_as_file_pixels"]
+ media = None + media = None
attributes = []
if self.config["bridge.parallel_file_transfer"] and content.url: if self.config["bridge.parallel_file_transfer"] and content.url:
file_handle, file_size = await util.parallel_transfer_to_telegram( @@ -1863,7 +1893,13 @@ class Portal(DBPortal, BasePortal):
@@ -1666,7 +1697,14 @@ class Portal(DBPortal, BasePortal):
file = await self.main_intent.download_media(content.url) file = await self.main_intent.download_media(content.url)
if content.msgtype == MessageType.STICKER: if content.msgtype == MessageType.STICKER:
- if mime != "image/gif": - if mime == "image/gif":
+ tg_sticker = None + tg_sticker = None
+
+ if "net.maunium.telegram.sticker" in content.info: + if "net.maunium.telegram.sticker" in content.info:
+ tg_sticker = await self._find_telegram_sticker(client, content.info["net.maunium.telegram.sticker"]) + tg_sticker = await self._find_telegram_sticker(client, content.info["net.maunium.telegram.sticker"])
+ +
+ if tg_sticker is not None: + if tg_sticker is not None:
+ media = tg_sticker + media = tg_sticker
+ elif mime != "image/gif": + elif mime == "image/gif":
mime, file, w, h = util.convert_image( # Remove sticker description
file, source_mime=mime, target_type="webp" file_name = "sticker.gif"
) else:
@@ -1708,7 +1746,9 @@ class Portal(DBPortal, BasePortal): @@ -1911,7 +1947,9 @@ class Portal(DBPortal, BasePortal):
if "fi.mau.telegram.force_document" in content: if "fi.mau.telegram.force_document" in content:
force_document = bool(content["fi.mau.telegram.force_document"]) force_document = bool(content["fi.mau.telegram.force_document"])

View file

@ -1,10 +1,10 @@
{ {
"url": "https://github.com/mautrix/telegram", "url": "https://github.com/mautrix/telegram",
"rev": "f79ab283f3dca1a6d6f17d87c137a229e1f5718e", "rev": "1fb8a7a0a50a6cb9c8de2d6dee829c7df9aec076",
"date": "2023-08-03T20:37:01+03:00", "date": "2023-08-08T13:51:28-06:00",
"path": "/nix/store/npfz23j8mjx7ci4f7r64zijx5qhr0nwy-telegram", "path": "/nix/store/8jk8wf4qb4mq845c0y21z9g1c6fdvrjd-telegram",
"sha256": "0xcwbknkifylqgvpkp0cwsjwqq4fspy39j13bqgc9845c2askpcg", "sha256": "0490qc9yr6x8vk9l01izaah2yvidmznl92kyv5kniknq3dkngjf1",
"hash": "sha256-j92plWCFoMQeXiPINPzVjmDMpeYM3Hn3w9S7OO1cnHU=", "hash": "sha256-wclnZxvYzmhn2X6KRO2vLW4voFI/BkDT3Kib7BPDIBE=",
"fetchLFS": false, "fetchLFS": false,
"fetchSubmodules": false, "fetchSubmodules": false,
"deepClone": false, "deepClone": false,

View file

@ -1,6 +1,6 @@
{ {
"version": "1.20.1", "version": "1.20.1",
"build": 108, "build": 115,
"name": "paper-1.20.1-108.jar", "name": "paper-1.20.1-115.jar",
"sha256": "18b3510769ce92f35654595d88bc8ea08446949a707d3fefe8f332d975be5a12" "sha256": "edabd2b27588d189558630084438653d3e0aa650da6c4bae39ae6ff3f6de9eaa"
} }