From 27d4e75f5f3dcad27346fbb53ace10bbbc8b6d89 Mon Sep 17 00:00:00 2001 From: q Date: Mon, 23 Sep 2024 16:25:32 -0400 Subject: [PATCH] Adding support for redirecting authenticated media paths --- custommedia-blacklist.py | 2 +- custommedia-whitelist.py | 2 +- custommedia.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/custommedia-blacklist.py b/custommedia-blacklist.py index 5a126a4..1426b19 100755 --- a/custommedia-blacklist.py +++ b/custommedia-blacklist.py @@ -45,7 +45,7 @@ class MyServer: else: hsu = self.default_hs - hsp = hsu + mediatype + '/' + hs + '/' + mediaid + '?' + self.environ['QUERY_STRING'] + hsp = hsu + '/_matrix/media/v3/' + mediatype + '/' + hs + '/' + mediaid + '?' + self.environ['QUERY_STRING'] self.start_response('301 Moved Permanently', [('Location', hsp)]) return iter([]) diff --git a/custommedia-whitelist.py b/custommedia-whitelist.py index 172700b..011d4a6 100755 --- a/custommedia-whitelist.py +++ b/custommedia-whitelist.py @@ -44,7 +44,7 @@ class MyServer: else: hsu = self.default_hs - hsp = hsu + mediatype + '/' + hs + '/' + mediaid + '?' + self.environ['QUERY_STRING'] + hsp = hsu + '/_matrix/media/v3/' + mediatype + '/' + hs + '/' + mediaid + '?' + self.environ['QUERY_STRING'] self.start_response('301 Moved Permanently', [('Location', hsp)]) return iter([]) diff --git a/custommedia.py b/custommedia.py index dab0a03..c795ffc 100755 --- a/custommedia.py +++ b/custommedia.py @@ -38,7 +38,7 @@ class MyServer: except Exception as e: # I don't care to fix this properly, not my problem hsu = "https://matrix-client.matrix.org" - hsp = hsu + self.environ['PATH_INFO'] + '?' + self.environ['QUERY_STRING'] + hsp = hsu + '/_matrix/media/v3/' + mediatype + '/' + hs + '/' + mediaid + '?' + self.environ['QUERY_STRING'] self.start_response('301 Moved Permanently', [('Location', hsp)]) return iter([])