bizydraft 0.1.23__py3-none-any.whl → 0.1.24__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,58 @@ def hijack_routes():
161
161
  "Hijacked /prompt route to handle prompt validation but not execution"
162
162
  )
163
163
  break
164
+ lazy_block_routes()
165
+
166
+
167
+ def lazy_block_routes():
168
+ try:
169
+ import app.database.db
170
+
171
+ origin_init_db = app.database.db.init_db
172
+
173
+ def _block_routes():
174
+ routes = comfy_server.routes
175
+ white_list = [
176
+ # 劫持改造过的
177
+ "/prompt",
178
+ "/view",
179
+ # 原生的
180
+ "/",
181
+ "/ws",
182
+ "/extensions",
183
+ "/object_info",
184
+ "/object_info/{node_class}",
185
+ ]
186
+
187
+ async def null_handler(request):
188
+ return web.Response(
189
+ status=403,
190
+ text="Access Forbidden: You do not have permission to access this resource.",
191
+ )
192
+
193
+ for idx, route in enumerate(routes._items):
194
+ if (route.path not in white_list) and ("/bizyair" not in route.path):
195
+ if route.method == "GET":
196
+ logger.info(f"hijiack to null: {route.path}, {route.method}")
197
+ routes._items[idx] = web.get(route.path, null_handler)
198
+ routes._items[idx].kwargs.clear()
199
+ elif route.method == "POST":
200
+ logger.info(f"hijiack to null: {route.path}, {route.method}")
201
+ routes._items[idx] = web.post(route.path, null_handler)
202
+ routes._items[idx].kwargs.clear()
203
+ else:
204
+ logger.warning(
205
+ f"neither GET or POST, passed: {route.path}, {route.method}"
206
+ )
207
+ else:
208
+ logger.warning(f"passed directly: {route.path}, {route.method}")
209
+
210
+ def new_init_db():
211
+ _block_routes()
212
+ origin_init_db()
213
+
214
+ app.database.db.init_db = new_init_db
215
+
216
+ except Exception as e:
217
+ logger.error(f"failed to block routes: {e}")
218
+ exit(1)
@@ -1,4 +1,4 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bizydraft
3
- Version: 0.1.23
3
+ Version: 0.1.24
4
4
  Summary: bizydraft
@@ -1,6 +1,6 @@
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
3
+ bizydraft/hijack_routes.py,sha256=ZaPXpaZ9Fft1mOlJvyo8fep9ZgfoG543H1PV1TMwe8U,8080
4
4
  bizydraft/monkey_patch.py,sha256=n4KVPkG8v-2avX6MTLhLFgQhHhadNSFJi1sEUr0-m1w,312
5
5
  bizydraft/resp.py,sha256=8INvKOe5Dgai3peKfqKjrhUoYeuXWXn358w30-_cY-A,369
6
6
  bizydraft/server.py,sha256=ES1fBYr_Ufv_YWsynLck1ln9bXTGjK3KXas1CK9WBqM,1358
@@ -11,7 +11,7 @@ bizydraft/static/js/postEvent.js,sha256=B879Dl5hTUqddll58stY5TFYxpFtQbI1KtMqfgrW
11
11
  bizydraft/static/js/socket.js,sha256=vewGQLgdJSrjvqptEDxLirZRXZUjWTJDmDdjs4mbf4k,2436
12
12
  bizydraft/static/js/tool.js,sha256=Ejyb5GiFhuoCp5_dBvu2suagbxGHCkR2Lg_4rMKN2ls,756
13
13
  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,,
14
+ bizydraft-0.1.24.dist-info/METADATA,sha256=aKJrV9QoQshpN5jH9Xt03i3O7oagceUr4I1KfxkoI7c,73
15
+ bizydraft-0.1.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ bizydraft-0.1.24.dist-info/top_level.txt,sha256=XtoBq6hjZhXIM7aas4GtPDtAiKo8FdLzMABXW8qqQ8M,10
17
+ bizydraft-0.1.24.dist-info/RECORD,,