bizydraft 0.1.23__py3-none-any.whl → 0.1.25__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 bizydraft might be problematic. Click here for more details.

@@ -114,7 +114,7 @@ def human_readable_size(size_bytes):
114
114
 
115
115
  async def post_prompt(request):
116
116
  json_data = await request.json()
117
- logger.debug(f"Received POST request to /prompt with data: {json_data}")
117
+ logger.debug(f"Received POST request to /prompt with data")
118
118
  json_data = comfy_server.trigger_on_prompt(json_data)
119
119
 
120
120
  if "prompt" in json_data:
@@ -161,3 +161,39 @@ def hijack_routes():
161
161
  "Hijacked /prompt route to handle prompt validation but not execution"
162
162
  )
163
163
  break
164
+
165
+ routes = comfy_server.routes
166
+ white_list = [
167
+ # 劫持改造过的
168
+ "/prompt",
169
+ "/view",
170
+ # 原生的
171
+ "/",
172
+ "/ws",
173
+ "/extensions",
174
+ "/object_info",
175
+ "/object_info/{node_class}",
176
+ ]
177
+
178
+ async def null_handler(request):
179
+ return web.Response(
180
+ status=403,
181
+ text="Access Forbidden: You do not have permission to access this resource.",
182
+ )
183
+
184
+ for idx, route in enumerate(routes._items):
185
+ if (route.path not in white_list) and ("/bizyair" not in route.path):
186
+ if route.method == "GET":
187
+ logger.info(f"hijiack to null: {route.path}, {route.method}")
188
+ routes._items[idx] = web.get(route.path, null_handler)
189
+ routes._items[idx].kwargs.clear()
190
+ elif route.method == "POST":
191
+ logger.info(f"hijiack to null: {route.path}, {route.method}")
192
+ routes._items[idx] = web.post(route.path, null_handler)
193
+ routes._items[idx].kwargs.clear()
194
+ else:
195
+ logger.warning(
196
+ f"neither GET or POST, passed: {route.path}, {route.method}"
197
+ )
198
+ else:
199
+ logger.warning(f"passed directly: {route.path}, {route.method}")
bizydraft/postload.py ADDED
@@ -0,0 +1,25 @@
1
+ from loguru import logger
2
+
3
+
4
+ def lazy_hook():
5
+ try:
6
+ import app.database.db
7
+
8
+ origin_init_db = app.database.db.init_db
9
+
10
+ def hijack_all():
11
+ from bizydraft.hijack_nodes import hijack_nodes
12
+ from bizydraft.hijack_routes import hijack_routes
13
+
14
+ hijack_nodes()
15
+ hijack_routes()
16
+
17
+ def new_init_db():
18
+ hijack_all()
19
+ origin_init_db()
20
+
21
+ app.database.db.init_db = new_init_db
22
+
23
+ except Exception as e:
24
+ logger.error(f"failed to lazyhook: {e}")
25
+ exit(1)
@@ -1,7 +1,7 @@
1
1
  from loguru import logger
2
2
 
3
3
 
4
- def monkey_patch():
4
+ def prestartup_patch():
5
5
  def empty_download(*args, **kwargs):
6
6
  logger.warning(f"Blocked download {args}")
7
7
  return
@@ -1,4 +1,4 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bizydraft
3
- Version: 0.1.23
3
+ Version: 0.1.25
4
4
  Summary: bizydraft
@@ -1,7 +1,8 @@
1
1
  bizydraft/__init__.py,sha256=OM-sKCQrPh25nHVJIX-DgF1raMYyoWLSuyduIAHt0Gs,78
2
2
  bizydraft/hijack_nodes.py,sha256=xPVLBBnRiJaI8ZbR80O8W4C9SlNAp7MxP7dKj_pRlYs,869
3
- bizydraft/hijack_routes.py,sha256=tzSIY-3wLiwoHALf7MswjAF5FqDSmXynGjpfTgRdkxE,6138
4
- bizydraft/monkey_patch.py,sha256=n4KVPkG8v-2avX6MTLhLFgQhHhadNSFJi1sEUr0-m1w,312
3
+ bizydraft/hijack_routes.py,sha256=MlietlmTU-Lj7evZo5yZE-ghQJZ9_1vdpyHXAXYfoFw,7417
4
+ bizydraft/postload.py,sha256=YfiFjJ7MLN6WNar19lLdAL_3IPr5GyI3G4rbZIiAgXU,562
5
+ bizydraft/prestartup_patch.py,sha256=Rh_D-rEUmPaojSrl8CEBMAhSgwtLSm6gH2Mzmk5NCuQ,316
5
6
  bizydraft/resp.py,sha256=8INvKOe5Dgai3peKfqKjrhUoYeuXWXn358w30-_cY-A,369
6
7
  bizydraft/server.py,sha256=ES1fBYr_Ufv_YWsynLck1ln9bXTGjK3KXas1CK9WBqM,1358
7
8
  bizydraft/static/js/handleStyle.js,sha256=P2DNMiKHr--ekn3CGNOAHU46OJCCsifejxw97kLmb7Q,1676
@@ -11,7 +12,7 @@ bizydraft/static/js/postEvent.js,sha256=B879Dl5hTUqddll58stY5TFYxpFtQbI1KtMqfgrW
11
12
  bizydraft/static/js/socket.js,sha256=vewGQLgdJSrjvqptEDxLirZRXZUjWTJDmDdjs4mbf4k,2436
12
13
  bizydraft/static/js/tool.js,sha256=Ejyb5GiFhuoCp5_dBvu2suagbxGHCkR2Lg_4rMKN2ls,756
13
14
  bizydraft/static/js/uploadFile.js,sha256=5OjLLaCHZkobLltNs27K5GgZBFHZJowBwS-oakLoNW4,4985
14
- bizydraft-0.1.23.dist-info/METADATA,sha256=T8CRemYVRYVaTPVaQfbALRhHS8VrEaiZQvRp33XeWAU,73
15
- bizydraft-0.1.23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- bizydraft-0.1.23.dist-info/top_level.txt,sha256=XtoBq6hjZhXIM7aas4GtPDtAiKo8FdLzMABXW8qqQ8M,10
17
- bizydraft-0.1.23.dist-info/RECORD,,
15
+ bizydraft-0.1.25.dist-info/METADATA,sha256=4U2zOdTUhIFS4tNlsMhhUCxz29e5CSJW4hOz6cvggGU,73
16
+ bizydraft-0.1.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
+ bizydraft-0.1.25.dist-info/top_level.txt,sha256=XtoBq6hjZhXIM7aas4GtPDtAiKo8FdLzMABXW8qqQ8M,10
18
+ bizydraft-0.1.25.dist-info/RECORD,,