jim800121chen 8cd5751ce3 feat(local-tool): M8 重構 — Wails 控制台 + 瀏覽器 Web UI(R5 決策)
依 R5 五輪決策把 visionA-local 從「Wails 內嵌 Next.js」重構為「Wails
本機伺服器控制台 + 瀏覽器 Web UI」模式(類比 Docker Desktop / Ollama)。

程式碼變動
  - M8-1 砍 yt-dlp 全套(後端 resolver / URL handler / 前端 URL tab /
    Makefile vendor / installer / bootstrap / CI workflow,-555 行)
  - M8-2 砍 Mock 模式全套(driver/mock、mock_camera、Settings runtimeMode、
    VISIONA_MOCK 環境變數,-528 行)
  - M8-3 ffmpeg 從 GPL 切換到 LGPL 混合方案:Windows/Linux 用 BtbN 現成
    LGPL binary,macOS 自 build minimal decoder-only 進 git
    (vendor/ffmpeg/macos/ffmpeg 5.7MB + ffprobe 5.6MB,比 GPL 版省 85% 空間)
  - M8-4 Wails Server Controller:state machine、log ring buffer 2000 行、
    preferences.json atomic write、boot-id、Gin SkipPaths、shutdown 7+1 秒、
    notify_*.go 三平台 OS 通知、watchServer 改 Error state 不 os.Exit
  - M8-4b 啟動階段管線 R5-E:6 階段進度 event、20s soft / 60s hard timeout、
    stage 5/6 skip 規則、sentinel file、RestartStartupSequence 5 步驟
  - M8-5 Wails 控制台 vanilla HTML/JS/CSS(9 檔 ~2012 行)取代 M7-B splash:
    state 視覺、log panel、startup progress panel、Stage 6 manual CTA
    pulse、shutdown modal、Settings、Dark Mode、i18n 中英雙語
  - M8-6 上傳影片副檔名擴充(mp4/avi/mov/mpeg/mpg)
  - M8-7 Web UI Server Offline Overlay(role=alertdialog + focus trap +
    wsEverConnected 容錯 + Page Visibility)
  - M8-8 CORS middleware(127.0.0.1/localhost only + suffix attack 防護)+
    ws/origin.go 獨立 WebSocket CheckOrigin 避 package cycle
  - MAJ-4 server:shutdown-imminent WebSocket broadcast 機制
    (/ws/system endpoint + notifyShutdownImminent helper)
  - M8-9 Boot-ID + 瀏覽器 tab 自動重連(sessionStorage loop guard)

品質
  - ~105+ 新 unit test + race detector (-count=2) 全綠
  - 10 個 milestone 全部通過 Reviewer 審查
  - 三方 v2 + v2.1 文件(PRD / Design Spec / TDD)+ 交叉互審紀錄
    收錄在 .autoflow/

交付前待處理(M8-10)
  - 重跑 make payload-macos 把舊 GPL 77MB binary 換成新 LGPL
  - 三平台 end-to-end build 驗證

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 17:57:54 +08:00

122 lines
6.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

; visionA-local Windows installer
; Inno Setup 6.x compatible
;
; 此檔案在 macOS 上只做語法檢視,實際編譯必須在 Windows runner 上跑:
; iscc installer\windows\visiona-local.iss
;
; 前置作業(在 Windows runner 上):
; 1. make payload-windows — 準備 payload/windows/
; 2. make wails-windows — build visiona-local/build/bin/visiona-local.exe
; 3. go build server/ — build payload/windows/bin/visiona-local-server.exe
; 4. make exe — 執行 iscc 編譯本檔
;
; 所有路徑相對於本 .iss 所在目錄 (installer/windows/)
; 因此 ..\.. 會指回專案根目錄 (local-tool/)
#define MyAppName "visionA Local"
#define MyAppVersion "0.1.0"
#define MyAppPublisher "Innovedus"
#define MyAppURL "https://github.com/Innovedus/visiona-local"
#define MyAppExeName "visiona-local.exe"
#define MyAppIcon "..\..\branding\icon.ico"
[Setup]
; AppId 固定 GUID產品識別用未來升級時不可更動
AppId={{B7E5C4F3-1234-5678-90AB-CDEF12345678}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\visiona-local
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
; 需要管理員權限安裝 WinUSB driver
PrivilegesRequired=admin
PrivilegesRequiredOverridesAllowed=dialog
OutputDir=..\..\dist
OutputBaseFilename=visiona-local-{#MyAppVersion}-windows-x64
Compression=lzma2/ultra
SolidCompression=yes
WizardStyle=modern
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
; Installer 自身 icon
SetupIconFile={#MyAppIcon}
; 解除安裝程式在「設定 > 應用程式」顯示的 icon
UninstallDisplayIcon={app}\{#MyAppExeName}
; Windows 10 1809 以上WinUSB / pnputil 需求)
MinVersion=10.0.17763
; 不需要 code signing使用者決策 Q2=C
; 解除安裝時不清使用者 %APPDATA% 資料
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
; 繁體中文語系Inno Setup 6.3+ 官方只內建簡體中文ChineseSimplified.isl
; 繁體中文需額外從 https://jrsoftware.org/files/istrans/ 下載放到 Languages/
; 若存在則載入,不存在就只用英文(透過 -d 或環境變數 override 也可)
; 使用 /DWITH_TRAD_CHINESE=1 並確認 Languages\ChineseTraditional.isl 存在才啟用
#ifdef WITH_TRAD_CHINESE
Name: "tradchinese"; MessagesFile: "compiler:Languages\ChineseTraditional.isl"
#endif
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
; ── Wails app binary ──────────────────────────────────────────────
Source: "..\..\visiona-local\build\bin\visiona-local.exe"; DestDir: "{app}"; Flags: ignoreversion
; ── Server binaryGo build必須在 Windows runner 上 GOOS=windows go build──
Source: "..\..\payload\windows\bin\visiona-local-server.exe"; DestDir: "{app}\bin"; Flags: ignoreversion
; ── ffmpeg + ffprobe ─────────────────────────────────────────────
; ffmpeg 為 LGPL v3 buildBtbN n7.1v2 TDD §3附上 LGPL 授權條款
Source: "..\..\payload\windows\bin\ffmpeg.exe"; DestDir: "{app}\bin"; Flags: ignoreversion
Source: "..\..\payload\windows\bin\ffprobe.exe"; DestDir: "{app}\bin"; Flags: ignoreversion
Source: "..\..\payload\windows\bin\ffmpeg-LICENSE.txt"; DestDir: "{app}\bin"; Flags: ignoreversion skipifsourcedoesntexist
Source: "..\..\payload\windows\bin\ffmpeg-COPYING.LGPLv3"; DestDir: "{app}\bin"; Flags: ignoreversion skipifsourcedoesntexist
; ── Python runtime tarball + wheels ───────────────────────────────
Source: "..\..\payload\windows\python\python.tar.gz"; DestDir: "{app}\python"; Flags: ignoreversion
Source: "..\..\payload\windows\wheels\*"; DestDir: "{app}\wheels"; Flags: ignoreversion recursesubdirs createallsubdirs
; ── 預置模型與 scripts ────────────────────────────────────────────
Source: "..\..\payload\windows\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\..\payload\windows\scripts\*"; DestDir: "{app}\scripts"; Flags: ignoreversion recursesubdirs createallsubdirs
; ── WinUSB driverKneron KL520/KL720────────────────────────────
Source: "..\..\payload\windows\scripts\drivers\kneron_winusb.inf"; DestDir: "{app}\drivers"; Flags: ignoreversion
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
; 注意WinUSB driver 安裝**不在 installer 階段做**。
; 原因inf-based 安裝需要 .cat + Microsoft attestation signing未簽章的 .inf 會被
; Windows 10/11 的 driver signing enforcement 擋掉。
; 改為Wails app 首次啟動時(或使用者手動點「安裝 driver」按鈕時透過
; KneronPLUS SDK 的 kp.core.install_driver_for_windows() 呼叫 libwdi 完成,
; libwdi 會自動處理臨時自簽憑證,不需要 .cat 檔。
; 需要 UAC elevationWails app 會彈提權對話框。
; 安裝完畢選擇性啟動 app
Filename: "{app}\{#MyAppExeName}"; \
Description: "{cm:LaunchProgram,{#MyAppName}}"; \
Flags: nowait postinstall skipifsilent
[UninstallDelete]
; 解除安裝時清掉 Python 解壓後的目錄(首次啟動會重建)
; 但不動 %APPDATA%\visiona-local使用者資料
Type: filesandordirs; Name: "{app}\python\extracted"
[Code]
// 目前保留空殼,未來若要偵測舊版 edge-ai-platform 並建議移除可在此擴充
function InitializeSetup(): Boolean;
begin
Result := True;
end;