From 0cd4a9df3b0f429bc781079f68d1fcee5e7a3ac1 Mon Sep 17 00:00:00 2001 From: ant-black <1016930479@qq.com> Date: Sun, 28 Jun 2026 22:26:33 +0800 Subject: [PATCH] feat: import local browser core --- backend/app_browser_config_api.go | 79 +++++ frontend/src/modules/browser/api/cores.ts | 8 + .../browser/pages/CoreManagementPage.tsx | 20 +- frontend/src/wailsjs/go/main/App.d.ts | 2 + frontend/src/wailsjs/go/main/App.js | 4 + frontend/src/wailsjs/go/models.ts | 295 +++++++++--------- 6 files changed, 260 insertions(+), 148 deletions(-) diff --git a/backend/app_browser_config_api.go b/backend/app_browser_config_api.go index 04a11c19..27698cbf 100644 --- a/backend/app_browser_config_api.go +++ b/backend/app_browser_config_api.go @@ -1,10 +1,14 @@ package backend import ( + "ant-chrome/backend/internal/browser" "ant-chrome/backend/internal/config" "ant-chrome/backend/internal/logger" "fmt" + "path/filepath" "strings" + + wailsruntime "github.com/wailsapp/wails/v2/pkg/runtime" ) func (a *App) GetBrowserSettings() BrowserSettings { @@ -82,6 +86,81 @@ func (a *App) BrowserCoreScan() []BrowserCore { return a.browserMgr.ListCores() } +// BrowserCoreImportLocal 选择一个已解压内核目录并直接注册,不下载、不复制文件。 +func (a *App) BrowserCoreImportLocal() (*BrowserCore, error) { + if a.ctx == nil { + return nil, fmt.Errorf("app context is nil") + } + if a.browserMgr == nil { + return nil, fmt.Errorf("browser manager is nil") + } + + selectedDir, err := wailsruntime.OpenDirectoryDialog(a.ctx, wailsruntime.OpenDialogOptions{ + Title: "选择已解压的 Chrome 内核目录", + }) + if err != nil { + return nil, err + } + selectedDir = strings.TrimSpace(selectedDir) + if selectedDir == "" { + return nil, nil + } + + absDir, err := filepath.Abs(selectedDir) + if err != nil { + return nil, err + } + if _, _, ok := browser.FindCoreExecutable(absDir); !ok { + return nil, fmt.Errorf("所选目录不是有效内核目录:未找到浏览器可执行文件(候选:%s)", strings.Join(browser.CoreExecutableCandidates(), ", ")) + } + + corePath := a.relativeCorePathIfPossible(absDir) + coreName := strings.TrimSpace(filepath.Base(absDir)) + if coreName == "" || coreName == "." || coreName == string(filepath.Separator) { + coreName = "本地内核" + } + + for _, existing := range a.browserMgr.ListCores() { + if normalizeCorePathForCompare(existing.CorePath) == normalizeCorePathForCompare(corePath) { + return &existing, nil + } + } + + input := browser.CoreInput{ + CoreName: coreName, + CorePath: corePath, + IsDefault: len(a.browserMgr.ListCores()) == 0, + } + if err := a.browserMgr.SaveCore(input); err != nil { + return nil, err + } + + for _, saved := range a.browserMgr.ListCores() { + if normalizeCorePathForCompare(saved.CorePath) == normalizeCorePathForCompare(corePath) { + return &saved, nil + } + } + return nil, fmt.Errorf("本地内核已保存但未能读取结果") +} + +func (a *App) relativeCorePathIfPossible(absDir string) string { + for _, root := range []string{a.appRootAbs(), a.appStateRootAbs()} { + root = strings.TrimSpace(root) + if root == "" { + continue + } + rootAbs, err := filepath.Abs(root) + if err != nil { + continue + } + rel, err := filepath.Rel(rootAbs, absDir) + if err == nil && rel != "." && rel != ".." && !strings.HasPrefix(filepath.ToSlash(rel), "../") && !filepath.IsAbs(rel) { + return filepath.ToSlash(rel) + } + } + return absDir +} + // BrowserCoreDownload 在线下载并自动解压配置内核 func (a *App) BrowserCoreDownload(coreName, url, proxyConfig string) error { if a.ctx == nil { diff --git a/frontend/src/modules/browser/api/cores.ts b/frontend/src/modules/browser/api/cores.ts index f1750b13..b27f3f25 100644 --- a/frontend/src/modules/browser/api/cores.ts +++ b/frontend/src/modules/browser/api/cores.ts @@ -71,6 +71,14 @@ export async function scanBrowserCores(): Promise { return getMockCores() } +export async function importLocalBrowserCore(): Promise { + const bindings: any = await getBindings() + if (bindings?.BrowserCoreImportLocal) { + return (await bindings.BrowserCoreImportLocal()) || null + } + return null +} + export async function BrowserCoreDownload(coreName: string, url: string, proxyConfig?: string): Promise { const bindings: any = await getBindings() if (bindings?.BrowserCoreDownload) { diff --git a/frontend/src/modules/browser/pages/CoreManagementPage.tsx b/frontend/src/modules/browser/pages/CoreManagementPage.tsx index 2d82056b..1edf9c5a 100644 --- a/frontend/src/modules/browser/pages/CoreManagementPage.tsx +++ b/frontend/src/modules/browser/pages/CoreManagementPage.tsx @@ -3,7 +3,7 @@ import { FolderOpen } from 'lucide-react' import { Badge, Button, Card, ConfirmModal, Table, toast } from '../../../shared/components' import type { TableColumn } from '../../../shared/components/Table' import type { BrowserCore, BrowserCoreInput, BrowserCoreValidateResult, BrowserSettings, BrowserCoreExtended, BrowserProxy } from '../types' -import { fetchBrowserCores, saveBrowserCore, deleteBrowserCore, setDefaultBrowserCore, validateBrowserCorePath, openCorePath, fetchBrowserSettings, saveBrowserSettings, fetchCoreExtendedInfo, scanBrowserCores, BrowserCoreDownload, fetchBrowserProxies, redownloadBrowserCore } from '../api' +import { fetchBrowserCores, saveBrowserCore, deleteBrowserCore, setDefaultBrowserCore, validateBrowserCorePath, openCorePath, fetchBrowserSettings, saveBrowserSettings, fetchCoreExtendedInfo, scanBrowserCores, importLocalBrowserCore, BrowserCoreDownload, fetchBrowserProxies, redownloadBrowserCore } from '../api' import { EventsOn, EventsOff } from '../../../wailsjs/runtime/runtime' import { CoreDownloadModal } from './coreManagement/CoreDownloadModal' import { CoreEditModal } from './coreManagement/CoreEditModal' @@ -16,6 +16,7 @@ export function CoreManagementPage() { const [displayList, setDisplayList] = useState([]) const [loading, setLoading] = useState(true) const [scanning, setScanning] = useState(false) + const [importing, setImporting] = useState(false) // 全局设置状态 const [settings, setSettings] = useState({ @@ -234,6 +235,22 @@ export function CoreManagementPage() { } } + const handleImportLocal = async () => { + setImporting(true) + try { + const imported = await importLocalBrowserCore() + if (!imported) { + return + } + await loadData() + toast.success(`已导入:${imported.coreName}`) + } catch (error: any) { + toast.error(error?.message || '导入失败') + } finally { + setImporting(false) + } + } + // 新增内核 const handleAdd = () => { setEditingCore(null) @@ -416,6 +433,7 @@ export function CoreManagementPage() {
+
diff --git a/frontend/src/wailsjs/go/main/App.d.ts b/frontend/src/wailsjs/go/main/App.d.ts index 3e29bfc1..d16ef292 100755 --- a/frontend/src/wailsjs/go/main/App.d.ts +++ b/frontend/src/wailsjs/go/main/App.d.ts @@ -88,6 +88,8 @@ export function BrowserCoreDownload(arg1:string,arg2:string,arg3:string):Promise export function BrowserCoreExtendedInfo():Promise>; +export function BrowserCoreImportLocal():Promise; + export function BrowserCoreList():Promise>; export function BrowserCoreRedownload(arg1:string,arg2:string,arg3:string):Promise; diff --git a/frontend/src/wailsjs/go/main/App.js b/frontend/src/wailsjs/go/main/App.js index 8f229493..1c99897e 100755 --- a/frontend/src/wailsjs/go/main/App.js +++ b/frontend/src/wailsjs/go/main/App.js @@ -158,6 +158,10 @@ export function BrowserCoreExtendedInfo() { return window['go']['main']['App']['BrowserCoreExtendedInfo'](); } +export function BrowserCoreImportLocal() { + return window['go']['main']['App']['BrowserCoreImportLocal'](); +} + export function BrowserCoreList() { return window['go']['main']['App']['BrowserCoreList'](); } diff --git a/frontend/src/wailsjs/go/models.ts b/frontend/src/wailsjs/go/models.ts index 5324c326..f84095c6 100755 --- a/frontend/src/wailsjs/go/models.ts +++ b/frontend/src/wailsjs/go/models.ts @@ -1,15 +1,15 @@ export namespace automation { - + export class ScriptPublicAPIVariable { name: string; defaultValue: string; description: string; required: boolean; - + static createFrom(source: any = {}) { return new ScriptPublicAPIVariable(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.name = source["name"]; @@ -28,11 +28,11 @@ export namespace automation { requestBodyText: string; responseBodyText: string; variables: ScriptPublicAPIVariable[]; - + static createFrom(source: any = {}) { return new ScriptPublicAPIConfig(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.enabled = source["enabled"]; @@ -45,7 +45,7 @@ export namespace automation { this.responseBodyText = source["responseBodyText"]; this.variables = this.convertValues(source["variables"], ScriptPublicAPIVariable); } - + convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; @@ -64,18 +64,18 @@ export namespace automation { return a; } } - + export class ScriptSource { type: string; uri: string; ref: string; path: string; importedAt: string; - + static createFrom(source: any = {}) { return new ScriptSource(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.type = source["type"]; @@ -92,11 +92,11 @@ export namespace automation { groupId: string; keywords: string[]; tags: string[]; - + static createFrom(source: any = {}) { return new ScriptTargetSelector(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.code = source["code"]; @@ -112,11 +112,11 @@ export namespace automation { selector: ScriptTargetSelector; templateSelector: ScriptTargetSelector; createNameTemplate: string; - + static createFrom(source: any = {}) { return new ScriptTargetConfig(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.mode = source["mode"]; @@ -124,7 +124,7 @@ export namespace automation { this.templateSelector = this.convertValues(source["templateSelector"], ScriptTargetSelector); this.createNameTemplate = source["createNameTemplate"]; } - + convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; @@ -162,11 +162,11 @@ export namespace automation { source: ScriptSource; createdAt: string; updatedAt: string; - + static createFrom(source: any = {}) { return new ScriptRecord(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.packageFormat = source["packageFormat"]; @@ -188,7 +188,7 @@ export namespace automation { this.createdAt = source["createdAt"]; this.updatedAt = source["updatedAt"]; } - + convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; @@ -220,11 +220,11 @@ export namespace automation { startedAt: string; finishedAt: string; durationMs: number; - + static createFrom(source: any = {}) { return new ScriptRunRecord(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.id = source["id"]; @@ -250,11 +250,11 @@ export namespace automation { useScriptSelector: boolean; useScriptParams: boolean; timeoutMs?: number; - + static createFrom(source: any = {}) { return new ScriptRunRequest(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.scriptId = source["scriptId"]; @@ -267,21 +267,21 @@ export namespace automation { this.timeoutMs = source["timeoutMs"]; } } - - + + } export namespace backend { - + export class AutomationScriptImportIssue { path: string; message: string; - + static createFrom(source: any = {}) { return new AutomationScriptImportIssue(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.path = source["path"]; @@ -292,18 +292,18 @@ export namespace backend { imported: automation.ScriptRecord[]; failed: AutomationScriptImportIssue[]; scanned: number; - + static createFrom(source: any = {}) { return new AutomationScriptBatchImportResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.imported = this.convertValues(source["imported"], automation.ScriptRecord); this.failed = this.convertValues(source["failed"], AutomationScriptImportIssue); this.scanned = source["scanned"]; } - + convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; @@ -322,7 +322,7 @@ export namespace backend { return a; } } - + export class AutomationScriptPublicAPIInvokeInput { url: string; method: string; @@ -330,11 +330,11 @@ export namespace backend { apiKey: string; authHeader: string; timeoutMs: number; - + static createFrom(source: any = {}) { return new AutomationScriptPublicAPIInvokeInput(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.url = source["url"]; @@ -351,11 +351,11 @@ export namespace backend { statusText: string; bodyText: string; bodyJson: any; - + static createFrom(source: any = {}) { return new AutomationScriptPublicAPIInvokeResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.ok = source["ok"]; @@ -372,11 +372,11 @@ export namespace backend { failed: number; skippedList: string[]; failedList: string[]; - + static createFrom(source: any = {}) { return new BookmarkSyncResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.total = source["total"]; @@ -392,11 +392,11 @@ export namespace backend { filePath: string; sizeBytes: number; updatedAt: string; - + static createFrom(source: any = {}) { return new BrowserExtensionManualDownloadFile(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.fileName = source["fileName"]; @@ -411,11 +411,11 @@ export namespace backend { downloadUrl: string; downloadDir: string; fileName: string; - + static createFrom(source: any = {}) { return new BrowserExtensionManualInstallGuide(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.extensionId = source["extensionId"]; @@ -429,11 +429,11 @@ export namespace backend { query: string; useProxy: boolean; proxyConfig: string; - + static createFrom(source: any = {}) { return new BrowserExtensionWebStoreRequest(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.query = source["query"]; @@ -450,11 +450,11 @@ export namespace backend { httpOnly: boolean; secure: boolean; sameSite: string; - + static createFrom(source: any = {}) { return new CookieInfo(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.name = source["name"]; @@ -473,11 +473,11 @@ export namespace backend { profileCount: number; fileCount: number; message: string; - + static createFrom(source: any = {}) { return new ProfilePackageExportResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.cancelled = source["cancelled"]; @@ -493,11 +493,11 @@ export namespace backend { profileMappings: Record; warnings: string[]; message: string; - + static createFrom(source: any = {}) { return new ProfilePackageImportResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.cancelled = source["cancelled"]; @@ -514,11 +514,11 @@ export namespace backend { socksUrl: string; latencyMs: number; error: string; - + static createFrom(source: any = {}) { return new ProxyBridgeWarmupResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.proxyId = source["proxyId"]; @@ -534,11 +534,11 @@ export namespace backend { urls: string[]; concurrency: number; timeoutMs: number; - + static createFrom(source: any = {}) { return new ProxyBrowserProbeRequest(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.proxyId = source["proxyId"]; @@ -558,11 +558,11 @@ export namespace backend { failed: number; concurrency: number; error: string; - + static createFrom(source: any = {}) { return new ProxyBrowserProbeResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.proxyId = source["proxyId"]; @@ -589,11 +589,11 @@ export namespace backend { installDir: string; binaryName: string; message: string; - + static createFrom(source: any = {}) { return new ProxyCoreDownloadInfoResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.core = source["core"]; @@ -615,11 +615,11 @@ export namespace backend { goarch: string; proxyConfig: string; version: string; - + static createFrom(source: any = {}) { return new ProxyCoreDownloadRequest(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.core = source["core"]; @@ -639,11 +639,11 @@ export namespace backend { binaryPath: string; source: string; message: string; - + static createFrom(source: any = {}) { return new ProxyCoreStatusResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.core = source["core"]; @@ -672,11 +672,11 @@ export namespace backend { asOrganization: string; rawData: Record; updatedAt: string; - + static createFrom(source: any = {}) { return new ProxyIPHealthResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.proxyId = source["proxyId"]; @@ -699,11 +699,11 @@ export namespace backend { label: string; timezone: string; lang: string; - + static createFrom(source: any = {}) { return new ProxyLocationOption(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.label = source["label"]; @@ -726,11 +726,11 @@ export namespace backend { health?: ProxyIPHealthResult; alternates?: ProxyLocationOption[]; resolvedAt: string; - + static createFrom(source: any = {}) { return new ProxyLocationResolveResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.proxyId = source["proxyId"]; @@ -748,7 +748,7 @@ export namespace backend { this.alternates = this.convertValues(source["alternates"], ProxyLocationOption); this.resolvedAt = source["resolvedAt"]; } - + convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; @@ -773,11 +773,11 @@ export namespace backend { latencyMs: number; engine: string; error: string; - + static createFrom(source: any = {}) { return new ProxyTestResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.proxyId = source["proxyId"]; @@ -790,11 +790,11 @@ export namespace backend { export class ProxyValidationResult { supported: boolean; errorMsg: string; - + static createFrom(source: any = {}) { return new ProxyValidationResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.supported = source["supported"]; @@ -808,11 +808,11 @@ export namespace backend { sizeMB: number; createdAt: string; filePath?: string; - + static createFrom(source: any = {}) { return new SnapshotInfo(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.snapshotId = source["snapshotId"]; @@ -827,7 +827,7 @@ export namespace backend { } export namespace backup { - + export class ManifestEntry { id: string; category: string; @@ -835,11 +835,11 @@ export namespace backup { required: boolean; archivePath: string; description?: string; - + static createFrom(source: any = {}) { return new ManifestEntry(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.id = source["id"]; @@ -853,11 +853,11 @@ export namespace backup { export class ManifestAppInfo { name: string; version: string; - + static createFrom(source: any = {}) { return new ManifestAppInfo(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.name = source["name"]; @@ -870,11 +870,11 @@ export namespace backup { createdAt: string; app: ManifestAppInfo; entries: ManifestEntry[]; - + static createFrom(source: any = {}) { return new Manifest(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.format = source["format"]; @@ -883,7 +883,7 @@ export namespace backup { this.app = this.convertValues(source["app"], ManifestAppInfo); this.entries = this.convertValues(source["entries"], ManifestEntry); } - + convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; @@ -902,8 +902,8 @@ export namespace backup { return a; } } - - + + export class ScopeEntry { id: string; category: string; @@ -913,11 +913,11 @@ export namespace backup { archivePath: string; exists: boolean; description?: string; - + static createFrom(source: any = {}) { return new ScopeEntry(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.id = source["id"]; @@ -935,11 +935,11 @@ export namespace backup { manifestVersion: number; appRoot: string; entries: ScopeEntry[]; - + static createFrom(source: any = {}) { return new Scope(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.format = source["format"]; @@ -947,7 +947,7 @@ export namespace backup { this.appRoot = source["appRoot"]; this.entries = this.convertValues(source["entries"], ScopeEntry); } - + convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; @@ -970,16 +970,16 @@ export namespace backup { } export namespace browser { - + export class CoreExtendedInfo { coreId: string; chromeVersion: string; instanceCount: number; - + static createFrom(source: any = {}) { return new CoreExtendedInfo(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.coreId = source["coreId"]; @@ -992,11 +992,11 @@ export namespace browser { coreName: string; corePath: string; isDefault: boolean; - + static createFrom(source: any = {}) { return new CoreInput(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.coreId = source["coreId"]; @@ -1008,11 +1008,11 @@ export namespace browser { export class CoreValidateResult { valid: boolean; message: string; - + static createFrom(source: any = {}) { return new CoreValidateResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.valid = source["valid"]; @@ -1031,11 +1031,11 @@ export namespace browser { enabled: boolean; installedAt: string; updatedAt: string; - + static createFrom(source: any = {}) { return new Extension(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.extensionId = source["extensionId"]; @@ -1059,11 +1059,11 @@ export namespace browser { storeUrl: string; installable: boolean; message: string; - + static createFrom(source: any = {}) { return new ExtensionLookupResult(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.extensionId = source["extensionId"]; @@ -1082,11 +1082,11 @@ export namespace browser { sortOrder: number; createdAt: string; updatedAt: string; - + static createFrom(source: any = {}) { return new Group(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.groupId = source["groupId"]; @@ -1101,11 +1101,11 @@ export namespace browser { groupName: string; parentId: string; sortOrder: number; - + static createFrom(source: any = {}) { return new GroupInput(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.groupName = source["groupName"]; @@ -1121,11 +1121,11 @@ export namespace browser { createdAt: string; updatedAt: string; instanceCount: number; - + static createFrom(source: any = {}) { return new GroupWithCount(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.groupId = source["groupId"]; @@ -1165,11 +1165,11 @@ export namespace browser { deletedAt: string; lastStartAt: string; lastStopAt: string; - + static createFrom(source: any = {}) { return new Profile(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.profileId = source["profileId"]; @@ -1204,11 +1204,11 @@ export namespace browser { export class ProfileCopyOptions { mode: string; automationTargets: string[]; - + static createFrom(source: any = {}) { return new ProfileCopyOptions(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.mode = source["mode"]; @@ -1220,11 +1220,11 @@ export namespace browser { configured: boolean; extensionIds: string[]; updatedAt: string; - + static createFrom(source: any = {}) { return new ProfileExtensionSettings(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.profileId = source["profileId"]; @@ -1244,11 +1244,11 @@ export namespace browser { tags: string[]; keywords: string[]; groupId: string; - + static createFrom(source: any = {}) { return new ProfileInput(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.profileName = source["profileName"]; @@ -1273,11 +1273,11 @@ export namespace browser { startReadyTimeoutMs: number; startStableWindowMs: number; defaultConnectorType: string; - + static createFrom(source: any = {}) { return new Settings(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.userDataRoot = source["userDataRoot"]; @@ -1296,11 +1296,11 @@ export namespace browser { title: string; url: string; active: boolean; - + static createFrom(source: any = {}) { return new Tab(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.tabId = source["tabId"]; @@ -1313,16 +1313,16 @@ export namespace browser { } export namespace config { - + export class BrowserBookmark { name: string; url: string; openOnStart: boolean; - + static createFrom(source: any = {}) { return new BrowserBookmark(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.name = source["name"]; @@ -1335,11 +1335,11 @@ export namespace config { coreName: string; corePath: string; isDefault: boolean; - + static createFrom(source: any = {}) { return new BrowserCore(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.coreId = source["coreId"]; @@ -1366,11 +1366,11 @@ export namespace config { lastTestOk: boolean; lastTestedAt: string; lastIPHealthJson?: string; - + static createFrom(source: any = {}) { return new BrowserProxy(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.proxyId = source["proxyId"]; @@ -1400,11 +1400,11 @@ export namespace config { parser?: string; timeoutMs?: number; expectedStatus?: number[]; - + static createFrom(source: any = {}) { return new ProxyCheckTarget(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.id = source["id"]; @@ -1421,11 +1421,11 @@ export namespace config { speedTargetId: string; ipHealthTargetId: string; targets: ProxyCheckTarget[]; - + static createFrom(source: any = {}) { return new ProxyCheckConfig(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.bridgeStartTimeoutMs = source["bridgeStartTimeoutMs"]; @@ -1433,7 +1433,7 @@ export namespace config { this.ipHealthTargetId = source["ipHealthTargetId"]; this.targets = this.convertValues(source["targets"], ProxyCheckTarget); } - + convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; @@ -1456,18 +1456,18 @@ export namespace config { } export namespace launchcode { - + export class LaunchRequestParams { launchArgs: string[]; startUrls: string[]; skipDefaultStartUrls: boolean; proxyId: string; proxyConfig: string; - + static createFrom(source: any = {}) { return new LaunchRequestParams(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.launchArgs = source["launchArgs"]; @@ -1481,18 +1481,18 @@ export namespace launchcode { } export namespace logger { - + export class MemoryLogEntry { time: string; level: string; component: string; message: string; fields?: Record; - + static createFrom(source: any = {}) { return new MemoryLogEntry(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.time = source["time"]; @@ -1503,22 +1503,22 @@ export namespace logger { } } export class MethodInterceptor { - - + + static createFrom(source: any = {}) { return new MethodInterceptor(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); - + } } } export namespace proxy { - + export class DnsDiagnosticSummary { hasConfig: boolean; sourceFormat: string; @@ -1527,11 +1527,11 @@ export namespace proxy { fallbackCount: number; xrayServerCount: number; unsupported: string[]; - + static createFrom(source: any = {}) { return new DnsDiagnosticSummary(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.hasConfig = source["hasConfig"]; @@ -1553,11 +1553,11 @@ export namespace proxy { bridgeAlive: boolean; bridgePort: number; lastError: string; - + static createFrom(source: any = {}) { return new ProxyRuntimeDiagnostic(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.workDir = source["workDir"]; @@ -1588,11 +1588,11 @@ export namespace proxy { outbound: Record; runtime: ProxyRuntimeDiagnostic; errors: string[]; - + static createFrom(source: any = {}) { return new ProxyBuildDiagnostic(source); } - + constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.proxyId = source["proxyId"]; @@ -1612,7 +1612,7 @@ export namespace proxy { this.runtime = this.convertValues(source["runtime"], ProxyRuntimeDiagnostic); this.errors = source["errors"]; } - + convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; @@ -1633,3 +1633,4 @@ export namespace proxy { } } +