Skip to content

Add standalone web server mode with platform-aware Electron abstraction#12

Draft
Copilot wants to merge 11 commits intomainfrom
copilot/add-web-mode-support
Draft

Add standalone web server mode with platform-aware Electron abstraction#12
Copilot wants to merge 11 commits intomainfrom
copilot/add-web-mode-support

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

Enables deployment as a standalone Node.js web server without Electron, while preserving desktop app functionality.

Implementation

Backend: Platform-aware Electron abstraction (7 files)

  • Dynamic require('electron') with null fallback in pathHelper, filesOpController, filesController, convertController, videoCapture, configManager, languageHelper
  • Standalone server (standaloneServer.ts) serves Express API + React SPA with SPA routing

Frontend: electronAPI wrapper (17+ files)

  • Unified API interface with web fallbacks:
    • File dialogs → console warnings
    • Clipboard → navigator.clipboard API
    • Config/locale → localStorage
    • BrowserWindow features → unavailable errors
// Before: Direct Electron dependency
await window.electronAPI.selectFolder()

// After: Platform-aware wrapper
import { electronAPI } from '../shared/electronAPI'
await electronAPI.selectFolder()  // Works in Electron, warns in web

Build system

  • vite.config.standalone.ts for web-only React builds
  • build:web → outputs to builds/web/ and builds/electron/
  • start:web → runs standalone server

Deployment modes

Feature Electron Web
File management, RAG, LLM
Native dialogs, system tray ⚠️ Limited
Video capture (BrowserWindow)

Security note: CodeQL flagged missing rate limiting on static file route. Acceptable for intended local/internal use; production deployments should use reverse proxy rate limiting (documented in WEB_MODE.md).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • registry.npmmirror.com
    • Triggering command: /usr/local/bin/node node /usr/local/bin/npm install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

新增网页模式支持
新增网页模式发布脚本
1、将 renderer 目录下的 react 项目打包为发布的 html代码
2、参考 client\electron\server.ts 创建一个新的服务端脚本 standaloneServer.ts
2.1 实现启动现有的 client\electron\backend 的所有路由
2.2 实现可以加载静态文件目录,使其可以加载 步骤1 中发布出来的react 项目
3、按照上面的思路实现本项目打包发布为网页服务
4、解决 react 和 backend 中对于electron 的依赖,按照运行的平台环境执行不同的兼容代码


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Jan 14, 2026
Copilot AI and others added 7 commits January 14, 2026 04:00
Co-authored-by: ojama <1772946+ojama@users.noreply.github.com>
Co-authored-by: ojama <1772946+ojama@users.noreply.github.com>
Co-authored-by: ojama <1772946+ojama@users.noreply.github.com>
Co-authored-by: ojama <1772946+ojama@users.noreply.github.com>
Co-authored-by: ojama <1772946+ojama@users.noreply.github.com>
Co-authored-by: ojama <1772946+ojama@users.noreply.github.com>
Co-authored-by: ojama <1772946+ojama@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for web mode and standalone server script Add standalone web server mode with platform-aware Electron abstraction Jan 14, 2026
Copilot AI requested a review from ojama January 14, 2026 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants