zrb 1.7.4__py3-none-any.whl → 1.8.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.
- zrb/__init__.py +2 -2
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.amber.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.blue.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.cyan.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.fuchsia.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.green.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.grey.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.indigo.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.jade.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.lime.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.orange.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.pink.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.pumpkin.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.purple.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.red.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.sand.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.slate.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.violet.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.yellow.min.css +3 -3
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.zinc.min.css +3 -3
- zrb/config.py +30 -0
- zrb/llm_config.py +2 -2
- zrb/runner/cli.py +2 -3
- zrb/runner/web_app.py +17 -14
- zrb/runner/web_auth_config.py +189 -0
- zrb/runner/web_route/docs_route.py +4 -2
- zrb/runner/web_route/error_page/serve_default_404.py +3 -3
- zrb/runner/web_route/error_page/show_error_page.py +2 -1
- zrb/runner/web_route/error_page/view.html +22 -39
- zrb/runner/web_route/home_page/home_page_route.py +5 -4
- zrb/runner/web_route/login_api_route.py +4 -4
- zrb/runner/web_route/login_page/login_page_route.py +11 -6
- zrb/runner/web_route/logout_api_route.py +4 -4
- zrb/runner/web_route/logout_page/logout_page_route.py +11 -6
- zrb/runner/web_route/node_page/group/show_group_page.py +2 -1
- zrb/runner/web_route/node_page/node_page_route.py +3 -3
- zrb/runner/web_route/node_page/task/show_task_page.py +2 -1
- zrb/runner/web_route/refresh_token_api_route.py +5 -5
- zrb/runner/web_route/static/global_template.html +6 -3
- zrb/runner/web_route/static/resources/pico-css/pico.amber.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.blue.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.cyan.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.fuchsia.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.green.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.grey.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.indigo.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.jade.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.lime.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.orange.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.pink.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.pumpkin.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.purple.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.red.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.sand.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.slate.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.violet.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.yellow.min.css +4 -0
- zrb/runner/web_route/static/resources/pico-css/pico.zinc.min.css +4 -0
- zrb/runner/web_route/static/static_route.py +3 -3
- zrb/runner/web_route/task_input_api_route.py +3 -3
- zrb/runner/web_route/task_session_api_route.py +4 -4
- zrb/runner/web_util/cookie.py +6 -6
- zrb/runner/web_util/token.py +18 -18
- zrb/runner/web_util/user.py +17 -15
- zrb/util/string/format.py +11 -14
- {zrb-1.7.4.dist-info → zrb-1.8.0.dist-info}/METADATA +1 -1
- {zrb-1.7.4.dist-info → zrb-1.8.0.dist-info}/RECORD +71 -53
- zrb/runner/web_config/config.py +0 -91
- zrb/runner/web_config/config_factory.py +0 -15
- zrb/runner/web_route/static/resources/pico.min.css +0 -4
- {zrb-1.7.4.dist-info → zrb-1.8.0.dist-info}/WHEEL +0 -0
- {zrb-1.7.4.dist-info → zrb-1.8.0.dist-info}/entry_points.txt +0 -0
zrb/runner/web_util/token.py
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
from datetime import datetime, timedelta, timezone
|
2
2
|
|
3
|
-
from zrb.runner.
|
3
|
+
from zrb.runner.web_auth_config import WebAuthConfig
|
4
4
|
from zrb.runner.web_schema.token import Token
|
5
5
|
from zrb.runner.web_util.user import get_user_by_credentials
|
6
6
|
|
7
7
|
|
8
8
|
def generate_tokens_by_credentials(
|
9
|
-
|
9
|
+
web_auth_config: WebAuthConfig, username: str, password: str
|
10
10
|
) -> Token | None:
|
11
|
-
if not
|
12
|
-
user =
|
11
|
+
if not web_auth_config.enable_auth:
|
12
|
+
user = web_auth_config.default_user
|
13
13
|
else:
|
14
|
-
user = get_user_by_credentials(
|
14
|
+
user = get_user_by_credentials(web_auth_config, username, password)
|
15
15
|
if user is None:
|
16
16
|
return None
|
17
|
-
access_token = _generate_access_token(
|
18
|
-
refresh_token = _generate_refresh_token(
|
17
|
+
access_token = _generate_access_token(web_auth_config, user.username)
|
18
|
+
refresh_token = _generate_refresh_token(web_auth_config, user.username)
|
19
19
|
return Token(
|
20
20
|
access_token=access_token, refresh_token=refresh_token, token_type="bearer"
|
21
21
|
)
|
22
22
|
|
23
23
|
|
24
|
-
def regenerate_tokens(
|
24
|
+
def regenerate_tokens(web_auth_config: WebAuthConfig, refresh_token: str) -> Token:
|
25
25
|
from fastapi import HTTPException
|
26
26
|
from jose import jwt
|
27
27
|
|
@@ -29,7 +29,7 @@ def regenerate_tokens(web_config: WebConfig, refresh_token: str) -> Token:
|
|
29
29
|
try:
|
30
30
|
payload = jwt.decode(
|
31
31
|
refresh_token,
|
32
|
-
|
32
|
+
web_auth_config.secret_key,
|
33
33
|
options={"require_exp": True, "require_sub": True},
|
34
34
|
)
|
35
35
|
except Exception:
|
@@ -39,12 +39,12 @@ def regenerate_tokens(web_config: WebConfig, refresh_token: str) -> Token:
|
|
39
39
|
username: str = payload.get("sub")
|
40
40
|
if username is None:
|
41
41
|
raise HTTPException(status_code=401, detail="Invalid refresh token")
|
42
|
-
user =
|
42
|
+
user = web_auth_config.find_user_by_username(username)
|
43
43
|
if user is None:
|
44
44
|
raise HTTPException(status_code=401, detail="User not found")
|
45
45
|
# Create new token
|
46
|
-
new_access_token = _generate_access_token(
|
47
|
-
new_refresh_token = _generate_refresh_token(
|
46
|
+
new_access_token = _generate_access_token(web_auth_config, username)
|
47
|
+
new_refresh_token = _generate_refresh_token(web_auth_config, username)
|
48
48
|
return Token(
|
49
49
|
access_token=new_access_token,
|
50
50
|
refresh_token=new_refresh_token,
|
@@ -52,21 +52,21 @@ def regenerate_tokens(web_config: WebConfig, refresh_token: str) -> Token:
|
|
52
52
|
)
|
53
53
|
|
54
54
|
|
55
|
-
def _generate_access_token(
|
55
|
+
def _generate_access_token(web_auth_config: WebAuthConfig, username: str) -> str:
|
56
56
|
from jose import jwt
|
57
57
|
|
58
58
|
expire = datetime.now(timezone.utc) + timedelta(
|
59
|
-
minutes=
|
59
|
+
minutes=web_auth_config.access_token_expire_minutes
|
60
60
|
)
|
61
61
|
to_encode = {"sub": username, "exp": expire, "type": "access"}
|
62
|
-
return jwt.encode(to_encode,
|
62
|
+
return jwt.encode(to_encode, web_auth_config.secret_key)
|
63
63
|
|
64
64
|
|
65
|
-
def _generate_refresh_token(
|
65
|
+
def _generate_refresh_token(web_auth_config: WebAuthConfig, username: str) -> str:
|
66
66
|
from jose import jwt
|
67
67
|
|
68
68
|
expire = datetime.now(timezone.utc) + timedelta(
|
69
|
-
minutes=
|
69
|
+
minutes=web_auth_config.refresh_token_expire_minutes
|
70
70
|
)
|
71
71
|
to_encode = {"sub": username, "exp": expire, "type": "refresh"}
|
72
|
-
return jwt.encode(to_encode,
|
72
|
+
return jwt.encode(to_encode, web_auth_config.secret_key)
|
zrb/runner/web_util/user.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import TYPE_CHECKING
|
2
2
|
|
3
|
-
from zrb.runner.
|
3
|
+
from zrb.runner.web_auth_config import WebAuthConfig
|
4
4
|
from zrb.runner.web_schema.user import User
|
5
5
|
|
6
6
|
if TYPE_CHECKING:
|
@@ -9,53 +9,55 @@ if TYPE_CHECKING:
|
|
9
9
|
|
10
10
|
|
11
11
|
def get_user_by_credentials(
|
12
|
-
|
12
|
+
web_auth_config: WebAuthConfig, username: str, password: str
|
13
13
|
) -> User | None:
|
14
|
-
user =
|
14
|
+
user = web_auth_config.find_user_by_username(username)
|
15
15
|
if user is None or not user.is_password_match(password):
|
16
16
|
return None
|
17
17
|
return user
|
18
18
|
|
19
19
|
|
20
20
|
async def get_user_from_request(
|
21
|
-
|
21
|
+
web_auth_config: WebAuthConfig, request: "Request"
|
22
22
|
) -> User | None:
|
23
23
|
from fastapi.security import OAuth2PasswordBearer
|
24
24
|
|
25
|
-
if not
|
26
|
-
return
|
25
|
+
if not web_auth_config.enable_auth:
|
26
|
+
return web_auth_config.default_user
|
27
27
|
# Normally we use "Depends"
|
28
28
|
get_bearer_token = OAuth2PasswordBearer(tokenUrl="/api/v1/login", auto_error=False)
|
29
29
|
bearer_token = await get_bearer_token(request)
|
30
|
-
token_user = _get_user_from_token(
|
30
|
+
token_user = _get_user_from_token(web_auth_config, bearer_token)
|
31
31
|
if token_user is not None:
|
32
32
|
return token_user
|
33
|
-
cookie_user = _get_user_from_cookie(
|
33
|
+
cookie_user = _get_user_from_cookie(web_auth_config, request)
|
34
34
|
if cookie_user is not None:
|
35
35
|
return cookie_user
|
36
|
-
return
|
36
|
+
return web_auth_config.default_user
|
37
37
|
|
38
38
|
|
39
|
-
def _get_user_from_cookie(
|
40
|
-
|
39
|
+
def _get_user_from_cookie(
|
40
|
+
web_auth_config: WebAuthConfig, request: "Request"
|
41
|
+
) -> User | None:
|
42
|
+
token = request.cookies.get(web_auth_config.access_token_cookie_name)
|
41
43
|
if token:
|
42
|
-
return _get_user_from_token(
|
44
|
+
return _get_user_from_token(web_auth_config, token)
|
43
45
|
return None
|
44
46
|
|
45
47
|
|
46
|
-
def _get_user_from_token(
|
48
|
+
def _get_user_from_token(web_auth_config: WebAuthConfig, token: str) -> User | None:
|
47
49
|
try:
|
48
50
|
from jose import jwt
|
49
51
|
|
50
52
|
payload = jwt.decode(
|
51
53
|
token,
|
52
|
-
|
54
|
+
web_auth_config.secret_key,
|
53
55
|
options={"require_sub": True, "require_exp": True},
|
54
56
|
)
|
55
57
|
username: str = payload.get("sub")
|
56
58
|
if username is None:
|
57
59
|
return None
|
58
|
-
user =
|
60
|
+
user = web_auth_config.find_user_by_username(username)
|
59
61
|
if user is None:
|
60
62
|
return None
|
61
63
|
return user
|
zrb/util/string/format.py
CHANGED
@@ -19,21 +19,18 @@ def fstring_format(template: str, data: dict[str, Any]) -> str:
|
|
19
19
|
ValueError: If an expression in the template fails to evaluate or the
|
20
20
|
template is invalid.
|
21
21
|
"""
|
22
|
+
# Step 1: Replace escaped braces with unique tokens (temporary)
|
23
|
+
template = template.replace("{{", "\u0000").replace("}}", "\u0001")
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
Helper function to evaluate a single expression found in the template.
|
26
|
-
"""
|
25
|
+
# Step 2: Replace real expressions {expr}
|
26
|
+
def eval_expr(match: re.Match) -> str:
|
27
27
|
expr = match.group(1)
|
28
28
|
try:
|
29
|
-
|
30
|
-
return str(result)
|
29
|
+
return str(eval(expr, {}, data))
|
31
30
|
except Exception as e:
|
32
|
-
raise ValueError(f"
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
except Exception as e:
|
39
|
-
raise ValueError(f"Failed to parse template: {template}: {e}")
|
31
|
+
raise ValueError(f"Error evaluating expression '{expr}': {e}")
|
32
|
+
|
33
|
+
rendered = re.sub(r"\{([^{}]+)\}", eval_expr, template)
|
34
|
+
|
35
|
+
# Step 3: Restore escaped braces
|
36
|
+
return rendered.replace("\u0000", "{").replace("\u0001", "}")
|
@@ -1,4 +1,4 @@
|
|
1
|
-
zrb/__init__.py,sha256=
|
1
|
+
zrb/__init__.py,sha256=e0fZglzFsjO-jz0HhHaBV5Vm0e3MZJBtXcrgDOPESB0,3103
|
2
2
|
zrb/__main__.py,sha256=Kr_AkgmwBEycQcPVkZmrNh4hp2g62G-7ZXeOhJg0Qis,2603
|
3
3
|
zrb/attr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
zrb/attr/type.py,sha256=4TV5gPYMMrKh5V-yB6iRYKCbsXAH_AvGXMsjxKLHcUs,568
|
@@ -148,26 +148,26 @@ zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view
|
|
148
148
|
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/images/android-chrome-192x192.png,sha256=4NN-TGVL3y3MVbms7kCgD-Udp5XmQ6cwmWqRFYib0qw,12463
|
149
149
|
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/images/android-chrome-512x512.png,sha256=PE5DCXqmMtNvwDWfHxVoRIy36mrTmq4IDv-YPgz4mvg,34025
|
150
150
|
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/images/favicon-32x32.png,sha256=KHE2CBnJAxS81xzoPxdfYA17nJxvoOf6yM2UPaKIT7E,1402
|
151
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.amber.min.css,sha256=
|
152
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.blue.min.css,sha256=
|
153
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.cyan.min.css,sha256=
|
154
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.fuchsia.min.css,sha256=
|
155
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.green.min.css,sha256=
|
156
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.grey.min.css,sha256=
|
157
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.indigo.min.css,sha256=
|
158
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.jade.min.css,sha256=
|
159
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.lime.min.css,sha256=
|
160
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.min.css,sha256
|
161
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.orange.min.css,sha256=
|
162
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.pink.min.css,sha256=
|
163
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.pumpkin.min.css,sha256=
|
164
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.purple.min.css,sha256=
|
165
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.red.min.css,sha256=
|
166
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.sand.min.css,sha256=
|
167
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.slate.min.css,sha256=
|
168
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.violet.min.css,sha256=
|
169
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.yellow.min.css,sha256=
|
170
|
-
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.zinc.min.css,sha256=
|
151
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.amber.min.css,sha256=CuU4QUuZB9g7Kp-UCpLhiFMaeWp27YHk9yWhiTrOUEQ,83343
|
152
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.blue.min.css,sha256=xz-TxXSV6YYZphxO8ls-z_5KA4bMSL7GAbd3b3m-PDw,83335
|
153
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.cyan.min.css,sha256=u1NSuxSlsKvV9ussgvRauHZDvMGo3IKPDVERUHcXKOg,83325
|
154
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.fuchsia.min.css,sha256=vm_phDygepr5Xcg00WqE4rZ56fOBVUculHkjcueM-S8,83334
|
155
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.green.min.css,sha256=rV1-95jjXPKW3ZO3SlbaMcq-6a0s_B0kDBJ7qgt1iCQ,83319
|
156
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.grey.min.css,sha256=Ylj3e-TYOeRUunW1Ob2fm65arWG_p3yNfEQODgFQC2I,83361
|
157
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.indigo.min.css,sha256=P_dc3oTHZJFUnhp8ZClMLIPLL5IjHqRGkvn_xpiXqBE,83336
|
158
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.jade.min.css,sha256=3DiFxHhfBOO9RYRp7sDRi8BxwrHx0v1zXoPQDf6VcbM,83318
|
159
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.lime.min.css,sha256=3GwkX3UHmC5jhWsglefOT591IzvpBUDONWV5v8aT5vM,83342
|
160
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.min.css,sha256=-8mmP8n8n3LRL9f8mAbhH6n3euT5ytFGsnADoRGbo9s,83319
|
161
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.orange.min.css,sha256=FJkqb3R8_Tr1QBzi9s270L_s0KZ8atjjmd7IRiEVHDc,83325
|
162
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.pink.min.css,sha256=3Z7D2ZpOVZHsDDelMrMEvkP4XFRwWfO1NYmE95jHaQM,83333
|
163
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.pumpkin.min.css,sha256=uM0Ft6sePS2OP1Km-EgzpHfuy8bOEDliYG157T5dCvg,83342
|
164
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.purple.min.css,sha256=RYpEcxJ3OXN7QhcBQx909A96zqMAdJ1UmrHp41rdCVM,83336
|
165
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.red.min.css,sha256=gd9J5L13xwfLhjSpkd2DI4cJf5evsYOj9xUrW4tAJtw,83325
|
166
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.sand.min.css,sha256=x0qk2Es5GAOw649GmeozgnPyPTKih3aFO9-f1a6Yipk,83360
|
167
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.slate.min.css,sha256=KDDpOhFoPtzVXRKOyE2EIzeuBB5Z6jlaL5FQ34Cmemg,83336
|
168
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.violet.min.css,sha256=DJmQkSpAPHjaSXeT-MITZ6ENJa0eyyizTR00wt3bXHc,83336
|
169
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.yellow.min.css,sha256=_UXLKrhEsXonQ-VthBNB7zHUEcV67KDAE-SiDR1SrlU,83371
|
170
|
+
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/static/pico-css/pico.zinc.min.css,sha256=C9KHUa2PomYXZg2-rbpDPDYkuL_ZZTwFS-uj1Zo7azE,83337
|
171
171
|
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/view/template/default.html,sha256=Lg4vONCLOx8PSORFitg8JZa-4dp-pyUvKSVzCJEFsB8,4048
|
172
172
|
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/requirements.txt,sha256=jSLXX-ZOElSG69qjx5yVcpg6X_QJoisNDUYpCv2ldH8,195
|
173
173
|
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -216,7 +216,7 @@ zrb/callback/callback.py,sha256=mk_RIHuWi-oP5b81jfhzU6fruhsIjhRtKpwh2yYmsiM,3876
|
|
216
216
|
zrb/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
217
217
|
zrb/cmd/cmd_result.py,sha256=L8bQJzWCpcYexIxHBNsXj2pT3BtLmWex0iJSMkvimOA,597
|
218
218
|
zrb/cmd/cmd_val.py,sha256=7Doowyg6BK3ISSGBLt-PmlhzaEkBjWWm51cED6fAUOQ,1014
|
219
|
-
zrb/config.py,sha256=
|
219
|
+
zrb/config.py,sha256=rvCymdWpVKfwa1XlLNbFMxz2kkJyzqvqoqv5R8_zLDY,9584
|
220
220
|
zrb/content_transformer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
221
221
|
zrb/content_transformer/any_content_transformer.py,sha256=v8ZUbcix1GGeDQwB6OKX_1TjpY__ksxWVeqibwa_iZA,850
|
222
222
|
zrb/content_transformer/content_transformer.py,sha256=STl77wW-I69QaGzCXjvkppngYFLufow8ybPLSyAvlHs,2404
|
@@ -245,56 +245,74 @@ zrb/input/option_input.py,sha256=TQB82ko5odgzkULEizBZi0e9TIHEbIgvdP0AR3RhA74,213
|
|
245
245
|
zrb/input/password_input.py,sha256=szBojWxSP9QJecgsgA87OIYwQrY2AQ3USIKdDZY6snU,1465
|
246
246
|
zrb/input/str_input.py,sha256=NevZHX9rf1g8eMatPyy-kUX3DglrVAQpzvVpKAzf7bA,81
|
247
247
|
zrb/input/text_input.py,sha256=6T3MngWdUs0u0ZVs5Dl11w5KS7nN1RkgrIR_zKumzPM,3695
|
248
|
-
zrb/llm_config.py,sha256=
|
248
|
+
zrb/llm_config.py,sha256=GtwPqBtKDq5_vazOZF8cMRZK_7dK0I5nnwnMWPuzrMA,12242
|
249
249
|
zrb/runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
250
|
-
zrb/runner/cli.py,sha256=
|
250
|
+
zrb/runner/cli.py,sha256=AbLTNqFy5FuyGQOWOjHZGaBC8e2yuE_Dx1sBdnisR18,6984
|
251
251
|
zrb/runner/common_util.py,sha256=JDMcwvQ8cxnv9kQrAoKVLA40Q1omfv-u5_d5MvvwHeE,1373
|
252
|
-
zrb/runner/web_app.py,sha256=
|
253
|
-
zrb/runner/
|
254
|
-
zrb/runner/web_config/config_factory.py,sha256=GIvAwQKY_jkAb_IVt179KvphqHPY7gfBiQrZmELVQdQ,636
|
252
|
+
zrb/runner/web_app.py,sha256=pydxJakSMsopvWWzkWLtMz7NyRORiS1KHKuG0jIF6N0,2792
|
253
|
+
zrb/runner/web_auth_config.py,sha256=LwEDcfH0W57Z8SQIl8i-JpVibofB72gmzjPFiwUznQs,6361
|
255
254
|
zrb/runner/web_route/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
256
|
-
zrb/runner/web_route/docs_route.py,sha256=
|
257
|
-
zrb/runner/web_route/error_page/serve_default_404.py,sha256=
|
258
|
-
zrb/runner/web_route/error_page/show_error_page.py,sha256=
|
259
|
-
zrb/runner/web_route/error_page/view.html,sha256=
|
255
|
+
zrb/runner/web_route/docs_route.py,sha256=Ftv4BbxnF_GZs2cJwen4hV7Z_UKQassFugB_bePdrPw,543
|
256
|
+
zrb/runner/web_route/error_page/serve_default_404.py,sha256=srQSyOHoTZLScSvSUQnzUAVFOFSO_NQ2XEQZSvPd05c,1072
|
257
|
+
zrb/runner/web_route/error_page/show_error_page.py,sha256=ck5u_LQiLHtgzwpVgX9Xs_60zPonfnoefXDYYBoR3gI,1301
|
258
|
+
zrb/runner/web_route/error_page/view.html,sha256=iYH52t2CQ9_ubgweELwnUXtqzhleC0Nv1oa9ecREM64,544
|
260
259
|
zrb/runner/web_route/home_page/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
261
|
-
zrb/runner/web_route/home_page/home_page_route.py,sha256=
|
260
|
+
zrb/runner/web_route/home_page/home_page_route.py,sha256=dVOlQ_Nk5wQZkkRCC43aiACQRGAxzzCRYfTYRRHnm3M,2606
|
262
261
|
zrb/runner/web_route/home_page/view.html,sha256=oWvirSGh74ABHHDPYboQueZI6_xMeMLDf5LZNLZO52k,422
|
263
|
-
zrb/runner/web_route/login_api_route.py,sha256=
|
264
|
-
zrb/runner/web_route/login_page/login_page_route.py,sha256=
|
262
|
+
zrb/runner/web_route/login_api_route.py,sha256=xzo8GyybsNJmnmo6GD08zmVjD9nWpckOnSxH92HqxkU,1151
|
263
|
+
zrb/runner/web_route/login_page/login_page_route.py,sha256=Cs0VtIbu9Sq0Or2d7TRrT2d0_85y_XxsvBmPBzi9OsQ,1929
|
265
264
|
zrb/runner/web_route/login_page/view.html,sha256=KLHZWm5MxcGCOQjeq_JtXMTLvDX8JyphSBbK6DDrkg8,1139
|
266
|
-
zrb/runner/web_route/logout_api_route.py,sha256=
|
267
|
-
zrb/runner/web_route/logout_page/logout_page_route.py,sha256=
|
265
|
+
zrb/runner/web_route/logout_api_route.py,sha256=VS5OvngwoAE5SXolWtEmja1vXpqSLQu8E-wiq5weeDA,633
|
266
|
+
zrb/runner/web_route/logout_page/logout_page_route.py,sha256=JAzBJzgMR-deKJOaE_8VXnzA0RJdTS_rpUBRTmwobg4,1974
|
268
267
|
zrb/runner/web_route/logout_page/view.html,sha256=P1S9cv7eXMbwUZTPfP4sshBNI-m9nWhLP-mrmtoEHCs,742
|
269
|
-
zrb/runner/web_route/node_page/group/show_group_page.py,sha256=
|
268
|
+
zrb/runner/web_route/node_page/group/show_group_page.py,sha256=IBwCU8HykybPII89sCWvYXdM-OaBvSaQqixgBhdsPOg,1953
|
270
269
|
zrb/runner/web_route/node_page/group/view.html,sha256=3d1O2Vqc2PzxY-_xWt0Rsb2mG1yrvQ1TuaZXuYGolJw,566
|
271
|
-
zrb/runner/web_route/node_page/node_page_route.py,sha256=
|
270
|
+
zrb/runner/web_route/node_page/node_page_route.py,sha256=7UjYGgtlDK6t2RR0ILmXwkZk04a1HJKOhDr09h46Rzw,2284
|
272
271
|
zrb/runner/web_route/node_page/task/partial/input.html,sha256=X2jy0q7TLQGP853exZMed0lqPezL3gzn6mnhB5QKfkc,178
|
273
|
-
zrb/runner/web_route/node_page/task/show_task_page.py,sha256=
|
272
|
+
zrb/runner/web_route/node_page/task/show_task_page.py,sha256=Fmov5Byqj10Rbkl-IXxZDoKt0L7rMP9TjMIcq2oNtmk,3355
|
274
273
|
zrb/runner/web_route/node_page/task/view.html,sha256=mp_DeoPXhWPypAbKSZ6iTIDVlTRUQzIuJfDExxOWBWc,2598
|
275
|
-
zrb/runner/web_route/refresh_token_api_route.py,sha256=
|
276
|
-
zrb/runner/web_route/static/global_template.html,sha256=
|
274
|
+
zrb/runner/web_route/refresh_token_api_route.py,sha256=UFrSwNxpbDRHQiDIRhtVndRNlwsMIRZOkL4glK5sS6c,1504
|
275
|
+
zrb/runner/web_route/static/global_template.html,sha256=fK5eBs4cH5zb_JhcWANygtnf0PMY4HAkFmN3hZI3rE4,1298
|
277
276
|
zrb/runner/web_route/static/refresh-token.template.js,sha256=AWXhdxTMyuzBZoMftH7BjlU2CMIafwqWcbkZoiUEE50,1074
|
278
277
|
zrb/runner/web_route/static/resources/common.css,sha256=Kk8o0mcArKTOxPllR0ecaa0ZRVVig0CG0KvLXIqmGJo,517
|
279
278
|
zrb/runner/web_route/static/resources/common.js,sha256=e0OEhQBA1cMuGtj9yQQT2O053ysngcJTL-jW0b1gvoY,813
|
280
279
|
zrb/runner/web_route/static/resources/favicon-32x32.png,sha256=yu9AIU4k_qD4YHpul6XwJgOxIbmu0thv9ymm2QOsrAk,1456
|
281
280
|
zrb/runner/web_route/static/resources/login/event.js,sha256=1-NxaUwU-X7Tu2RAwVkzU7gngS0OdooH7Ple4_KDrh4,1135
|
282
281
|
zrb/runner/web_route/static/resources/logout/event.js,sha256=MfZxrTa2yL49Lbh7cCZDdqsIcf9e1q3W8-WjmZXV5pA,692
|
283
|
-
zrb/runner/web_route/static/resources/pico.min.css,sha256=
|
282
|
+
zrb/runner/web_route/static/resources/pico-css/pico.amber.min.css,sha256=CuU4QUuZB9g7Kp-UCpLhiFMaeWp27YHk9yWhiTrOUEQ,83343
|
283
|
+
zrb/runner/web_route/static/resources/pico-css/pico.blue.min.css,sha256=xz-TxXSV6YYZphxO8ls-z_5KA4bMSL7GAbd3b3m-PDw,83335
|
284
|
+
zrb/runner/web_route/static/resources/pico-css/pico.cyan.min.css,sha256=u1NSuxSlsKvV9ussgvRauHZDvMGo3IKPDVERUHcXKOg,83325
|
285
|
+
zrb/runner/web_route/static/resources/pico-css/pico.fuchsia.min.css,sha256=vm_phDygepr5Xcg00WqE4rZ56fOBVUculHkjcueM-S8,83334
|
286
|
+
zrb/runner/web_route/static/resources/pico-css/pico.green.min.css,sha256=rV1-95jjXPKW3ZO3SlbaMcq-6a0s_B0kDBJ7qgt1iCQ,83319
|
287
|
+
zrb/runner/web_route/static/resources/pico-css/pico.grey.min.css,sha256=Ylj3e-TYOeRUunW1Ob2fm65arWG_p3yNfEQODgFQC2I,83361
|
288
|
+
zrb/runner/web_route/static/resources/pico-css/pico.indigo.min.css,sha256=P_dc3oTHZJFUnhp8ZClMLIPLL5IjHqRGkvn_xpiXqBE,83336
|
289
|
+
zrb/runner/web_route/static/resources/pico-css/pico.jade.min.css,sha256=3DiFxHhfBOO9RYRp7sDRi8BxwrHx0v1zXoPQDf6VcbM,83318
|
290
|
+
zrb/runner/web_route/static/resources/pico-css/pico.lime.min.css,sha256=3GwkX3UHmC5jhWsglefOT591IzvpBUDONWV5v8aT5vM,83342
|
291
|
+
zrb/runner/web_route/static/resources/pico-css/pico.min.css,sha256=-8mmP8n8n3LRL9f8mAbhH6n3euT5ytFGsnADoRGbo9s,83319
|
292
|
+
zrb/runner/web_route/static/resources/pico-css/pico.orange.min.css,sha256=FJkqb3R8_Tr1QBzi9s270L_s0KZ8atjjmd7IRiEVHDc,83325
|
293
|
+
zrb/runner/web_route/static/resources/pico-css/pico.pink.min.css,sha256=3Z7D2ZpOVZHsDDelMrMEvkP4XFRwWfO1NYmE95jHaQM,83333
|
294
|
+
zrb/runner/web_route/static/resources/pico-css/pico.pumpkin.min.css,sha256=uM0Ft6sePS2OP1Km-EgzpHfuy8bOEDliYG157T5dCvg,83342
|
295
|
+
zrb/runner/web_route/static/resources/pico-css/pico.purple.min.css,sha256=RYpEcxJ3OXN7QhcBQx909A96zqMAdJ1UmrHp41rdCVM,83336
|
296
|
+
zrb/runner/web_route/static/resources/pico-css/pico.red.min.css,sha256=gd9J5L13xwfLhjSpkd2DI4cJf5evsYOj9xUrW4tAJtw,83325
|
297
|
+
zrb/runner/web_route/static/resources/pico-css/pico.sand.min.css,sha256=x0qk2Es5GAOw649GmeozgnPyPTKih3aFO9-f1a6Yipk,83360
|
298
|
+
zrb/runner/web_route/static/resources/pico-css/pico.slate.min.css,sha256=KDDpOhFoPtzVXRKOyE2EIzeuBB5Z6jlaL5FQ34Cmemg,83336
|
299
|
+
zrb/runner/web_route/static/resources/pico-css/pico.violet.min.css,sha256=DJmQkSpAPHjaSXeT-MITZ6ENJa0eyyizTR00wt3bXHc,83336
|
300
|
+
zrb/runner/web_route/static/resources/pico-css/pico.yellow.min.css,sha256=_UXLKrhEsXonQ-VthBNB7zHUEcV67KDAE-SiDR1SrlU,83371
|
301
|
+
zrb/runner/web_route/static/resources/pico-css/pico.zinc.min.css,sha256=C9KHUa2PomYXZg2-rbpDPDYkuL_ZZTwFS-uj1Zo7azE,83337
|
284
302
|
zrb/runner/web_route/static/resources/session/common-util.js,sha256=t7_s5DXgMyZlT8L8LYZTkzOT6vWVeZvmCKjt-bflQY0,2117
|
285
303
|
zrb/runner/web_route/static/resources/session/current-session.js,sha256=tzUdK7qJKnMBGlIaMZJIPc2oeL5csk1JTBbjTsjhrFA,7008
|
286
304
|
zrb/runner/web_route/static/resources/session/event.js,sha256=X5OlSHefK0SDB9VkFCRyBKE_Pb7mqM319mW9jRGoDOk,4716
|
287
305
|
zrb/runner/web_route/static/resources/session/past-session.js,sha256=RwGJYKSp75K8NZ-iZP58XppWgdzkiKFaiC5wgcMLxDo,5470
|
288
|
-
zrb/runner/web_route/static/static_route.py,sha256=
|
289
|
-
zrb/runner/web_route/task_input_api_route.py,sha256=
|
290
|
-
zrb/runner/web_route/task_session_api_route.py,sha256=
|
306
|
+
zrb/runner/web_route/static/static_route.py,sha256=YRGKD7qiFuvciSRNewvo6oK0JLHQ_cK74eXWjffoQ70,1555
|
307
|
+
zrb/runner/web_route/task_input_api_route.py,sha256=k5nQiJCL2ud6BhxaPGSbpK86XvMbsFliqTQ1FpEd-8Q,1767
|
308
|
+
zrb/runner/web_route/task_session_api_route.py,sha256=YGMT8pN28XNVQ8StYm5xIiLH770XJhmKORHsqsfjnFY,6029
|
291
309
|
zrb/runner/web_schema/session.py,sha256=NwbuS2Sv-CXO52nU-EZv8OMlD4vgCQWNeLC_dT0FK7I,92
|
292
310
|
zrb/runner/web_schema/token.py,sha256=Y7XCPS4WzrxslTDtHeLcPTTUpmWhPOkRcl4b99zrC7c,185
|
293
311
|
zrb/runner/web_schema/user.py,sha256=Kp10amg4i-f8Y-4czogv1YN7rwy0HdbePFiuovYu1ts,1018
|
294
|
-
zrb/runner/web_util/cookie.py,sha256=
|
312
|
+
zrb/runner/web_util/cookie.py,sha256=1_oRRGziv3wAvaEDV5uCKdwWxvEI8EcW6wHW5NpBcDE,1085
|
295
313
|
zrb/runner/web_util/html.py,sha256=TuUHjX3eKCBzoa7TYdMt8dfWWy06idauyCaG66X4Ygc,1838
|
296
|
-
zrb/runner/web_util/token.py,sha256=
|
297
|
-
zrb/runner/web_util/user.py,sha256=
|
314
|
+
zrb/runner/web_util/token.py,sha256=6Yqp6mQJJMAOsSkAN-6dvtdiQbAv5xtll9jOmNYzbUY,2687
|
315
|
+
zrb/runner/web_util/user.py,sha256=vE61pDjHoaHw9K0YAv1Gu2zWX2WkM2aWG-8776_aAiM,2061
|
298
316
|
zrb/session/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
299
317
|
zrb/session/any_session.py,sha256=x57mS15E-AfUjdVxwOWEzCBjW32zjer7WoeBw0guoDc,5266
|
300
318
|
zrb/session/session.py,sha256=aDaLV1tuE7PhcC17LMk6c7KiSs7yX7QXI9O-Z4MMZO8,9967
|
@@ -365,12 +383,12 @@ zrb/util/load.py,sha256=DK0KYSlu48HCoGPqnW1IxnE3pHrZSPCstfz8Fjyqqv8,2140
|
|
365
383
|
zrb/util/run.py,sha256=FPRCCvl5g6GuDvHTkaV95CFDlqxQ-5FZb2-F-Jz1fnI,485
|
366
384
|
zrb/util/string/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
367
385
|
zrb/util/string/conversion.py,sha256=sMmstzbrNgLvWAQukqoXz45JtsNpJrniudAtzJaQlYw,6240
|
368
|
-
zrb/util/string/format.py,sha256=
|
386
|
+
zrb/util/string/format.py,sha256=MwWGAwSdtOgR_2uz-JCXlg_q-uRYUUI-G8CGkfdgqik,1198
|
369
387
|
zrb/util/string/name.py,sha256=SXEfxJ1-tDOzHqmSV8kvepRVyMqs2XdV_vyoh_9XUu0,1584
|
370
388
|
zrb/util/todo.py,sha256=VGISej2KQZERpornK-8X7bysp4JydMrMUTnG8B0-liI,20708
|
371
389
|
zrb/xcom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
372
390
|
zrb/xcom/xcom.py,sha256=o79rxR9wphnShrcIushA0Qt71d_p3ZTxjNf7x9hJB78,1571
|
373
|
-
zrb-1.
|
374
|
-
zrb-1.
|
375
|
-
zrb-1.
|
376
|
-
zrb-1.
|
391
|
+
zrb-1.8.0.dist-info/METADATA,sha256=UO-2C_syFn5vfZHq_IBrPT4Zgw3QFSJAzWOw1yx5Fng,8385
|
392
|
+
zrb-1.8.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
393
|
+
zrb-1.8.0.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
|
394
|
+
zrb-1.8.0.dist-info/RECORD,,
|
zrb/runner/web_config/config.py
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
from typing import Callable
|
2
|
-
|
3
|
-
from zrb.runner.web_schema.user import User
|
4
|
-
from zrb.task.any_task import AnyTask
|
5
|
-
|
6
|
-
|
7
|
-
class WebConfig:
|
8
|
-
def __init__(
|
9
|
-
self,
|
10
|
-
port: int,
|
11
|
-
secret_key: str,
|
12
|
-
access_token_expire_minutes: int,
|
13
|
-
refresh_token_expire_minutes: int,
|
14
|
-
access_token_cookie_name: str,
|
15
|
-
refresh_token_cookie_name: str,
|
16
|
-
enable_auth: bool,
|
17
|
-
super_admin_username: str,
|
18
|
-
super_admin_password: str,
|
19
|
-
guest_username: str,
|
20
|
-
guest_accessible_tasks: list[AnyTask | str] = [],
|
21
|
-
find_user_by_username: Callable[[str], User | None] | None = None,
|
22
|
-
):
|
23
|
-
self.secret_key = secret_key
|
24
|
-
self.access_token_expire_minutes = access_token_expire_minutes
|
25
|
-
self.refresh_token_expire_minutes = refresh_token_expire_minutes
|
26
|
-
self.access_token_cookie_name = access_token_cookie_name
|
27
|
-
self.refresh_token_cookie_name = refresh_token_cookie_name
|
28
|
-
self.enable_auth = enable_auth
|
29
|
-
self.port = port
|
30
|
-
self._user_list = []
|
31
|
-
self.super_admin_username = super_admin_username
|
32
|
-
self.super_admin_password = super_admin_password
|
33
|
-
self.guest_username = guest_username
|
34
|
-
self.guest_accessible_tasks = guest_accessible_tasks
|
35
|
-
self._find_user_by_username = find_user_by_username
|
36
|
-
|
37
|
-
@property
|
38
|
-
def default_user(self) -> User:
|
39
|
-
if self.enable_auth:
|
40
|
-
return User(
|
41
|
-
username=self.guest_username,
|
42
|
-
password="",
|
43
|
-
is_guest=True,
|
44
|
-
accessible_tasks=self.guest_accessible_tasks,
|
45
|
-
)
|
46
|
-
return User(
|
47
|
-
username=self.guest_username,
|
48
|
-
password="",
|
49
|
-
is_guest=True,
|
50
|
-
is_super_admin=True,
|
51
|
-
)
|
52
|
-
|
53
|
-
@property
|
54
|
-
def super_admin(self) -> User:
|
55
|
-
return User(
|
56
|
-
username=self.super_admin_username,
|
57
|
-
password=self.super_admin_password,
|
58
|
-
is_super_admin=True,
|
59
|
-
)
|
60
|
-
|
61
|
-
@property
|
62
|
-
def user_list(self) -> list[User]:
|
63
|
-
if not self.enable_auth:
|
64
|
-
return [self.default_user]
|
65
|
-
return self._user_list + [self.super_admin, self.default_user]
|
66
|
-
|
67
|
-
def set_guest_accessible_tasks(self, tasks: list[AnyTask | str]):
|
68
|
-
self.guest_accessible_tasks = tasks
|
69
|
-
|
70
|
-
def set_find_user_by_username(
|
71
|
-
self, find_user_by_username: Callable[[str], User | None]
|
72
|
-
):
|
73
|
-
self._find_user_by_username = find_user_by_username
|
74
|
-
|
75
|
-
def append_user(self, user: User):
|
76
|
-
duplicates = [
|
77
|
-
existing_user
|
78
|
-
for existing_user in self.user_list
|
79
|
-
if existing_user.username == user.username
|
80
|
-
]
|
81
|
-
if len(duplicates) > 0:
|
82
|
-
raise ValueError(f"User already exists {user.username}")
|
83
|
-
self._user_list.append(user)
|
84
|
-
|
85
|
-
def find_user_by_username(self, username: str) -> User | None:
|
86
|
-
user = None
|
87
|
-
if self._find_user_by_username is not None:
|
88
|
-
user = self._find_user_by_username(username)
|
89
|
-
if user is None:
|
90
|
-
user = next((u for u in self.user_list if u.username == username), None)
|
91
|
-
return user
|
@@ -1,15 +0,0 @@
|
|
1
|
-
from zrb.config import CFG
|
2
|
-
from zrb.runner.web_config.config import WebConfig
|
3
|
-
|
4
|
-
web_config = WebConfig(
|
5
|
-
port=CFG.WEB_HTTP_PORT,
|
6
|
-
secret_key=CFG.WEB_SECRET_KEY,
|
7
|
-
access_token_expire_minutes=CFG.WEB_AUTH_ACCESS_TOKEN_EXPIRE_MINUTES,
|
8
|
-
refresh_token_expire_minutes=CFG.WEB_AUTH_REFRESH_TOKEN_EXPIRE_MINUTES,
|
9
|
-
access_token_cookie_name=CFG.WEB_ACCESS_TOKEN_COOKIE_NAME,
|
10
|
-
refresh_token_cookie_name=CFG.WEB_REFRESH_TOKEN_COOKIE_NAME,
|
11
|
-
enable_auth=CFG.WEB_ENABLE_AUTH,
|
12
|
-
super_admin_username=CFG.WEB_SUPER_ADMIN_USERNAME,
|
13
|
-
super_admin_password=CFG.WEB_SUPER_ADMIN_PASSWORD,
|
14
|
-
guest_username=CFG.WEB_GUEST_USERNAME,
|
15
|
-
)
|