Edit file: built-in editor + external editor with watch & auto-upload
- Built-in editor (default): large modal with monospace textarea, Cmd+S save, dirty guard; reads/writes through the provider streams so it works on local and remote files identically (2MB cap with a friendly error) - External editor: remote files download to appDataDir/edits/<id>, open via macOS `open -a`, the temp DIR is watched (survives atomic rename-saves) and every save enqueues a normal upload job (progress/errors in the transfer list); watchers + temp dirs are cleaned when the session disconnects - Editor setting: Built-in | Custom with a NATIVE app picker (electrobun openFileDialog, /Applications, .app filter) and reset-to-default - Leftover temp files from a crash prompt for cleanup at boot - F4, toolbar button (mynaFileText), and File > Edit File (Cmd+E) menu entry - README: feature notes + Portability notes (open/start/xdg-open seam documented in code and README per user request) Verified headless against the box: sftp read/write roundtrip incl. UTF-8, size cap, watch->save->auto-upload->remote-updated, session cleanup, orphan listing and clearing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -74,6 +74,28 @@ export type AppRPC = {
|
||||
response: Result<{ settings: AppSettings }>;
|
||||
};
|
||||
saveSettings: { params: { settings: AppSettings }; response: Result };
|
||||
// file editing
|
||||
readFile: {
|
||||
params: { sessionId: string; path: string };
|
||||
response: Result<{ content: string }>;
|
||||
};
|
||||
writeFile: {
|
||||
params: { sessionId: string; path: string; content: string };
|
||||
response: Result;
|
||||
};
|
||||
editExternal: {
|
||||
params: { sessionId: string; path: string };
|
||||
response: Result<{ watching: boolean }>;
|
||||
};
|
||||
pickEditorApp: {
|
||||
params: Record<string, never>;
|
||||
response: Result<{ path: string | null }>;
|
||||
};
|
||||
getEditLeftovers: {
|
||||
params: Record<string, never>;
|
||||
response: Result<{ names: string[] }>;
|
||||
};
|
||||
clearEditLeftovers: { params: Record<string, never>; response: Result };
|
||||
};
|
||||
messages: Record<never, never>;
|
||||
};
|
||||
|
||||
@@ -52,6 +52,10 @@ export interface AppSettings {
|
||||
transferConcurrency: number;
|
||||
/** Remove completed transfers from the list automatically. */
|
||||
autoClearCompleted: boolean;
|
||||
/** Edit files with the built-in editor or an external application. */
|
||||
editor: "builtin" | "custom";
|
||||
/** Full path to the external editor .app; empty = OS default application. */
|
||||
editorApp: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: AppSettings = {
|
||||
@@ -61,6 +65,8 @@ export const DEFAULT_SETTINGS: AppSettings = {
|
||||
transferMode: "single",
|
||||
transferConcurrency: 3,
|
||||
autoClearCompleted: true,
|
||||
editor: "builtin",
|
||||
editorApp: "",
|
||||
};
|
||||
|
||||
export function effectiveConcurrency(settings: AppSettings): number {
|
||||
|
||||
Reference in New Issue
Block a user