resource settings page
This commit is contained in:
@@ -19,6 +19,7 @@ export type TerminalViewProps = {
|
||||
sessionId?: string;
|
||||
sandboxed?: boolean;
|
||||
cwd?: string;
|
||||
command?: string;
|
||||
fontSize?: number;
|
||||
fontFamily?: string;
|
||||
theme?: TerminalTheme;
|
||||
@@ -35,7 +36,7 @@ const DEFAULT_THEME: Required<TerminalTheme> = {
|
||||
selectionBackground: '#3a3a5e',
|
||||
};
|
||||
|
||||
const buildWsUrl = (wsPath: string, sessionId?: string, sandboxed?: boolean, cwd?: string) => {
|
||||
const buildWsUrl = (wsPath: string, sessionId?: string, sandboxed?: boolean, cwd?: string, command?: string) => {
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const token = localStorage.getItem('BEARER_TOKEN') ?? '';
|
||||
const separator = wsPath.includes('?') ? '&' : '?';
|
||||
@@ -43,6 +44,7 @@ const buildWsUrl = (wsPath: string, sessionId?: string, sandboxed?: boolean, cwd
|
||||
if (sessionId) url += `&sessionId=${encodeURIComponent(sessionId)}`;
|
||||
if (sandboxed === false) url += '&sandboxed=false';
|
||||
if (cwd) url += `&cwd=${encodeURIComponent(cwd)}`;
|
||||
if (command) url += `&command=${encodeURIComponent(command)}`;
|
||||
return url;
|
||||
};
|
||||
|
||||
@@ -53,6 +55,7 @@ export const TerminalView = ({
|
||||
sessionId,
|
||||
sandboxed = true,
|
||||
cwd,
|
||||
command,
|
||||
fontSize = 14,
|
||||
fontFamily = 'Menlo, Monaco, "Courier New", monospace',
|
||||
theme,
|
||||
@@ -116,7 +119,7 @@ export const TerminalView = ({
|
||||
fitAddonRef.current = fitAddon;
|
||||
onReadyRef.current?.(term);
|
||||
|
||||
const ws = new WebSocket(buildWsUrl(wsPath, sessionId, sandboxed, cwd));
|
||||
const ws = new WebSocket(buildWsUrl(wsPath, sessionId, sandboxed, cwd, command));
|
||||
wsRef.current = ws;
|
||||
|
||||
const handleOpen = () => {
|
||||
@@ -191,6 +194,7 @@ export const TerminalView = ({
|
||||
sessionId,
|
||||
sandboxed,
|
||||
cwd,
|
||||
command,
|
||||
fontSize,
|
||||
fontFamily,
|
||||
background,
|
||||
|
||||
Reference in New Issue
Block a user