MCPcopy Index your code
hub / github.com/ZToolsCenter/ZTools / readCurrentBrowserUrl

Method readCurrentBrowserUrl

src/main/api/plugin/shell.ts:161–171  ·  view source on GitHub ↗

* 读取当前浏览器窗口的 URL * - macOS: AppleScript 读取当前前台标签页 URL * - Windows: 原生层读取当前浏览器地址栏 URL * - Linux: 不支持

()

Source from the content-addressed store, hash-verified

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 前台窗口路径

Callers 1

setupIPCMethod · 0.95

Calls 2

Tested by

no test coverage detected