From fb1c091be9d37216e329fb7a75db59d5ee44850d Mon Sep 17 00:00:00 2001 From: swpa Date: Sat, 30 May 2026 00:42:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(backup):=20=E8=A8=AD=E5=82=99=E7=B5=82?= =?UTF-8?q?=E7=AB=AF=E6=A9=9F=E5=88=86=E9=A0=81=E6=A9=9F=E5=88=B6(Paginati?= =?UTF-8?q?on)=E5=95=8F=E9=A1=8C=E8=99=95=E7=90=86=20-=20=E6=A0=B9?= =?UTF-8?q?=E6=93=9A=20config=5Ftype=20=E5=88=87=E6=8F=9B=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E8=88=87=E6=8C=87=E4=BB=A4=EF=BC=8C=E4=B8=A6=E5=8A=A0?= =?UTF-8?q?=E4=B8=8A=20|=20nomore=20=E9=97=9C=E9=96=89=E5=88=86=E9=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor(backup): 將 CMTS 的 CLI 配置文字轉換為完美的邏輯巢狀 JSON (兩階段解析法) - 階段 0: 預處理 (清理雜訊,移除危險的自動黏合) - 階段 2: 邏輯群組化與字典合併 (保留嚴格型別防護) refactor(ui): 獲取整台 CMTS 的完整配置 (串流進度回報版) - 前端串流接收器 (Streaming UI) fix(ui): 修復 SSH 終端機無底洞溢出與頁籤底部左右捲軸錯位問題 - 於 .xterm 新增 height: 100% 與 box-sizing: border-box,確保終端機畫布完美貼合黑底外框,並將捲動權限成功交還給終端機內部。 --- cmts_scraper.py | 10 +-- index.html | 80 +++++++++------------ routers/config.py | 71 +++++++++++++++++++ shared.py | 60 +++++----------- static/app.js | 166 +++++++++++++++++++++++++++++--------------- static/edit-mode.js | 8 +-- static/style.css | 44 ++++++++++-- 7 files changed, 281 insertions(+), 158 deletions(-) diff --git a/cmts_scraper.py b/cmts_scraper.py index 49da09d..b6b2ed2 100644 --- a/cmts_scraper.py +++ b/cmts_scraper.py @@ -363,15 +363,15 @@ async def fetch_raw_config(host: str, username: str, password: str, config_type: # 🌟 新增這行:剛連線成功後,先清空終端機的登入歡迎詞 (MOTD) 與雜訊 await read_until_quiet(timeout=1.0) - # 關鍵修改:根據 config_type 切換模式與指令 + # 關鍵修改:根據 config_type 切換模式與指令,並加上 | nomore 關閉分頁 if config_type == "full": # 1. 先進入 config 模式 process.stdin.write("config\n") await process.stdin.drain() await read_until_quiet(timeout=1.5) # 等待提示字元變成 (config)# - # 2. 下達 full-configuration 指令 - cmd = "show full-configuration" + # 2. 下達 full-configuration 指令 (🌟 加上 | nomore) + cmd = "show full-configuration | nomore" process.stdin.write(f"{cmd}\n") await process.stdin.drain() raw_output = await read_until_quiet(timeout=3.0) @@ -381,8 +381,8 @@ async def fetch_raw_config(host: str, username: str, password: str, config_type: await process.stdin.drain() else: - # running-config 在一般模式即可下達 - cmd = "show running-config" + # running-config 在一般模式即可下達 (🌟 加上 | nomore) + cmd = "show running-config | nomore" process.stdin.write(f"{cmd}\n") await process.stdin.drain() raw_output = await read_until_quiet(timeout=3.0) diff --git a/index.html b/index.html index 12bc2a1..431fad8 100644 --- a/index.html +++ b/index.html @@ -253,81 +253,67 @@ -