* 读取当前浏览器窗口的 URL * - macOS: AppleScript 读取当前前台标签页 URL * - Windows: 原生层读取当前浏览器地址栏 URL * - Linux: 不支持
()
| 159 | * - Linux: 不支持 |
| 160 | */ |
| 161 | private async readCurrentBrowserUrl(): Promise<string> { |
| 162 | const currentPlatform = os.platform() |
| 163 | |
| 164 | if (currentPlatform === 'darwin') { |
| 165 | return this.readCurrentBrowserUrlMac() |
| 166 | } else if (currentPlatform === 'win32') { |
| 167 | return this.readCurrentBrowserUrlWindows() |
| 168 | } else { |
| 169 | throw new Error('该平台不支持') |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * macOS: 通过 AppleScript 查询 Finder 前台窗口路径 |
no test coverage detected