Compare commits

..

1 Commits

Author SHA1 Message Date
dayuan.jiang
834abc2b2d fix: zoom reset on drag and IndexedDB version conflict
- Fix zoom resetting when dragging items (#775): removed useEffect that
  called load() on every autosave-triggered chartXML change, which reset
  the viewport. Moved diagram restore logic to onDrawioLoad where it
  only fires on remount.

- Fix IndexedDB VersionError: template-storage.ts shared the same DB
  name as session-storage.ts but at version 2, causing session storage
  to fail with "requested version (1) < existing version (2)". Give
  templates their own DB ("next-ai-drawio-templates").
2026-04-03 16:37:16 +09:00
3 changed files with 18 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@next-ai-drawio/mcp-server",
"version": "0.1.19",
"version": "0.1.17",
"description": "MCP server for Next AI Draw.io - AI-powered diagram generation with real-time browser preview",
"type": "module",
"main": "dist/index.js",

View File

@@ -4,29 +4,6 @@
*/
import http from "node:http"
const MAX_BODY_BYTES = 10 * 1024 * 1024 // 10 MiB
function readBody(
req: http.IncomingMessage,
res: http.ServerResponse,
cb: (body: string) => void,
): void {
let body = ""
let size = 0
req.on("data", (chunk: Buffer) => {
size += chunk.length
if (size > MAX_BODY_BYTES) {
res.writeHead(413, { "Content-Type": "application/json" })
res.end(JSON.stringify({ error: "Payload too large" }))
req.destroy()
return
}
body += chunk
})
req.on("end", () => cb(body))
}
import {
addHistory,
clearHistory,
@@ -178,7 +155,7 @@ export function startHttpServer(port = 6002): Promise<number> {
}
})
server.listen(port, "127.0.0.1", () => {
server.listen(port, () => {
serverPort = port
log.info(`HTTP server running on http://localhost:${port}`)
resolve(port)
@@ -289,7 +266,11 @@ function handleStateApi(
}),
)
} else if (req.method === "POST") {
readBody(req, res, (body) => {
let body = ""
req.on("data", (chunk) => {
body += chunk
})
req.on("end", () => {
try {
const data = JSON.parse(body)
const { sessionId } = data
@@ -366,7 +347,11 @@ function handleRestoreApi(
return
}
readBody(req, res, (body) => {
let body = ""
req.on("data", (chunk) => {
body += chunk
})
req.on("end", () => {
try {
const { sessionId, index } = JSON.parse(body)
if (!sessionId || index === undefined) {
@@ -408,7 +393,11 @@ function handleHistorySvgApi(
return
}
readBody(req, res, (body) => {
let body = ""
req.on("data", (chunk) => {
body += chunk
})
req.on("end", () => {
try {
const { sessionId, svg } = JSON.parse(body)
if (!sessionId || !svg) {

View File

@@ -35,7 +35,6 @@
"packages",
"electron",
"electron-standalone",
"dist-electron",
"release"
"dist-electron"
]
}