From 36058f24382ee451aad17c6a3ecd1559ce65c49b Mon Sep 17 00:00:00 2001 From: CancerAi Date: Thu, 1 Oct 2026 16:37:14 +0800 Subject: [PATCH] =?UTF-8?q?fea:=20=E6=A1=A5=E6=8E=A5=E5=B1=82=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=AD=98=E6=B4=BB=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/index.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index cc15439..614e27b 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -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",