- 新增 desktop 应用入口,将后端与前端打包为单一可执行文件 - 集成系统托盘功能(getlantern/systray) - 支持单实例锁和端口冲突检测 - 启动时自动打开浏览器显示管理界面 - 新增 embedfs 模块嵌入静态资源 - 新增跨平台构建脚本(macOS/Windows/Linux) - 新增 macOS .app 打包脚本 - 统一 Makefile,移除 backend/Makefile - 更新 README 添加桌面应用使用说明
69 lines
2.1 KiB
Bash
Executable File
69 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
VERSION="1.0.0"
|
|
APP_NAME="Nex"
|
|
BUNDLE_ID="io.nex.gateway"
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
|
BUILD_DIR="${PROJECT_ROOT}/build"
|
|
ASSETS_DIR="${PROJECT_ROOT}/assets"
|
|
|
|
echo "打包 macOS .app..."
|
|
|
|
mkdir -p "${BUILD_DIR}/${APP_NAME}.app/Contents/MacOS"
|
|
mkdir -p "${BUILD_DIR}/${APP_NAME}.app/Contents/Resources"
|
|
|
|
if [ -f "${BUILD_DIR}/nex-darwin-arm64" ]; then
|
|
cp "${BUILD_DIR}/nex-darwin-arm64" "${BUILD_DIR}/${APP_NAME}.app/Contents/MacOS/nex"
|
|
elif [ -f "${BUILD_DIR}/nex-darwin-amd64" ]; then
|
|
cp "${BUILD_DIR}/nex-darwin-amd64" "${BUILD_DIR}/${APP_NAME}.app/Contents/MacOS/nex"
|
|
else
|
|
echo "错误: 未找到 macOS 二进制文件,请先运行 make desktop-darwin"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -f "${ASSETS_DIR}/AppIcon.icns" ]; then
|
|
cp "${ASSETS_DIR}/AppIcon.icns" "${BUILD_DIR}/${APP_NAME}.app/Contents/Resources/"
|
|
else
|
|
echo "警告: 未找到 AppIcon.icns"
|
|
fi
|
|
|
|
cat > "${BUILD_DIR}/${APP_NAME}.app/Contents/Info.plist" << EOF
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>CFBundleDevelopmentRegion</key>
|
|
<string>zh_CN</string>
|
|
<key>CFBundleExecutable</key>
|
|
<string>nex</string>
|
|
<key>CFBundleIconFile</key>
|
|
<string>AppIcon</string>
|
|
<key>CFBundleIdentifier</key>
|
|
<string>${BUNDLE_ID}</string>
|
|
<key>CFBundleInfoDictionaryVersion</key>
|
|
<string>6.0</string>
|
|
<key>CFBundleName</key>
|
|
<string>${APP_NAME} Gateway</string>
|
|
<key>CFBundleDisplayName</key>
|
|
<string>${APP_NAME} Gateway</string>
|
|
<key>CFBundlePackageType</key>
|
|
<string>APPL</string>
|
|
<key>CFBundleShortVersionString</key>
|
|
<string>${VERSION}</string>
|
|
<key>CFBundleVersion</key>
|
|
<string>${VERSION}</string>
|
|
<key>LSMinimumSystemVersion</key>
|
|
<string>10.13</string>
|
|
<key>LSUIElement</key>
|
|
<true/>
|
|
<key>NSHighResolutionCapable</key>
|
|
<true/>
|
|
</dict>
|
|
</plist>
|
|
EOF
|
|
|
|
chmod +x "${BUILD_DIR}/${APP_NAME}.app/Contents/MacOS/nex"
|
|
|
|
echo "打包完成: ${BUILD_DIR}/${APP_NAME}.app"
|