dsh-cosplay-studio 2.0.3 → 2.0.4
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.
- package/lib/index.js +19 -7
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -299,6 +299,24 @@ function applyShots(id, shots) {
|
|
|
299
299
|
|
|
300
300
|
export function apply(ctx) {
|
|
301
301
|
const disposers = []
|
|
302
|
+
const disposeAll = () => {
|
|
303
|
+
while (disposers.length > 0) {
|
|
304
|
+
const dispose = disposers.pop()
|
|
305
|
+
try {
|
|
306
|
+
dispose()
|
|
307
|
+
} catch {
|
|
308
|
+
// ignore
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
// The plugin loader ignores a plugin's return value, so binding cleanup to
|
|
313
|
+
// the returned function alone leaks routes: a hot reload then fails with
|
|
314
|
+
// "webserver: duplicate exact route ...". Bind it to the fiber instead.
|
|
315
|
+
if (typeof ctx.effect === 'function') {
|
|
316
|
+
ctx.effect(() => disposeAll)
|
|
317
|
+
} else if (typeof ctx.on === 'function') {
|
|
318
|
+
ctx.on('dispose', disposeAll)
|
|
319
|
+
}
|
|
302
320
|
ctx.logger?.info?.('[cosplay-studio] host half loaded')
|
|
303
321
|
|
|
304
322
|
const route = (path, handler) => {
|
|
@@ -798,13 +816,7 @@ export function apply(ctx) {
|
|
|
798
816
|
disposers.push(disposeMedia)
|
|
799
817
|
|
|
800
818
|
return async () => {
|
|
801
|
-
|
|
802
|
-
try {
|
|
803
|
-
dispose()
|
|
804
|
-
} catch {
|
|
805
|
-
// ignore
|
|
806
|
-
}
|
|
807
|
-
}
|
|
819
|
+
disposeAll()
|
|
808
820
|
}
|
|
809
821
|
}
|
|
810
822
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cosplay-studio",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Cosplay Studio for the DSH web GUI: one-click ComfyUI (Z-Image-Turbo) deployment with a self-test, then a character name, an uploaded reference photo, or a hot-character recommendation drives a live-action cosplay photo set following the cosplay-photo-set skill v2.1 (nine-paragraph character card with SKIN, base-image gate, shot-script gate, 1440x2560 finals, QC, de-oil, body makeup, JPEG export).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|