bizydraft 0.1.24__py3-none-any.whl → 0.1.26__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.
- bizydraft/hijack_routes.py +33 -52
- bizydraft/postload.py +25 -0
- bizydraft/{monkey_patch.py → prestartup_patch.py} +1 -1
- bizydraft/static/js/postEvent.js +1 -1
- {bizydraft-0.1.24.dist-info → bizydraft-0.1.26.dist-info}/METADATA +1 -1
- {bizydraft-0.1.24.dist-info → bizydraft-0.1.26.dist-info}/RECORD +8 -7
- {bizydraft-0.1.24.dist-info → bizydraft-0.1.26.dist-info}/WHEEL +0 -0
- {bizydraft-0.1.24.dist-info → bizydraft-0.1.26.dist-info}/top_level.txt +0 -0
bizydraft/hijack_routes.py
CHANGED
|
@@ -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
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
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)
|
bizydraft/static/js/postEvent.js
CHANGED
|
@@ -647,7 +647,7 @@ app.registerExtension({
|
|
|
647
647
|
}
|
|
648
648
|
},
|
|
649
649
|
clickCommunity: function () {
|
|
650
|
-
const communityBtn = document.
|
|
650
|
+
const communityBtn = document.querySelector('.btn-community');
|
|
651
651
|
if (communityBtn) {
|
|
652
652
|
communityBtn.click();
|
|
653
653
|
window.parent.postMessage({
|
|
@@ -1,17 +1,18 @@
|
|
|
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=
|
|
4
|
-
bizydraft/
|
|
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
|
|
8
9
|
bizydraft/static/js/hookLoadImage.js,sha256=GklOwfIkXhSfCFrHBz4pPqaSnBiKjegbpDknrzvXYOc,5767
|
|
9
10
|
bizydraft/static/js/main.js,sha256=cZ-7wR9T8aNLzIrTjc-g9xVZf7z6TXWl1zhP_wXSSVo,150
|
|
10
|
-
bizydraft/static/js/postEvent.js,sha256=
|
|
11
|
+
bizydraft/static/js/postEvent.js,sha256=lXo35DUiBmzGFMtOL2ULcjbCscNb5eAZ98_eX7en3hM,27926
|
|
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.
|
|
15
|
-
bizydraft-0.1.
|
|
16
|
-
bizydraft-0.1.
|
|
17
|
-
bizydraft-0.1.
|
|
15
|
+
bizydraft-0.1.26.dist-info/METADATA,sha256=rQW4tgpR5Qtc6eHJy8KRVfyAPyFSwZY01Ohug0DbIN4,73
|
|
16
|
+
bizydraft-0.1.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
17
|
+
bizydraft-0.1.26.dist-info/top_level.txt,sha256=XtoBq6hjZhXIM7aas4GtPDtAiKo8FdLzMABXW8qqQ8M,10
|
|
18
|
+
bizydraft-0.1.26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|