mirror of
https://github.com/wavetermdev/waveterm
synced 2026-05-24 09:18:27 +00:00
Big simplification. Remove the FileShare interface that abstracted wsh://, s3://, and wavefile:// files. It produced a lot of complexity for very little usage. We're just going to focus on the wsh:// implementation since that's core to our remote workflows. * remove s3 implementation (and connections, and picker items for preview) * remove capabilities for FE * remove wavefile backend impl as well * simplify wsh file remote backend * remove ability to copy/move/ls recursively * limit file transfers to 32m the longer term fix here is to use the new streaming RPC primitives. they have full end-to-end flow-control built in and will not create pipeline stalls, blocking other requests, and OOM issues. these other impls had to be removed (or fixed) because transferring large files could cause stalls or crashes with the new router infrastructure.
74 lines
2.3 KiB
TypeScript
74 lines
2.3 KiB
TypeScript
import { createBlock, getApi } from "@/app/store/global";
|
|
import { makeNativeLabel } from "./platformutil";
|
|
import { fireAndForget } from "./util";
|
|
import { formatRemoteUri } from "./waveutil";
|
|
|
|
export function addOpenMenuItems(menu: ContextMenuItem[], conn: string, finfo: FileInfo): ContextMenuItem[] {
|
|
if (!finfo) {
|
|
return menu;
|
|
}
|
|
menu.push({
|
|
type: "separator",
|
|
});
|
|
if (!conn) {
|
|
// TODO: resolve correct host path if connection is WSL
|
|
// if the entry is a directory, reveal it in the file manager, if the entry is a file, reveal its parent directory
|
|
menu.push({
|
|
label: makeNativeLabel(true),
|
|
click: () => {
|
|
getApi().openNativePath(finfo.isdir ? finfo.path : finfo.dir);
|
|
},
|
|
});
|
|
// if the entry is a file, open it in the default application
|
|
if (!finfo.isdir) {
|
|
menu.push({
|
|
label: makeNativeLabel(false),
|
|
click: () => {
|
|
getApi().openNativePath(finfo.path);
|
|
},
|
|
});
|
|
}
|
|
} else {
|
|
menu.push({
|
|
label: "Download File",
|
|
click: () => {
|
|
const remoteUri = formatRemoteUri(finfo.path, conn);
|
|
getApi().downloadFile(remoteUri);
|
|
},
|
|
});
|
|
}
|
|
menu.push({
|
|
type: "separator",
|
|
});
|
|
if (!finfo.isdir) {
|
|
menu.push({
|
|
label: "Open Preview in New Block",
|
|
click: () =>
|
|
fireAndForget(async () => {
|
|
const blockDef: BlockDef = {
|
|
meta: {
|
|
view: "preview",
|
|
file: finfo.path,
|
|
connection: conn,
|
|
},
|
|
};
|
|
await createBlock(blockDef);
|
|
}),
|
|
});
|
|
}
|
|
menu.push({
|
|
label: "Open Terminal Here",
|
|
click: () => {
|
|
const termBlockDef: BlockDef = {
|
|
meta: {
|
|
controller: "shell",
|
|
view: "term",
|
|
"cmd:cwd": finfo.isdir ? finfo.path : finfo.dir,
|
|
connection: conn,
|
|
},
|
|
};
|
|
fireAndForget(() => createBlock(termBlockDef));
|
|
},
|
|
});
|
|
return menu;
|
|
}
|