bizydraft 0.1.24__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.

@@ -161,58 +161,39 @@ 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
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
+ )
166
183
 
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.",
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}"
191
197
  )
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)
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.24
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=ZaPXpaZ9Fft1mOlJvyo8fep9ZgfoG543H1PV1TMwe8U,8080
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.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,,
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,,