Files
ewoooc/n8n-workflows/15-windows-remote-control.json
ogt 1b4f3a7bbe
Some checks failed
CD Pipeline / deploy (push) Failing after 59s
feat: EwoooC 初始化 — 完整專案推版至 Gitea
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml)
- 部署模式: rsync Python 檔案至 188 → docker restart (volume mount)
- Dockerfile/requirements 變動時自動重建 Docker image
- 部署通知: Telegram (開始/成功/失敗)
- 健康檢查: https://mo.wooo.work/health (最多 5 次重試)
- 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 01:21:13 +08:00

207 lines
6.7 KiB
JSON
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"name": "Windows 遠端控制 (Telegram)",
"nodes": [
{
"parameters": {
"updates": ["message"],
"additionalFields": {}
},
"id": "telegram-trigger",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1.1,
"position": [250, 300],
"webhookId": "windows-control-webhook",
"credentials": {
"telegramApi": {
"id": "telegram-bot",
"name": "WOOO Telegram Bot"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": false
},
"conditions": [
{
"id": "condition-windows",
"leftValue": "={{ $json.message.text }}",
"rightValue": "windows",
"operator": {
"type": "string",
"operation": "contains"
}
},
{
"id": "condition-chrome",
"leftValue": "={{ $json.message.text }}",
"rightValue": "chrome",
"operator": {
"type": "string",
"operation": "contains"
}
},
{
"id": "condition-search",
"leftValue": "={{ $json.message.text }}",
"rightValue": "搜尋",
"operator": {
"type": "string",
"operation": "contains"
}
}
],
"combinator": "or"
}
},
"id": "if-windows",
"name": "是 Windows 指令?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [470, 300]
},
{
"parameters": {
"jsCode": "// 解析用戶訊息,轉換為 Windows 指令\nconst message = $input.first().json.message.text.toLowerCase();\nlet command = '';\nlet description = '';\n\n// 搜尋模式\nconst searchMatch = message.match(/搜尋[\\s]*[「「]?([^」」]+)[」」]?/i) || \n message.match(/search[\\s]+(.+)/i) ||\n message.match(/chrome[\\s]+(.+)/i);\n\nif (searchMatch) {\n const query = encodeURIComponent(searchMatch[1].trim());\n command = `start chrome https://www.google.com/search?q=${query}`;\n description = `搜尋: ${searchMatch[1]}`;\n} else if (message.includes('開啟 chrome') || message.includes('打開 chrome')) {\n command = 'start chrome';\n description = '開啟 Chrome 瀏覽器';\n} else if (message.includes('關閉 chrome') || message.includes('close chrome')) {\n command = 'taskkill /IM chrome.exe /F';\n description = '關閉 Chrome 瀏覽器';\n} else if (message.includes('系統資訊') || message.includes('systeminfo')) {\n command = 'systeminfo | findstr /C:\"OS\" /C:\"Memory\"';\n description = '查看系統資訊';\n} else if (message.includes('程式列表') || message.includes('tasklist')) {\n command = 'tasklist | findstr chrome';\n description = '查看執行中的程式';\n} else {\n // 預設:嘗試搜尋最後的關鍵字\n const words = message.replace(/windows|電腦|上|用|chrome|搜尋|在/gi, '').trim();\n if (words) {\n const query = encodeURIComponent(words);\n command = `start chrome https://www.google.com/search?q=${query}`;\n description = `搜尋: ${words}`;\n }\n}\n\nreturn {\n command,\n description,\n chatId: $input.first().json.message.chat.id,\n originalMessage: $input.first().json.message.text\n};"
},
"id": "parse-command",
"name": "解析指令",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [690, 200]
},
{
"parameters": {
"command": "={{ 'ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 administrator@192.168.0.99 \"' + $json.command + '\"' }}"
},
"id": "ssh-execute",
"name": "SSH 執行指令",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [910, 200]
},
{
"parameters": {
"chatId": "={{ $('解析指令').item.json.chatId }}",
"text": "=✅ **Windows 遠端控制**\n\n📝 動作: {{ $('解析指令').item.json.description }}\n💻 電腦: WOOO-SUPER (192.168.0.99)\n\n{{ $json.stdout ? '📤 輸出:\\n```\\n' + $json.stdout.substring(0, 500) + '\\n```' : '✔️ 指令已執行' }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"id": "telegram-success",
"name": "回報成功",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [1130, 200],
"credentials": {
"telegramApi": {
"id": "telegram-bot",
"name": "WOOO Telegram Bot"
}
}
},
{
"parameters": {
"chatId": "={{ $('解析指令').item.json.chatId }}",
"text": "=❌ **執行失敗**\n\n📝 動作: {{ $('解析指令').item.json.description }}\n⚠ 錯誤: {{ $json.stderr || '無法連線到 Windows 電腦' }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"id": "telegram-error",
"name": "回報錯誤",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [1130, 400],
"credentials": {
"telegramApi": {
"id": "telegram-bot",
"name": "WOOO Telegram Bot"
}
}
},
{
"parameters": {},
"id": "no-op",
"name": "忽略 (非 Windows 指令)",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [690, 400]
}
],
"connections": {
"Telegram Trigger": {
"main": [
[
{
"node": "是 Windows 指令?",
"type": "main",
"index": 0
}
]
]
},
"是 Windows 指令?": {
"main": [
[
{
"node": "解析指令",
"type": "main",
"index": 0
}
],
[
{
"node": "忽略 (非 Windows 指令)",
"type": "main",
"index": 0
}
]
]
},
"解析指令": {
"main": [
[
{
"node": "SSH 執行指令",
"type": "main",
"index": 0
}
]
]
},
"SSH 執行指令": {
"main": [
[
{
"node": "回報成功",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [
{
"name": "Windows",
"id": "windows"
},
{
"name": "Telegram",
"id": "telegram"
}
],
"triggerCount": 1,
"meta": {
"instanceId": "momo-n8n"
}
}