fea: 桥接层服务存活检测

This commit is contained in:
cancerai committed 2026-10-01 16:38:28 +08:00
1 parent a3274fb9f6
commit 36058f2438
1 file changed
+19 -2
+19 -2
View File
@@ -1,13 +1,30 @@
import { Hono } from "hono";
import { validator } from "hono/validator";
let canConnectBridgeServer: boolean = true
try {
await Bun.connect({
hostname: "localhost",
port: 8081,
socket: {
data: () => { },
},
})
} catch (e) {
canConnectBridgeServer = false
}
if (!canConnectBridgeServer) {
console.log("Connect to bridge: localhost:8081 failed");
process.exit(1)
}
const appTmp = new Hono()
const app = appTmp.basePath("/watermark")
/**
* param: image: 图片大小必须<=10MB
* param: payload: 必须是长度<=8的字母大小写或数字组合
* param: strength: 取值>=0,一般取值0~1.5
* param: strength: 取值0~100,一般取值0~1.5
* param: outputType: 输出的文件类型,只允许 jpeg | png
*/
app.post("/encode",