mirror of
https://github.com/louislam/dockge.git
synced 2026-05-22 14:32:16 +00:00
npm audit fixes, eslint fixes, console warning v-html directive xss vulnerabilty warning fix, and code optimizations
This commit is contained in:
@@ -20,22 +20,24 @@ export default {
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
require: true,
|
||||
required: true,
|
||||
},
|
||||
|
||||
endpoint: {
|
||||
type: String,
|
||||
require: true,
|
||||
required: true,
|
||||
},
|
||||
|
||||
// Require if mode is interactive
|
||||
stackName: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
|
||||
// Require if mode is interactive
|
||||
serviceName: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
|
||||
// Require if mode is interactive
|
||||
@@ -102,7 +104,7 @@ export default {
|
||||
this.terminal.focus();
|
||||
|
||||
// Add right-click context menu handler for paste
|
||||
this.$refs.terminal.addEventListener('contextmenu', this.handleContextMenu);
|
||||
this.$refs.terminal.addEventListener("contextmenu", this.handleContextMenu);
|
||||
|
||||
// Add selection handler for copy to clipboard
|
||||
this.terminal.onSelectionChange(() => {
|
||||
@@ -143,7 +145,7 @@ export default {
|
||||
window.removeEventListener("resize", this.onResizeEvent); // Remove the resize event listener from the window object.
|
||||
this.$root.unbindTerminal(this.name);
|
||||
this.terminal.dispose();
|
||||
this.$refs.terminal?.removeEventListener('contextmenu', this.handleContextMenu);
|
||||
this.$refs.terminal?.removeEventListener("contextmenu", this.handleContextMenu);
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -206,7 +208,7 @@ export default {
|
||||
const afterCursor = this.terminalInputBuffer.slice(this.cursorPosition);
|
||||
this.terminalInputBuffer = beforeCursor + afterCursor;
|
||||
this.cursorPosition--;
|
||||
|
||||
|
||||
// Redraw the line
|
||||
this.terminal.write("\b" + afterCursor + " \b".repeat(afterCursor.length + 1));
|
||||
}
|
||||
@@ -216,7 +218,7 @@ export default {
|
||||
const beforeCursor = this.terminalInputBuffer.slice(0, this.cursorPosition);
|
||||
const afterCursor = this.terminalInputBuffer.slice(this.cursorPosition + 1);
|
||||
this.terminalInputBuffer = beforeCursor + afterCursor;
|
||||
|
||||
|
||||
// Redraw the line from cursor position
|
||||
this.terminal.write(afterCursor + " \b".repeat(afterCursor.length + 1));
|
||||
}
|
||||
@@ -312,19 +314,19 @@ export default {
|
||||
// For main terminal, insert text at current cursor position
|
||||
const beforeCursor = this.terminalInputBuffer.slice(0, this.cursorPosition);
|
||||
const afterCursor = this.terminalInputBuffer.slice(this.cursorPosition);
|
||||
|
||||
|
||||
// Update the buffer with inserted text
|
||||
this.terminalInputBuffer = beforeCursor + text + afterCursor;
|
||||
|
||||
|
||||
// Clear the current line and rewrite it
|
||||
this.clearCurrentLine();
|
||||
this.terminal.write(this.terminalInputBuffer);
|
||||
|
||||
|
||||
// Move cursor to the correct position (after the pasted text)
|
||||
this.cursorPosition += text.length;
|
||||
const backspaces = "\b".repeat(afterCursor.length);
|
||||
this.terminal.write(backspaces);
|
||||
|
||||
|
||||
} else if (this.mode === "interactive") {
|
||||
// For interactive terminal, send directly to server
|
||||
this.$root.emitAgent(this.endpoint, "terminalInput", this.name, text, (res) => {
|
||||
@@ -341,7 +343,7 @@ export default {
|
||||
handleContextMenu(event) {
|
||||
// Prevent default context menu
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
// Only handle paste for modes that support input
|
||||
if (this.mode === "mainTerminal" || this.mode === "interactive") {
|
||||
this.handlePaste();
|
||||
|
||||
Reference in New Issue
Block a user