дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 09:41:34 +02:00
`openidea-server --web` serves the built frontend and the IDE backend over one HTTP + WebSocket port, directly or behind a reverse proxy that strips or keeps its path prefix. - The rpc dispatcher gains an async `invoke` with a channel sink, so project-host commands, streaming channels and IDE events run over WebSockets as they do over `--stdio`. - Token auth is on by default (a random token unless `--token` or `--no-auth`), binds 127.0.0.1 by default, and WebSocket upgrades must be same-origin. - The browser serves the desktop shell commands with the trust classes the desktop declares (a test keeps them in step), and the desktop menu spec, now in `ide_host::menu`. Recent-project recording and project rename are shared ide-host ops. - WebSocket output is queued without dropping channel data or events. A reloaded page gets back the project its window still has open; after a server restart the page reloads. One tab per window, with Take Over. - Browser fallbacks for the title bar menu, path chooser, clipboard, dialogs, Settings and external links; a reconnecting banner and an unsaved-changes guard. - `scripts/start-web.sh` and the guide (English and Chinese). Co-authored-by: luisfelipe18 <[email protected]>
20 рядки
739 B
TypeScript
20 рядки
739 B
TypeScript
/**
|
|
* Prompts before closing or navigating away from the browser tab in web mode
|
|
* when any open editor document has unsaved changes.
|
|
*/
|
|
import { isWebMode } from "@/platform/webBridge";
|
|
import { maybeEditorService } from "./contributions";
|
|
|
|
export function installWebSessionGuard(): () => void {
|
|
const onBeforeUnload = (e: BeforeUnloadEvent) => {
|
|
if (!isWebMode()) return;
|
|
const editor = maybeEditorService();
|
|
if ((editor?.dirtyDocumentIds?.().length ?? 0) > 0 || (editor?.untitledDirtyDocumentIds?.().length ?? 0) > 0) {
|
|
e.preventDefault();
|
|
e.returnValue = "";
|
|
}
|
|
};
|
|
window.addEventListener("beforeunload", onBeforeUnload);
|
|
return () => window.removeEventListener("beforeunload", onBeforeUnload);
|
|
}
|