feat: import local browser core

This commit is contained in:
ant-black
2026-06-28 22:26:33 +08:00
parent 36f17d1964
commit 0cd4a9df3b
6 changed files with 260 additions and 148 deletions
+79
View File
@@ -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 {
@@ -71,6 +71,14 @@ export async function scanBrowserCores(): Promise<BrowserCore[]> {
return getMockCores()
}
export async function importLocalBrowserCore(): Promise<BrowserCore | null> {
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<boolean> {
const bindings: any = await getBindings()
if (bindings?.BrowserCoreDownload) {
@@ -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<CoreDisplayInfo[]>([])
const [loading, setLoading] = useState(true)
const [scanning, setScanning] = useState(false)
const [importing, setImporting] = useState(false)
// 全局设置状态
const [settings, setSettings] = useState<BrowserSettings>({
@@ -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() {
</div>
<div className="flex gap-2">
<Button size="sm" variant="secondary" onClick={handleOpenDownload}></Button>
<Button size="sm" variant="secondary" onClick={handleImportLocal} loading={importing}></Button>
<Button size="sm" variant="secondary" onClick={handleScan} loading={scanning}></Button>
<Button size="sm" onClick={handleAdd}></Button>
</div>
+2
View File
@@ -88,6 +88,8 @@ export function BrowserCoreDownload(arg1:string,arg2:string,arg3:string):Promise
export function BrowserCoreExtendedInfo():Promise<Array<browser.CoreExtendedInfo>>;
export function BrowserCoreImportLocal():Promise<config.BrowserCore>;
export function BrowserCoreList():Promise<Array<config.BrowserCore>>;
export function BrowserCoreRedownload(arg1:string,arg2:string,arg3:string):Promise<void>;
+4
View File
@@ -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']();
}
+148 -147
View File
@@ -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<string, string>;
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<string, any>;
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<string, any>;
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<string, any>;
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 {
}
}