matlab-proxy 0.15.0__py3-none-any.whl → 0.16.0__py3-none-any.whl
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.
Potentially problematic release.
This version of matlab-proxy might be problematic. Click here for more details.
- matlab_proxy/app.py +13 -7
- matlab_proxy/app_state.py +9 -6
- matlab_proxy/constants.py +1 -0
- matlab_proxy/gui/asset-manifest.json +3 -3
- matlab_proxy/gui/index.html +1 -1
- matlab_proxy/gui/static/js/{main.14aa7840.js → main.522d83ba.js} +3 -3
- matlab_proxy/gui/static/js/main.522d83ba.js.map +1 -0
- matlab_proxy/settings.py +7 -4
- matlab_proxy/util/__init__.py +8 -1
- matlab_proxy/util/mwi/token_auth.py +19 -5
- {matlab_proxy-0.15.0.dist-info → matlab_proxy-0.16.0.dist-info}/METADATA +1 -1
- {matlab_proxy-0.15.0.dist-info → matlab_proxy-0.16.0.dist-info}/RECORD +40 -20
- tests/integration/integration_tests_with_license/test_http_end_points.py +4 -4
- tests/integration/integration_tests_without_license/conftest.py +4 -3
- tests/integration/integration_tests_without_license/test_matlab_is_down_if_unlicensed.py +3 -0
- tests/unit/__init__.py +1 -0
- tests/unit/conftest.py +67 -0
- tests/unit/test_app.py +1113 -0
- tests/unit/test_app_state.py +586 -0
- tests/unit/test_constants.py +6 -0
- tests/unit/test_ddux.py +22 -0
- tests/unit/test_devel.py +246 -0
- tests/unit/test_non_dev_mode.py +169 -0
- tests/unit/test_settings.py +460 -0
- tests/unit/util/__init__.py +3 -0
- tests/unit/util/mwi/__init__.py +1 -0
- tests/unit/util/mwi/embedded_connector/__init__.py +1 -0
- tests/unit/util/mwi/embedded_connector/test_helpers.py +29 -0
- tests/unit/util/mwi/embedded_connector/test_request.py +64 -0
- tests/unit/util/mwi/test_custom_http_headers.py +281 -0
- tests/unit/util/mwi/test_logger.py +49 -0
- tests/unit/util/mwi/test_token_auth.py +303 -0
- tests/unit/util/mwi/test_validators.py +331 -0
- tests/unit/util/test_mw.py +550 -0
- tests/unit/util/test_util.py +135 -0
- matlab_proxy/gui/static/js/main.14aa7840.js.map +0 -1
- /matlab_proxy/gui/static/js/{main.14aa7840.js.LICENSE.txt → main.522d83ba.js.LICENSE.txt} +0 -0
- {matlab_proxy-0.15.0.dist-info → matlab_proxy-0.16.0.dist-info}/LICENSE.md +0 -0
- {matlab_proxy-0.15.0.dist-info → matlab_proxy-0.16.0.dist-info}/WHEEL +0 -0
- {matlab_proxy-0.15.0.dist-info → matlab_proxy-0.16.0.dist-info}/entry_points.txt +0 -0
- {matlab_proxy-0.15.0.dist-info → matlab_proxy-0.16.0.dist-info}/top_level.txt +0 -0
matlab_proxy/app.py
CHANGED
|
@@ -4,6 +4,7 @@ import asyncio
|
|
|
4
4
|
import json
|
|
5
5
|
import mimetypes
|
|
6
6
|
import pkgutil
|
|
7
|
+
import secrets
|
|
7
8
|
import sys
|
|
8
9
|
import uuid
|
|
9
10
|
|
|
@@ -795,6 +796,18 @@ def configure_and_start(app):
|
|
|
795
796
|
|
|
796
797
|
web_logger = None if not mwi_env.is_web_logging_enabled() else logger
|
|
797
798
|
|
|
799
|
+
# Setup the session storage,
|
|
800
|
+
# Uniqified per session to prevent multiple proxy servers on the same FQDN from interfering with each other.
|
|
801
|
+
uniqify_session_cookie = secrets.token_hex()
|
|
802
|
+
fernet_key = fernet.Fernet.generate_key()
|
|
803
|
+
f = fernet.Fernet(fernet_key)
|
|
804
|
+
aiohttp_session_setup(
|
|
805
|
+
app,
|
|
806
|
+
EncryptedCookieStorage(
|
|
807
|
+
f, cookie_name="matlab-proxy-session-" + uniqify_session_cookie
|
|
808
|
+
),
|
|
809
|
+
)
|
|
810
|
+
|
|
798
811
|
# Setup runner
|
|
799
812
|
runner = web.AppRunner(app, logger=web_logger, access_log=web_logger)
|
|
800
813
|
loop.run_until_complete(runner.setup())
|
|
@@ -870,13 +883,6 @@ def create_app(config_name=matlab_proxy.get_default_config_name()):
|
|
|
870
883
|
app.router.add_route("*", f"{base_url}/{{proxyPath:.*}}", matlab_view)
|
|
871
884
|
app.on_cleanup.append(cleanup_background_tasks)
|
|
872
885
|
|
|
873
|
-
# Setup the session storage
|
|
874
|
-
fernet_key = fernet.Fernet.generate_key()
|
|
875
|
-
f = fernet.Fernet(fernet_key)
|
|
876
|
-
aiohttp_session_setup(
|
|
877
|
-
app, EncryptedCookieStorage(f, cookie_name="matlab-proxy-session")
|
|
878
|
-
)
|
|
879
|
-
|
|
880
886
|
return app
|
|
881
887
|
|
|
882
888
|
|
matlab_proxy/app_state.py
CHANGED
|
@@ -11,13 +11,13 @@ from datetime import datetime, timedelta, timezone
|
|
|
11
11
|
from typing import Final, Optional
|
|
12
12
|
|
|
13
13
|
from matlab_proxy import util
|
|
14
|
-
from matlab_proxy.settings import (
|
|
15
|
-
get_process_startup_timeout,
|
|
16
|
-
)
|
|
17
14
|
from matlab_proxy.constants import (
|
|
18
15
|
CONNECTOR_SECUREPORT_FILENAME,
|
|
19
16
|
MATLAB_LOGS_FILE_NAME,
|
|
20
17
|
)
|
|
18
|
+
from matlab_proxy.settings import (
|
|
19
|
+
get_process_startup_timeout,
|
|
20
|
+
)
|
|
21
21
|
from matlab_proxy.util import mw, mwi, system, windows
|
|
22
22
|
from matlab_proxy.util.mwi import environment_variables as mwi_env
|
|
23
23
|
from matlab_proxy.util.mwi import token_auth
|
|
@@ -28,12 +28,11 @@ from matlab_proxy.util.mwi.exceptions import (
|
|
|
28
28
|
LicensingError,
|
|
29
29
|
MatlabError,
|
|
30
30
|
OnlineLicensingError,
|
|
31
|
-
XvfbError,
|
|
32
31
|
UIVisibleFatalError,
|
|
32
|
+
XvfbError,
|
|
33
33
|
log_error,
|
|
34
34
|
)
|
|
35
35
|
|
|
36
|
-
|
|
37
36
|
logger = mwi.logger.get()
|
|
38
37
|
|
|
39
38
|
|
|
@@ -314,7 +313,11 @@ class AppState:
|
|
|
314
313
|
[Dict | None]: Returns token authentication headers if any.
|
|
315
314
|
"""
|
|
316
315
|
return (
|
|
317
|
-
{
|
|
316
|
+
{
|
|
317
|
+
self.settings["mwi_auth_token_name_for_http"]: self.settings[
|
|
318
|
+
"mwi_auth_token_hash"
|
|
319
|
+
]
|
|
320
|
+
}
|
|
318
321
|
if self.settings["mwi_is_token_auth_enabled"]
|
|
319
322
|
else None
|
|
320
323
|
)
|
matlab_proxy/constants.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.css": "./static/css/main.47712126.css",
|
|
4
|
-
"main.js": "./static/js/main.
|
|
4
|
+
"main.js": "./static/js/main.522d83ba.js",
|
|
5
5
|
"static/media/mathworks-pictograms.svg?20181009": "./static/media/mathworks-pictograms.f6f087b008b5a9435f26.svg",
|
|
6
6
|
"static/media/MATLAB-env-blur.png": "./static/media/MATLAB-env-blur.4fc94edbc82d3184e5cb.png",
|
|
7
7
|
"static/media/mathworks.svg?20181004": "./static/media/mathworks.80a3218e1ba29f0573fb.svg",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"static/media/gripper.svg": "./static/media/gripper.9defbc5e76d0de8bb6e0.svg",
|
|
36
36
|
"static/media/arrow.svg": "./static/media/arrow.0c2968b90bd9a64c8c3f.svg",
|
|
37
37
|
"main.47712126.css.map": "./static/css/main.47712126.css.map",
|
|
38
|
-
"main.
|
|
38
|
+
"main.522d83ba.js.map": "./static/js/main.522d83ba.js.map"
|
|
39
39
|
},
|
|
40
40
|
"entrypoints": [
|
|
41
41
|
"static/css/main.47712126.css",
|
|
42
|
-
"static/js/main.
|
|
42
|
+
"static/js/main.522d83ba.js"
|
|
43
43
|
]
|
|
44
44
|
}
|
matlab_proxy/gui/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="MATLAB"/><meta name="internal_mw_identifier" content="MWI_MATLAB_PROXY_IDENTIFIER"/><link rel="manifest" href="./manifest.json"/><title>MATLAB</title><script defer="defer" src="./static/js/main.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="MATLAB"/><meta name="internal_mw_identifier" content="MWI_MATLAB_PROXY_IDENTIFIER"/><link rel="manifest" href="./manifest.json"/><title>MATLAB</title><script defer="defer" src="./static/js/main.522d83ba.js"></script><link href="./static/css/main.47712126.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|