feat: add min height and width for camoufox

This commit is contained in:
zhom
2025-08-10 04:46:20 +04:00
parent a9720676ae
commit 92ef2798d2
5 changed files with 75 additions and 5 deletions
+17 -5
View File
@@ -344,6 +344,8 @@ interface GenerateConfigOptions {
proxy?: string;
maxWidth?: number;
maxHeight?: number;
minWidth?: number;
minHeight?: number;
geoip?: string | boolean;
blockImages?: boolean;
blockWebrtc?: boolean;
@@ -411,11 +413,21 @@ export async function generateCamoufoxConfig(
} else {
// Use individual options to build configuration
if (options.maxWidth && options.maxHeight) {
launchOpts.screen = {
maxWidth: options.maxWidth,
maxHeight: options.maxHeight,
};
// Build screen configuration with min/max dimensions
const screen: {
minWidth?: number;
maxWidth?: number;
minHeight?: number;
maxHeight?: number;
} = {};
if (options.minWidth) screen.minWidth = options.minWidth;
if (options.maxWidth) screen.maxWidth = options.maxWidth;
if (options.minHeight) screen.minHeight = options.minHeight;
if (options.maxHeight) screen.maxHeight = options.maxHeight;
if (Object.keys(screen).length > 0) {
launchOpts.screen = screen;
}
}
+10
View File
@@ -165,6 +165,8 @@ program
.option("--proxy <proxy>", "proxy URL for config generation")
.option("--max-width <width>", "maximum screen width", parseInt)
.option("--max-height <height>", "maximum screen height", parseInt)
.option("--min-width <width>", "minimum screen width", parseInt)
.option("--min-height <height>", "minimum screen height", parseInt)
.option("--geoip", "enable geoip")
.option("--block-images", "block images")
.option("--block-webrtc", "block WebRTC")
@@ -384,6 +386,14 @@ program
typeof options.maxHeight === "number"
? options.maxHeight
: undefined,
minWidth:
typeof options.minWidth === "number"
? options.minWidth
: undefined,
minHeight:
typeof options.minHeight === "number"
? options.minHeight
: undefined,
geoip: Boolean(options.geoip),
blockImages:
typeof options.blockImages === "boolean"