testmatrix 0.0.9__tar.gz → 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {testmatrix-0.0.9/testmatrix.egg-info → testmatrix-0.1.0}/PKG-INFO +2 -2
- {testmatrix-0.0.9 → testmatrix-0.1.0}/README.md +1 -1
- {testmatrix-0.0.9 → testmatrix-0.1.0}/src/testmatrix/__init__.py +1 -1
- {testmatrix-0.0.9 → testmatrix-0.1.0}/src/testmatrix/matrixserver.py +19 -4
- {testmatrix-0.0.9 → testmatrix-0.1.0/testmatrix.egg-info}/PKG-INFO +2 -2
- {testmatrix-0.0.9 → testmatrix-0.1.0}/LICENSE +0 -0
- {testmatrix-0.0.9 → testmatrix-0.1.0}/pyproject.toml +0 -0
- {testmatrix-0.0.9 → testmatrix-0.1.0}/setup.cfg +0 -0
- {testmatrix-0.0.9 → testmatrix-0.1.0}/src/testmatrix/jwtauth.py +0 -0
- {testmatrix-0.0.9 → testmatrix-0.1.0}/src/testmatrix/utils.py +0 -0
- {testmatrix-0.0.9 → testmatrix-0.1.0}/test_matrix.py +0 -0
- {testmatrix-0.0.9 → testmatrix-0.1.0}/testmatrix.egg-info/SOURCES.txt +0 -0
- {testmatrix-0.0.9 → testmatrix-0.1.0}/testmatrix.egg-info/dependency_links.txt +0 -0
- {testmatrix-0.0.9 → testmatrix-0.1.0}/testmatrix.egg-info/entry_points.txt +0 -0
- {testmatrix-0.0.9 → testmatrix-0.1.0}/testmatrix.egg-info/requires.txt +0 -0
- {testmatrix-0.0.9 → testmatrix-0.1.0}/testmatrix.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: testmatrix
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: A matrix server sanity tester
|
|
5
5
|
Author-email: Sebastian Spaeth <Sebastian@SSpaeth.de>
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -17,7 +17,7 @@ License-File: LICENSE
|
|
|
17
17
|
Requires-Dist: requests
|
|
18
18
|
Dynamic: license-file
|
|
19
19
|
|
|
20
|
-
# testmatrix
|
|
20
|
+
# testmatrix [](https://badge.fury.io/py/testmatrix) 
|
|
21
21
|
|
|
22
22
|
A matrix server sanity tester. Relased under the GNU AGPLv3+.
|
|
23
23
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# testmatrix
|
|
1
|
+
# testmatrix [](https://badge.fury.io/py/testmatrix) 
|
|
2
2
|
|
|
3
3
|
A matrix server sanity tester. Relased under the GNU AGPLv3+.
|
|
4
4
|
|
|
@@ -37,7 +37,7 @@ class MatrixServer:
|
|
|
37
37
|
about results of our sanity checks.
|
|
38
38
|
"""
|
|
39
39
|
self.args = args
|
|
40
|
-
self.servername: str = servername
|
|
40
|
+
self.servername: str = servername.lower()
|
|
41
41
|
self.federation_baseurl: str = ""
|
|
42
42
|
self.client_baseurl: str = ""
|
|
43
43
|
# result of client/versions as dict
|
|
@@ -147,16 +147,31 @@ class MatrixServer:
|
|
|
147
147
|
self.client_baseurl = ""
|
|
148
148
|
try:
|
|
149
149
|
url = f"https://{self.servername}/.well-known/matrix/client"
|
|
150
|
+
# The .well-known file could sit behind redirects, and we need to
|
|
151
|
+
# manually check the CORS headers for each redirect step. Standard
|
|
152
|
+
# requests does not do this, so we need to do that manually. Sigh.
|
|
153
|
+
# TODO: a candidate for factoring out.
|
|
150
154
|
r = requests.get(url, headers = req_headers)
|
|
151
|
-
r.raise_for_status() # raise
|
|
155
|
+
r.raise_for_status() # raise on status 400-600
|
|
152
156
|
if self.diagnostics:
|
|
157
|
+
i = 0
|
|
158
|
+
for redirect in r.history:
|
|
159
|
+
i += 1
|
|
160
|
+
if not "Access-Control-Allow-Origin" in redirect.headers:
|
|
161
|
+
logging.error("𐄂 Client well-known redirect #{i} has no CORS header")
|
|
162
|
+
elif redirect.headers["Access-Control-Allow-Origin"] != "*":
|
|
163
|
+
logging.error("𐄂 Client well-known redirect #{i} has no proper CORS header: '%s'",
|
|
164
|
+
redirect.headers["Access-Control-Allow-Origin"])
|
|
165
|
+
else:
|
|
166
|
+
logging.info("✔ Client well-known redirect #{i} has proper CORS header")
|
|
153
167
|
if not "Access-Control-Allow-Origin" in r.headers:
|
|
154
168
|
logging.error("𐄂 Client well-known has no CORS header")
|
|
155
169
|
elif r.headers["Access-Control-Allow-Origin"] != "*":
|
|
156
170
|
logging.error("𐄂 Client well-known has no proper CORS header: '%s'",
|
|
157
171
|
r.headers["Access-Control-Allow-Origin"])
|
|
158
172
|
else:
|
|
159
|
-
logging.info("✔ Client well-known
|
|
173
|
+
logging.info("✔ Client well-known has proper CORS header")
|
|
174
|
+
|
|
160
175
|
wellknown_client = r.json()
|
|
161
176
|
except requests.exceptions.ConnectionError as e:
|
|
162
177
|
if ("[Errno 11001] getaddrinfo failed" in str(e) or # Windows
|
|
@@ -251,7 +266,7 @@ class MatrixServer:
|
|
|
251
266
|
logging.error("𐄂 Server keys response is no valid json")
|
|
252
267
|
return False
|
|
253
268
|
|
|
254
|
-
server_key_name = server_keys.get("server_name",
|
|
269
|
+
server_key_name = server_keys.get("server_name", "").lower()
|
|
255
270
|
if self.servername != server_key_name:
|
|
256
271
|
if self.diagnostics:
|
|
257
272
|
logging.error("𐄂 Configured server name mismatch! "\
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: testmatrix
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: A matrix server sanity tester
|
|
5
5
|
Author-email: Sebastian Spaeth <Sebastian@SSpaeth.de>
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -17,7 +17,7 @@ License-File: LICENSE
|
|
|
17
17
|
Requires-Dist: requests
|
|
18
18
|
Dynamic: license-file
|
|
19
19
|
|
|
20
|
-
# testmatrix
|
|
20
|
+
# testmatrix [](https://badge.fury.io/py/testmatrix) 
|
|
21
21
|
|
|
22
22
|
A matrix server sanity tester. Relased under the GNU AGPLv3+.
|
|
23
23
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|