diff --git a/README.md b/README.md index 370e725..a7acc1c 100644 --- a/README.md +++ b/README.md @@ -1,64 +1,52 @@ # Fabric.Desktop -Electron desktop shell for Fabric.Frontend. +A **self-contained** Electron desktop app for Fabric. It bundles the +`Fabric.Frontend` SPA inside the package and loads it locally over +`file://` — no separate frontend web server is needed. It still talks to the +Center/Guild **backends** over HTTP (the Center base is set on the login +screen, so the desktop app points at whatever host runs the backends). -## 功能(当前) -- BrowserWindow 基础配置(尺寸/最小尺寸/标题) -- Dev/Prod 加载策略(dev server / 本地 offline.html) -- 基础菜单与快捷键(刷新、开发者工具、退出) -- 安全基线:`contextIsolation` + `sandbox` + 禁止任意新窗口/导航 -- `preload + IPC` 白名单: - - `fabric:config:get` - - `fabric:config:set` - - `fabric:notify` +## How it works -## Dev +- `npm run build:renderer` builds `Fabric.Frontend` with a relative asset + base (`build:desktop`) and copies the bundle into `renderer/`. +- `main.js` loads `renderer/index.html` in production (falls back to + `offline.html` if the bundle is missing); dev mode loads + `FABRIC_DESKTOP_URL` (default `http://localhost:5173`). +- Security baseline: `contextIsolation` + `sandbox`, no arbitrary new + windows/navigation; `preload` exposes a small IPC allowlist + (`fabric:config:get|set`, `fabric:notify`). +- System tray (show/hide window, quit) with the Fabric tray icon; app/window + icons use the Fabric mark. + +## Develop ```bash npm install -npm run start:dev +npm run start:dev # expects Fabric.Frontend dev server at :5173 +# or, against the bundled renderer: +npm run build:renderer && npm start ``` -`start:dev` expects Frontend dev server at `http://localhost:5173`. - -## Standalone - -```bash -npm start -``` - -## Build / Release - -先安装依赖(包含 `electron-builder`): +## Build / package ```bash npm install +npm run pack # unpacked dir (no installer) +npm run dist:linux # AppImage, deb, tar.gz -> dist/ +npm run dist:mac # dmg, zip +npm run dist:win # nsis, zip ``` -仅打包目录(不生成安装包): +Each `dist:*`/`pack` runs `build:renderer` first (so `Fabric.Frontend` must +be present beside this submodule, which it is in the `Fabric` checkout). +Output goes to `dist/` (git-ignored). `productName` is **Fabric** so the app +installs to `/opt/Fabric/` (a space there breaks Electron's sandbox); the +launcher is still labelled "Fabric Desktop". Linux icons are generated from +`build/icons/`. -```bash -npm run pack -``` +## Notes -跨平台构建入口: - -```bash -npm run dist -``` - -按平台构建: - -```bash -npm run dist:linux -npm run dist:mac -npm run dist:win -``` - -构建产物输出到: - -- `dist/` - -产物命名规范: - -- `Fabric-Desktop-${version}-${os}-${arch}.${ext}` +- The bundled SPA uses `HashRouter` under `file://` (no server for the + History API). The Center/Guild backends are HTTP and CORS-allow the + Electron `file://` origin (`null`).