diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue
index 4b691bffa..ab5bbef5b 100644
--- a/apps/desktop/src/App.vue
+++ b/apps/desktop/src/App.vue
@@ -1660,6 +1660,7 @@ onUnmounted(() => {
:format-sql-request="formatSqlRequest"
:selected-sql="selectedSql"
:cursor-pos="cursorPos"
+ :block-dangerous-redis-commands="blockDangerousRedisCommands"
@update:active-output-view="activeOutputView = $event"
@fix-with-ai="fixWithAi"
@execute="tryExecute($event)"
diff --git a/apps/desktop/src/components/layout/ContentArea.vue b/apps/desktop/src/components/layout/ContentArea.vue
index c026a8c0b..2c7094f90 100644
--- a/apps/desktop/src/components/layout/ContentArea.vue
+++ b/apps/desktop/src/components/layout/ContentArea.vue
@@ -110,6 +110,7 @@ const props = defineProps<{
formatSqlRequest: { id: number; tabId: string } | null;
selectedSql: string;
cursorPos: number;
+ blockDangerousRedisCommands: boolean;
}>();
const emit = defineEmits<{
@@ -1249,7 +1250,7 @@ defineExpose({ focusSearch, refreshData, handleModRTarget, requestQueryEditorExe
-
+
diff --git a/apps/desktop/src/components/redis/RedisKeyBrowser.vue b/apps/desktop/src/components/redis/RedisKeyBrowser.vue
index 6091931d7..73cec3eee 100644
--- a/apps/desktop/src/components/redis/RedisKeyBrowser.vue
+++ b/apps/desktop/src/components/redis/RedisKeyBrowser.vue
@@ -58,6 +58,7 @@ type RedisCommandHistoryEntry = {
const props = defineProps<{
connectionId: string;
db: number;
+ blockDangerousRedisCommands: boolean;
}>();
const flatKeys = ref([]);
@@ -473,7 +474,7 @@ async function runRedisCommand(command: string) {
const prompt = commandPrompt.value;
commandRunning.value = true;
try {
- const result = await api.redisExecuteCommand(props.connectionId, commandDb.value, command);
+ const result = await api.redisExecuteCommand(props.connectionId, commandDb.value, command, !props.blockDangerousRedisCommands);
appendCommandHistory({
prompt,
command,
@@ -743,6 +744,13 @@ async function executeCommand() {
const safety = classifyRedisCommandSafety(command);
if (safety === "blocked") {
+ if (!props.blockDangerousRedisCommands) {
+ // 安全模式已关闭,放行 blocked 命令
+ commandText.value = "";
+ commandHistoryIndex.value = -1;
+ await runRedisCommand(command);
+ return;
+ }
appendCommandHistory({
prompt: commandPrompt.value,
command,
@@ -754,6 +762,13 @@ async function executeCommand() {
return;
}
if (safety === "confirm") {
+ if (!props.blockDangerousRedisCommands) {
+ // 安全模式已关闭,跳过确认弹窗直接执行
+ commandText.value = "";
+ commandHistoryIndex.value = -1;
+ await runRedisCommand(command);
+ return;
+ }
pendingDanger.value = { kind: "command", command };
showDangerConfirm.value = true;
commandText.value = "";