feat: add support for ignoring HTTPS certificate errors (#93)
* feat: add support for ignoring HTTPS certificate errors * fix: update warning message for already running daemon to include ignore HTTPS errors option * docs: add documentation for --ignore-https-errors option in README and SKILL.md * feat: initialize ignore_https_errors flag in command context * fix: change launch_cmd to mutable for cdp value handling
This commit is contained in:
@@ -883,6 +883,7 @@ export class BrowserManager {
|
||||
extraHTTPHeaders: options.headers,
|
||||
userAgent: options.userAgent,
|
||||
...(options.proxy && { proxy: options.proxy }),
|
||||
ignoreHTTPSErrors: options.ignoreHTTPSErrors ?? false,
|
||||
}
|
||||
);
|
||||
this.isPersistentContext = true;
|
||||
@@ -910,6 +911,7 @@ export class BrowserManager {
|
||||
extraHTTPHeaders: options.headers,
|
||||
userAgent: options.userAgent,
|
||||
...(options.proxy && { proxy: options.proxy }),
|
||||
ignoreHTTPSErrors: options.ignoreHTTPSErrors ?? false,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -248,6 +248,7 @@ export async function startDaemon(options?: { streamPort?: number }): Promise<vo
|
||||
}
|
||||
: undefined;
|
||||
|
||||
const ignoreHTTPSErrors = process.env.AGENT_BROWSER_IGNORE_HTTPS_ERRORS === '1';
|
||||
await browser.launch({
|
||||
id: 'auto',
|
||||
action: 'launch' as const,
|
||||
@@ -257,6 +258,7 @@ export async function startDaemon(options?: { streamPort?: number }): Promise<vo
|
||||
args,
|
||||
userAgent: process.env.AGENT_BROWSER_USER_AGENT,
|
||||
proxy,
|
||||
ignoreHTTPSErrors: ignoreHTTPSErrors,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -510,6 +510,27 @@ describe('parseCommand', () => {
|
||||
const result = parseCommand(cmd({ id: '1', action: 'launch', cdpPort: 'invalid' }));
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
|
||||
it('should parse launch with ignoreHTTPSErrors true', () => {
|
||||
const result = parseCommand(cmd({ id: '1', action: 'launch', ignoreHTTPSErrors: true }));
|
||||
expect(result.success).toBe(true);
|
||||
if (result.success) {
|
||||
expect(result.command.ignoreHTTPSErrors).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it('should parse launch with ignoreHTTPSErrors false', () => {
|
||||
const result = parseCommand(cmd({ id: '1', action: 'launch', ignoreHTTPSErrors: false }));
|
||||
expect(result.success).toBe(true);
|
||||
if (result.success) {
|
||||
expect(result.command.ignoreHTTPSErrors).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it('should reject launch with non-boolean ignoreHTTPSErrors', () => {
|
||||
const result = parseCommand(cmd({ id: '1', action: 'launch', ignoreHTTPSErrors: 'true' }));
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('mouse actions', () => {
|
||||
|
||||
@@ -45,6 +45,7 @@ const launchSchema = baseCommandSchema.extend({
|
||||
args: z.array(z.string()).optional(),
|
||||
userAgent: z.string().optional(),
|
||||
provider: z.string().optional(),
|
||||
ignoreHTTPSErrors: z.boolean().optional(),
|
||||
});
|
||||
|
||||
const navigateSchema = baseCommandSchema.extend({
|
||||
|
||||
@@ -27,6 +27,7 @@ export interface LaunchCommand extends BaseCommand {
|
||||
args?: string[];
|
||||
userAgent?: string;
|
||||
provider?: string;
|
||||
ignoreHTTPSErrors?: boolean;
|
||||
}
|
||||
|
||||
export interface NavigateCommand extends BaseCommand {
|
||||
|
||||
Reference in New Issue
Block a user