mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-01 17:10:24 +08:00
feat(electron): bundle draw.io for offline support (#629)
* feat(electron): bundle draw.io for offline support - Download draw.io static files during CI build (v29.3.5) - Detect Electron and use local draw.io files instead of CDN - Add offline=1 parameter to disable external service calls - Skip /drawio path from i18n middleware redirect - Add public/drawio/ to .gitignore (downloaded during build) This allows the Electron app to work completely offline. * chore: bump version to 0.4.12-beta.3 for offline test * fix(electron): ad-hoc sign macOS app for bundled draw.io compatibility * chore: bump version to 0.4.12-beta.4 for ad-hoc sign test * fix(electron): disable electron-builder signing to use custom ad-hoc signing * chore: bump version to 0.4.12-beta.5
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* electron-builder afterPack hook
|
||||
* Copies node_modules to the standalone directory in the packaged app
|
||||
* and ad-hoc signs macOS apps for offline draw.io bundle compatibility
|
||||
*/
|
||||
|
||||
const {
|
||||
@@ -12,6 +13,7 @@ const {
|
||||
statSync,
|
||||
} = require("fs")
|
||||
const path = require("path")
|
||||
const { execSync } = require("child_process")
|
||||
|
||||
/**
|
||||
* Copy directory recursively, converting symlinks to regular files/directories.
|
||||
@@ -80,4 +82,22 @@ module.exports = async (context) => {
|
||||
"Ensure 'npm run electron:prepare' was run before building.",
|
||||
)
|
||||
}
|
||||
|
||||
// Ad-hoc sign macOS apps to fix signature issues with bundled draw.io files
|
||||
if (context.packager.platform.name === "mac") {
|
||||
const appPath = path.join(
|
||||
appOutDir,
|
||||
`${context.packager.appInfo.productFilename}.app`,
|
||||
)
|
||||
console.log(`[afterPack] Ad-hoc signing macOS app: ${appPath}`)
|
||||
try {
|
||||
execSync(`codesign --force --deep --sign - "${appPath}"`, {
|
||||
stdio: "inherit",
|
||||
})
|
||||
console.log("[afterPack] Ad-hoc signing completed successfully")
|
||||
} catch (error) {
|
||||
console.error("[afterPack] Ad-hoc signing failed:", error.message)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user