camoucore 0.3.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4 -3
- package/dist/camoufox/__main__.d.ts +10 -0
- package/dist/camoufox/__main__.js +1175 -0
- package/dist/camoufox/__version__.d.ts +31 -0
- package/dist/camoufox/__version__.js +32 -0
- package/dist/camoufox/_humanize_playwright.d.ts +54 -0
- package/dist/camoufox/_humanize_playwright.js +429 -0
- package/dist/camoufox/addons.d.ts +21 -0
- package/dist/camoufox/addons.js +56 -0
- package/dist/camoufox/async_api.d.ts +9 -0
- package/dist/camoufox/async_api.js +9 -0
- package/dist/camoufox/browser-pin.d.ts +46 -0
- package/dist/camoufox/browser-pin.js +96 -0
- package/dist/camoufox/cli.d.ts +7 -0
- package/dist/camoufox/cli.js +20 -0
- package/dist/camoufox/coherence.d.ts +141 -0
- package/dist/camoufox/coherence.js +708 -0
- package/dist/camoufox/data-files/audio-output-latency.json +15 -0
- package/dist/camoufox/data-files/browser-pin.json +7 -0
- package/dist/camoufox/data-files/display-profiles.json +6 -0
- package/dist/camoufox/data-files/essential-fonts.json +5 -0
- package/dist/camoufox/data-files/fingerprint-presets-v150.json +14544 -0
- package/dist/camoufox/data-files/fingerprint-presets.json +5192 -0
- package/dist/camoufox/data-files/font-bases.json +1888 -0
- package/dist/camoufox/data-files/font-groups.json +716 -0
- package/dist/camoufox/data-files/font-prefs.json +1046 -0
- package/dist/camoufox/data-files/fonts.json +240 -0
- package/dist/camoufox/data-files/fpgen.yml +44 -0
- package/dist/camoufox/data-files/launcher-constants.json +136 -0
- package/dist/camoufox/data-files/media-devices.json +180 -0
- package/dist/camoufox/data-files/repos.yml +40 -0
- package/dist/camoufox/data-files/voice-manifests.json +1864 -0
- package/dist/camoufox/data-files/voice-uris.json +188 -0
- package/dist/camoufox/data-files/warnings.yml +146 -0
- package/dist/camoufox/display_profile.d.ts +21 -0
- package/dist/camoufox/display_profile.js +129 -0
- package/dist/camoufox/driver_defaults.d.ts +27 -0
- package/dist/camoufox/driver_defaults.js +119 -0
- package/dist/camoufox/exceptions.d.ts +68 -0
- package/dist/camoufox/exceptions.js +122 -0
- package/dist/camoufox/fingerprints.d.ts +434 -0
- package/dist/camoufox/fingerprints.js +1936 -0
- package/dist/camoufox/gpudisplay.d.ts +158 -0
- package/dist/camoufox/gpudisplay.js +695 -0
- package/dist/camoufox/host_rendering.d.ts +38 -0
- package/dist/camoufox/host_rendering.js +180 -0
- package/dist/camoufox/humanize.d.ts +89 -0
- package/dist/camoufox/humanize.js +143 -0
- package/dist/camoufox/index.d.ts +21 -0
- package/dist/camoufox/index.js +21 -0
- package/dist/camoufox/ip.d.ts +45 -0
- package/dist/camoufox/ip.js +114 -0
- package/dist/camoufox/multiversion.d.ts +131 -0
- package/dist/camoufox/multiversion.js +490 -0
- package/dist/camoufox/node-floor.d.ts +5 -0
- package/dist/camoufox/node-floor.js +17 -0
- package/dist/camoufox/paths.d.ts +45 -0
- package/dist/camoufox/paths.js +62 -0
- package/dist/camoufox/pkgman.d.ts +361 -0
- package/dist/camoufox/pkgman.js +1066 -0
- package/dist/camoufox/product.d.ts +8 -0
- package/dist/camoufox/product.js +8 -0
- package/dist/camoufox/pycompat.d.ts +97 -0
- package/dist/camoufox/pycompat.js +458 -0
- package/dist/camoufox/server.d.ts +36 -0
- package/dist/camoufox/server.js +82 -0
- package/dist/camoufox/sync_api.d.ts +77 -0
- package/dist/camoufox/sync_api.js +207 -0
- package/dist/camoufox/utils.d.ts +638 -0
- package/dist/camoufox/utils.js +2507 -0
- package/dist/camoufox/warnings.d.ts +16 -0
- package/dist/camoufox/warnings.js +65 -0
- package/dist/camoufox/webgl.d.ts +52 -0
- package/dist/camoufox/webgl.js +264 -0
- package/dist/camouwolf/__main__.d.ts +10 -0
- package/dist/camouwolf/__main__.js +1180 -0
- package/dist/camouwolf/__version__.d.ts +31 -0
- package/dist/camouwolf/__version__.js +32 -0
- package/dist/camouwolf/_humanize_playwright.d.ts +53 -0
- package/dist/camouwolf/_humanize_playwright.js +427 -0
- package/dist/camouwolf/addons.d.ts +42 -0
- package/dist/camouwolf/addons.js +113 -0
- package/dist/camouwolf/async_api.d.ts +9 -0
- package/dist/camouwolf/async_api.js +9 -0
- package/dist/camouwolf/browser-pin.d.ts +46 -0
- package/dist/camouwolf/browser-pin.js +96 -0
- package/dist/camouwolf/cli.d.ts +7 -0
- package/dist/camouwolf/cli.js +20 -0
- package/dist/camouwolf/clienthints.d.ts +61 -0
- package/dist/camouwolf/clienthints.js +176 -0
- package/dist/camouwolf/coherence.d.ts +152 -0
- package/dist/camouwolf/coherence.js +554 -0
- package/dist/camouwolf/data-files/browser-pin.json +7 -0
- package/dist/camouwolf/data-files/camouwolf.defaults.json +118 -0
- package/dist/camouwolf/data-files/data/bundle-fonts.json +1983 -0
- package/dist/camouwolf/data-files/data/chrome-languages.json +517 -0
- package/dist/camouwolf/data-files/data/properties.json +321 -0
- package/dist/camouwolf/data-files/data/system-colors.json +35 -0
- package/dist/camouwolf/data-files/data/ubo.json +6 -0
- package/dist/camouwolf/data-files/fpgen.yml +41 -0
- package/dist/camouwolf/data-files/launcher-constants.json +26 -0
- package/dist/camouwolf/data-files/repos.yml +23 -0
- package/dist/camouwolf/data-files/warnings.yml +96 -0
- package/dist/camouwolf/driver_defaults.d.ts +25 -0
- package/dist/camouwolf/driver_defaults.js +114 -0
- package/dist/camouwolf/exceptions.d.ts +95 -0
- package/dist/camouwolf/exceptions.js +150 -0
- package/dist/camouwolf/fingerprints.d.ts +227 -0
- package/dist/camouwolf/fingerprints.js +753 -0
- package/dist/camouwolf/gpudisplay.d.ts +171 -0
- package/dist/camouwolf/gpudisplay.js +711 -0
- package/dist/camouwolf/host_rendering.d.ts +18 -0
- package/dist/camouwolf/host_rendering.js +114 -0
- package/dist/camouwolf/humanize.d.ts +84 -0
- package/dist/camouwolf/humanize.js +128 -0
- package/dist/camouwolf/index.d.ts +22 -0
- package/dist/camouwolf/index.js +21 -0
- package/dist/camouwolf/multiversion.d.ts +131 -0
- package/dist/camouwolf/multiversion.js +491 -0
- package/dist/camouwolf/node-floor.d.ts +5 -0
- package/dist/camouwolf/node-floor.js +17 -0
- package/dist/camouwolf/paths.d.ts +34 -0
- package/dist/camouwolf/paths.js +58 -0
- package/dist/camouwolf/pkgman.d.ts +331 -0
- package/dist/camouwolf/pkgman.js +972 -0
- package/dist/camouwolf/product.d.ts +3 -0
- package/dist/camouwolf/product.js +3 -0
- package/dist/camouwolf/pycompat.d.ts +92 -0
- package/dist/camouwolf/pycompat.js +461 -0
- package/dist/camouwolf/server.d.ts +36 -0
- package/dist/camouwolf/server.js +81 -0
- package/dist/camouwolf/switches.d.ts +77 -0
- package/dist/camouwolf/switches.js +222 -0
- package/dist/camouwolf/sync_api.d.ts +84 -0
- package/dist/camouwolf/sync_api.js +173 -0
- package/dist/camouwolf/utils.d.ts +644 -0
- package/dist/camouwolf/utils.js +2057 -0
- package/dist/camouwolf/warnings.d.ts +14 -0
- package/dist/camouwolf/warnings.js +59 -0
- package/dist/camouwolf/webgl.d.ts +41 -0
- package/dist/camouwolf/webgl.js +198 -0
- package/dist/data.d.ts +1 -1
- package/dist/data.js +3 -3
- package/dist/download.js +1 -1
- package/dist/exceptions.d.ts +1 -1
- package/dist/exceptions.js +1 -1
- package/dist/geolocation.js +1 -1
- package/dist/host.js +1 -1
- package/dist/ip.js +1 -1
- package/dist/locales.js +1 -1
- package/dist/mcp/cli.d.ts +15 -0
- package/dist/mcp/cli.js +108 -0
- package/dist/mcp/index.d.ts +8 -0
- package/dist/mcp/index.js +8 -0
- package/dist/mcp/main.d.ts +2 -0
- package/dist/mcp/main.js +8 -0
- package/dist/mcp/secrets.d.ts +50 -0
- package/dist/mcp/secrets.js +193 -0
- package/dist/mcp/server.d.ts +48 -0
- package/dist/mcp/server.js +653 -0
- package/dist/mcp/tree.d.ts +10 -0
- package/dist/mcp/tree.js +36 -0
- package/dist/passthrough.d.ts +1 -1
- package/dist/product.js +1 -1
- package/dist/settings.js +1 -1
- package/dist/telemetry.d.ts +0 -1
- package/dist/telemetry.js +5 -4
- package/dist/virtdisplay.d.ts +1 -1
- package/dist/virtdisplay.js +1 -1
- package/dist/warnings.js +1 -1
- package/package.json +57 -13
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform constants, install paths and the bundled data files. A leaf of the
|
|
3
|
+
* module graph: pkgman.ts and multiversion.ts import each other, and both need
|
|
4
|
+
* these values while they are still being evaluated.
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from "node:fs";
|
|
7
|
+
import * as path from "node:path";
|
|
8
|
+
import { setModelDir } from "fpgen-js";
|
|
9
|
+
import { parse as parseYaml } from "yaml";
|
|
10
|
+
import { PRODUCT } from "./product.js";
|
|
11
|
+
export { rprint, style } from "../download.js";
|
|
12
|
+
export { ARCH_MAP, OS_MAP, OS_NAME, userCacheDir, userConfigDir, } from "../host.js";
|
|
13
|
+
export const INSTALL_DIR = PRODUCT.cacheDir;
|
|
14
|
+
/**
|
|
15
|
+
* The data files both launchers read. They live in python/camoucore/src/camoucore/camoufox/, the one
|
|
16
|
+
* copy in the repo; `pnpm build` copies them into dist/data-files/ for the npm
|
|
17
|
+
* tarball, so one seed draws one identity in either launcher.
|
|
18
|
+
*/
|
|
19
|
+
export const DATA_FILES = [
|
|
20
|
+
"audio-output-latency.json",
|
|
21
|
+
"browser-pin.json",
|
|
22
|
+
"display-profiles.json",
|
|
23
|
+
"essential-fonts.json",
|
|
24
|
+
"fingerprint-presets.json",
|
|
25
|
+
"fingerprint-presets-v150.json",
|
|
26
|
+
"font-bases.json",
|
|
27
|
+
"font-groups.json",
|
|
28
|
+
"font-prefs.json",
|
|
29
|
+
"fonts.json",
|
|
30
|
+
"fpgen.yml",
|
|
31
|
+
"launcher-constants.json",
|
|
32
|
+
"media-devices.json",
|
|
33
|
+
"repos.yml",
|
|
34
|
+
"voice-manifests.json",
|
|
35
|
+
"voice-uris.json",
|
|
36
|
+
"warnings.yml",
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* Where DATA_FILES are read from: dist/data-files/ in a built package, else
|
|
40
|
+
* python/camoucore/src/camoucore/camoufox/ itself when running from src/ in the repo.
|
|
41
|
+
*/
|
|
42
|
+
export const LOCAL_DATA = fs.existsSync(path.join(import.meta.dirname, "data-files"))
|
|
43
|
+
? path.join(import.meta.dirname, "data-files")
|
|
44
|
+
: path.resolve(import.meta.dirname, "..", "..", "..", "..", "python", "camoucore", "src", "camoucore", "camoufox");
|
|
45
|
+
/** A data file (relative to LOCAL_DATA), parsed as YAML or JSON by its extension. */
|
|
46
|
+
export function loadDataFile(file) {
|
|
47
|
+
const text = fs.readFileSync(path.resolve(LOCAL_DATA, file), "utf-8");
|
|
48
|
+
return (file.endsWith(".yml") ? parseYaml(text) : JSON.parse(text));
|
|
49
|
+
}
|
|
50
|
+
export const LAUNCHER_CONSTANTS = loadDataFile("launcher-constants.json");
|
|
51
|
+
// Camoufox keeps the fpgen model in its cache, beside the browsers.
|
|
52
|
+
setModelDir(process.env.CAMOUFOX_FPGEN_DATA || path.join(INSTALL_DIR, "fpgen"));
|
|
53
|
+
export const OS_ARCH_MATRIX = {
|
|
54
|
+
win: ["x86_64", "i686"],
|
|
55
|
+
mac: ["x86_64", "arm64"],
|
|
56
|
+
lin: ["x86_64", "arm64", "i686"],
|
|
57
|
+
};
|
|
58
|
+
export const LAUNCH_FILE = {
|
|
59
|
+
win: "camoufox.exe",
|
|
60
|
+
mac: "../MacOS/camoufox",
|
|
61
|
+
lin: "camoufox-bin",
|
|
62
|
+
};
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import type { Writable } from "node:stream";
|
|
2
|
+
import { type ProgressCallback } from "../download.js";
|
|
3
|
+
export { GITHUB_TOKEN, type ProgressCallback, unzip, verifySha256, } from "../download.js";
|
|
4
|
+
/**
|
|
5
|
+
* Ensure Firefox's Linux application directory exists before startup.
|
|
6
|
+
*
|
|
7
|
+
* Firefox probes ~/.camoufox even when Playwright supplies a temporary profile.
|
|
8
|
+
* On a read-only HOME -- the normal shape for a container that bakes the bundle
|
|
9
|
+
* in as root and runs as a non-root user -- a missing directory makes startup
|
|
10
|
+
* stall with no diagnostic, surfacing as a launch timeout rather than as a
|
|
11
|
+
* permissions error. An existing directory may itself still be read-only, which
|
|
12
|
+
* is fine: Firefox only needs it to be there.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ensureBrowserProfileDir(env?: Record<string, unknown>): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Parse a semver string into a comparable tuple.
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseSemver(version: string): number[];
|
|
19
|
+
/**
|
|
20
|
+
* A comparable browser version string (up to 5 parts).
|
|
21
|
+
*/
|
|
22
|
+
export declare class Version {
|
|
23
|
+
readonly build: string;
|
|
24
|
+
readonly version?: string;
|
|
25
|
+
readonly sortedRel: number[];
|
|
26
|
+
constructor(build: string, version?: string);
|
|
27
|
+
get fullString(): string;
|
|
28
|
+
/** Whether the build channel is alpha (like "alpha.26"). */
|
|
29
|
+
get isAlpha(): boolean;
|
|
30
|
+
compare(other: Version): number;
|
|
31
|
+
equals(other: Version): boolean;
|
|
32
|
+
lessThan(other: Version): boolean;
|
|
33
|
+
greaterOrEqual(other: Version): boolean;
|
|
34
|
+
isSupported(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Read the version from version.json at the given path.
|
|
37
|
+
*/
|
|
38
|
+
static fromPath(dir?: string): Version;
|
|
39
|
+
static buildMinMax(): [Version, Version];
|
|
40
|
+
}
|
|
41
|
+
export declare const VERSION_MIN: Version, VERSION_MAX: Version;
|
|
42
|
+
/**
|
|
43
|
+
* Seams the Python tests reach with monkeypatch (VERSION_MIN,
|
|
44
|
+
* _resolved_playwright_version, CamoufoxFetcher). Production code never
|
|
45
|
+
* reassigns these.
|
|
46
|
+
*/
|
|
47
|
+
export declare const pkgmanDeps: {
|
|
48
|
+
versionMin: () => Version;
|
|
49
|
+
resolvedPlaywrightVersion: () => number[] | null;
|
|
50
|
+
/** The fetcher the auto-install path runs `install()` on. */
|
|
51
|
+
newFetcher: () => Promise<{
|
|
52
|
+
install(): Promise<unknown>;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The resolved playwright-core version string, or null when it cannot be read.
|
|
57
|
+
* The Python twin asks importlib.metadata for `playwright`; the npm package
|
|
58
|
+
* that plays that role here is playwright-core.
|
|
59
|
+
*/
|
|
60
|
+
export declare function resolvedPlaywrightVersionRaw(): string | null;
|
|
61
|
+
/** An installed npm package's version, or null if it cannot be read. */
|
|
62
|
+
export declare function installedPackageVersion(name: string): string | null;
|
|
63
|
+
/** The installed Playwright version, or null if it cannot be determined. */
|
|
64
|
+
export declare function resolvedPlaywrightVersion(): number[] | null;
|
|
65
|
+
/** The installed Playwright version for messages ("the installed version"
|
|
66
|
+
* when it cannot be read). */
|
|
67
|
+
export declare function resolvedPlaywrightVersionStr(): string;
|
|
68
|
+
/**
|
|
69
|
+
* The lowest browser build this install can actually talk to.
|
|
70
|
+
*
|
|
71
|
+
* VERSION_MIN, raised by whatever the resolved Playwright requires. When the
|
|
72
|
+
* Playwright version cannot be read we fall back to VERSION_MIN rather than
|
|
73
|
+
* assuming the worst: a spurious forced re-download is worse than leaving a
|
|
74
|
+
* working install alone, and package.json caps Playwright anyway.
|
|
75
|
+
*/
|
|
76
|
+
export declare function effectiveVersionMin(): Version;
|
|
77
|
+
/** One `versions:` entry of a browser repo in repos.yml. */
|
|
78
|
+
export interface BrowserVersionConstraint {
|
|
79
|
+
python_library?: {
|
|
80
|
+
min?: string;
|
|
81
|
+
max?: string;
|
|
82
|
+
};
|
|
83
|
+
/** Absent means "assume every build is supported". */
|
|
84
|
+
browser?: {
|
|
85
|
+
stable?: {
|
|
86
|
+
min?: string;
|
|
87
|
+
max?: string;
|
|
88
|
+
};
|
|
89
|
+
prerelease?: {
|
|
90
|
+
min?: string;
|
|
91
|
+
max?: string;
|
|
92
|
+
};
|
|
93
|
+
min?: string;
|
|
94
|
+
max?: string;
|
|
95
|
+
} | null;
|
|
96
|
+
}
|
|
97
|
+
/** One `browsers:` entry of repos.yml. */
|
|
98
|
+
export interface BrowserRepoEntry {
|
|
99
|
+
/** Primary repo first, then fallbacks: a comma-separated string or a list. */
|
|
100
|
+
repo: string | string[];
|
|
101
|
+
name: string;
|
|
102
|
+
pattern?: string;
|
|
103
|
+
versions?: BrowserVersionConstraint[];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Configuration for a Camoufox repository.
|
|
107
|
+
*/
|
|
108
|
+
export declare class RepoConfig {
|
|
109
|
+
repos: string[];
|
|
110
|
+
name: string;
|
|
111
|
+
pattern: string;
|
|
112
|
+
stableMin?: string;
|
|
113
|
+
stableMax?: string;
|
|
114
|
+
prereleaseMin?: string;
|
|
115
|
+
prereleaseMax?: string;
|
|
116
|
+
constructor(init: {
|
|
117
|
+
repos: string[];
|
|
118
|
+
name: string;
|
|
119
|
+
pattern: string;
|
|
120
|
+
stableMin?: string;
|
|
121
|
+
stableMax?: string;
|
|
122
|
+
prereleaseMin?: string;
|
|
123
|
+
prereleaseMax?: string;
|
|
124
|
+
});
|
|
125
|
+
/** Primary GitHub repo. */
|
|
126
|
+
get repo(): string;
|
|
127
|
+
static loadRepos(spoofLibraryVersion?: string): RepoConfig[];
|
|
128
|
+
static getDefaultName(): string;
|
|
129
|
+
static fromEntry(entry: BrowserRepoEntry, spoofLibraryVersion?: string): RepoConfig;
|
|
130
|
+
static getDefault(): RepoConfig;
|
|
131
|
+
static findByName(name: string): RepoConfig | undefined;
|
|
132
|
+
getOsName(spoofOs?: string): string;
|
|
133
|
+
getArch(spoofArch?: string): string;
|
|
134
|
+
/**
|
|
135
|
+
* Build the asset regex from the config pattern string.
|
|
136
|
+
*/
|
|
137
|
+
buildPattern(spoofOs?: string, spoofArch?: string): RegExp;
|
|
138
|
+
/**
|
|
139
|
+
* Check if a build is within the supported range for its channel.
|
|
140
|
+
*/
|
|
141
|
+
isVersionSupported(version: Version, isPrerelease?: boolean): boolean;
|
|
142
|
+
}
|
|
143
|
+
export interface GitHubAsset {
|
|
144
|
+
name: string;
|
|
145
|
+
browser_download_url: string;
|
|
146
|
+
id?: number;
|
|
147
|
+
size?: number;
|
|
148
|
+
updated_at?: string;
|
|
149
|
+
created_at?: string;
|
|
150
|
+
digest?: string;
|
|
151
|
+
}
|
|
152
|
+
export interface GitHubRelease {
|
|
153
|
+
prerelease?: boolean;
|
|
154
|
+
assets: GitHubAsset[];
|
|
155
|
+
}
|
|
156
|
+
/** Whether this library speaks a browser's declared interface. */
|
|
157
|
+
export declare function interfaceSupported(iface: number): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* The browser interface a GitHub release declares in its manifest.json. A
|
|
160
|
+
* release without a manifest, or a manifest without the field, predates the
|
|
161
|
+
* field and is interface 1.
|
|
162
|
+
*/
|
|
163
|
+
export declare function releaseInterface(release: GitHubRelease): Promise<number>;
|
|
164
|
+
/** The interface recorded in an install's version.json at install time. */
|
|
165
|
+
export declare function installedInterface(installPath: string): number;
|
|
166
|
+
/** Why a browser needs a newer package, and the command that gets one. */
|
|
167
|
+
export declare function upgradeMessage(version: Version, iface: number): string;
|
|
168
|
+
export declare function incompatibleMessage(version: Version, iface: number): string;
|
|
169
|
+
/** A build the last `camoufox sync` found that needs a newer package. */
|
|
170
|
+
export interface IncompatibleBuild {
|
|
171
|
+
repo: string;
|
|
172
|
+
version: string;
|
|
173
|
+
build: string;
|
|
174
|
+
interface: number;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Warn once when the last `camoufox sync` found a browser release that needs
|
|
178
|
+
* a newer package. Reads the sync cache, so a launch makes no request.
|
|
179
|
+
*/
|
|
180
|
+
export declare function warnIfPackageOutdated(): void;
|
|
181
|
+
/** Test hook: forget that the warning was already issued. */
|
|
182
|
+
export declare function resetOutdatedWarning(): void;
|
|
183
|
+
/**
|
|
184
|
+
* Information about an available Camoufox version on GitHub.
|
|
185
|
+
*/
|
|
186
|
+
export declare class AvailableVersion {
|
|
187
|
+
version: Version;
|
|
188
|
+
url: string;
|
|
189
|
+
isPrerelease: boolean;
|
|
190
|
+
assetId?: number;
|
|
191
|
+
assetSize?: number;
|
|
192
|
+
assetUpdatedAt?: string;
|
|
193
|
+
sha256?: string;
|
|
194
|
+
assetCreatedAt?: string;
|
|
195
|
+
interface: number;
|
|
196
|
+
constructor(init: {
|
|
197
|
+
version: Version;
|
|
198
|
+
url: string;
|
|
199
|
+
isPrerelease: boolean;
|
|
200
|
+
assetId?: number;
|
|
201
|
+
assetSize?: number;
|
|
202
|
+
assetUpdatedAt?: string;
|
|
203
|
+
sha256?: string;
|
|
204
|
+
assetCreatedAt?: string;
|
|
205
|
+
interface?: number;
|
|
206
|
+
});
|
|
207
|
+
/** First 8 hex chars of the sha256, or empty when unknown. */
|
|
208
|
+
get sha8(): string;
|
|
209
|
+
get display(): string;
|
|
210
|
+
toMetadata(): Record<string, any>;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Handles fetching and installing Camoufox.
|
|
214
|
+
*/
|
|
215
|
+
export declare class CamoufoxFetcher {
|
|
216
|
+
githubRepos: string[];
|
|
217
|
+
githubRepo: string;
|
|
218
|
+
isPrerelease: boolean;
|
|
219
|
+
repoConfig: RepoConfig;
|
|
220
|
+
arch: string;
|
|
221
|
+
pattern: RegExp;
|
|
222
|
+
installedSha256?: string;
|
|
223
|
+
installedCreatedAt?: string;
|
|
224
|
+
installedInterface: number;
|
|
225
|
+
_versionObj?: Version;
|
|
226
|
+
_selectedVersion?: AvailableVersion;
|
|
227
|
+
_url?: string;
|
|
228
|
+
/**
|
|
229
|
+
* Where the download is kept between runs, so that a later fetch resumes
|
|
230
|
+
* it; unset downloads into a temporary file.
|
|
231
|
+
*/
|
|
232
|
+
partial?: string;
|
|
233
|
+
constructor(repoConfig?: RepoConfig, selectedVersion?: AvailableVersion);
|
|
234
|
+
/**
|
|
235
|
+
* The Python constructor calls fetch_latest() inline; downloads are async in
|
|
236
|
+
* JS, so callers do `await new CamoufoxFetcher().init()` instead.
|
|
237
|
+
*/
|
|
238
|
+
init(): Promise<this>;
|
|
239
|
+
/** First 8 hex chars of the installed asset sha, or empty. */
|
|
240
|
+
get installedSha8(): string;
|
|
241
|
+
/**
|
|
242
|
+
* Match a release asset against version constraints, OS, and arch.
|
|
243
|
+
*/
|
|
244
|
+
checkAsset(asset: GitHubAsset, release?: GitHubRelease): [Version, string] | null;
|
|
245
|
+
/**
|
|
246
|
+
* Whether a release whose asset checkAsset() matched may be used. The
|
|
247
|
+
* Python twin decides this inside check_asset(); reading a manifest is
|
|
248
|
+
* async here, so it is a separate step.
|
|
249
|
+
*/
|
|
250
|
+
acceptRelease(release: GitHubRelease, [version]: [Version, string]): Promise<boolean>;
|
|
251
|
+
missingAssetError(): never;
|
|
252
|
+
protected getReleases(githubRepo: string): Promise<GitHubRelease[]>;
|
|
253
|
+
/**
|
|
254
|
+
* Fetch the first matching release asset, trying fallback repos on failure.
|
|
255
|
+
*/
|
|
256
|
+
getAsset(): Promise<[Version, string]>;
|
|
257
|
+
getPlatformArch(): string;
|
|
258
|
+
/**
|
|
259
|
+
* Fetch the latest camoufox release for the current platform.
|
|
260
|
+
*/
|
|
261
|
+
fetchLatest(): Promise<void>;
|
|
262
|
+
static downloadFile(file: Writable, url: string): Promise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Download this build's archive into `file`. Through the instance's class,
|
|
265
|
+
* as Python's fetcher.download_file(), so a subclass can override either.
|
|
266
|
+
*/
|
|
267
|
+
download(file: Writable): Promise<void>;
|
|
268
|
+
/**
|
|
269
|
+
* Download and install camoufox to a versioned subdirectory.
|
|
270
|
+
*/
|
|
271
|
+
install(replace?: boolean): Promise<boolean>;
|
|
272
|
+
get url(): string;
|
|
273
|
+
get version(): string;
|
|
274
|
+
get build(): string;
|
|
275
|
+
get verstr(): string;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Fetch all supported versions from GitHub for the current platform. With
|
|
279
|
+
* includeIncompatible, builds that need a newer package are returned too
|
|
280
|
+
* (check `interfaceSupported(v.interface)`) instead of being reported.
|
|
281
|
+
*/
|
|
282
|
+
export declare function listAvailableVersions(repoConfig?: RepoConfig, includePrerelease?: boolean, spoofOs?: string, spoofArch?: string, includeIncompatible?: boolean): Promise<AvailableVersion[]>;
|
|
283
|
+
/**
|
|
284
|
+
* The supported builds the release tagged `tag` holds for this platform, read
|
|
285
|
+
* with one API call per repo of the source. Empty when no repo has the tag.
|
|
286
|
+
*/
|
|
287
|
+
export declare function taggedVersions(repoConfig: RepoConfig, tag: string): Promise<AvailableVersion[]>;
|
|
288
|
+
/**
|
|
289
|
+
* Get the full version string of the active install.
|
|
290
|
+
*/
|
|
291
|
+
export declare function installedVerStr(fromDir?: string): string;
|
|
292
|
+
/**
|
|
293
|
+
* Whether INSTALL_DIR's root holds a supported build.
|
|
294
|
+
*
|
|
295
|
+
* Only the pre-multiversion flat layout wrote version.json at the root; the
|
|
296
|
+
* versioned layout keeps it under browsers/<repo>/<version>/. A missing root
|
|
297
|
+
* version.json means "no legacy install here", so the caller should fall
|
|
298
|
+
* through to a fetch rather than raise. The alpha.1 floor masked this: no
|
|
299
|
+
* install was ever unsupported, so this branch was never reached.
|
|
300
|
+
*/
|
|
301
|
+
export declare function rootInstallSupported(): boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Full path to the active camoufox folder.
|
|
304
|
+
*
|
|
305
|
+
* This is the Python twin's camoufox_path(download_if_missing=False): it is
|
|
306
|
+
* called from synchronous path helpers, and a download is asynchronous in JS.
|
|
307
|
+
* `ensureCamoufoxInstalled()` is the download_if_missing=True half;
|
|
308
|
+
* `launchOptions()` awaits it before any path lookup, so first-run
|
|
309
|
+
* auto-download behaviour is preserved.
|
|
310
|
+
*/
|
|
311
|
+
export declare function camoufoxPath(): string;
|
|
312
|
+
/**
|
|
313
|
+
* Resolve the active browser, downloading it first when nothing usable is
|
|
314
|
+
* installed. The async counterpart to the Python twin's camoufox_path().
|
|
315
|
+
*/
|
|
316
|
+
export declare function ensureCamoufoxInstalled(): Promise<string>;
|
|
317
|
+
/**
|
|
318
|
+
* A file the build ships, found from its executable: beside it, or in
|
|
319
|
+
* Contents/Resources when the executable is a macOS app bundle's Contents/MacOS/.
|
|
320
|
+
*/
|
|
321
|
+
export declare function buildFile(executablePath: string, name: string): string;
|
|
322
|
+
/** Get the path to a file in the camoufox directory. */
|
|
323
|
+
export declare function getPath(file: string): string;
|
|
324
|
+
/**
|
|
325
|
+
* Get the path to the camoufox executable.
|
|
326
|
+
*/
|
|
327
|
+
export declare function launchPath(browserPath?: string): string;
|
|
328
|
+
/**
|
|
329
|
+
* The executable of the installed build `specifier` names (the `browser`
|
|
330
|
+
* launch option). Like `camoufox set`, it overrides the pairing: it never
|
|
331
|
+
* downloads, and it warns when the build is not the paired one.
|
|
332
|
+
*/
|
|
333
|
+
export declare function selectedLaunchPath(specifier: string): string;
|
|
334
|
+
/**
|
|
335
|
+
* camoucore.download.webdl cannot resume (no `offset`, `restart`); this stays
|
|
336
|
+
* until it can.
|
|
337
|
+
*
|
|
338
|
+
* Download a file from the given URL. Streams into `buffer` when one is given,
|
|
339
|
+
* otherwise accumulates and returns the bytes.
|
|
340
|
+
*
|
|
341
|
+
* An HTTP error raises requests' "<status> Client Error: ... for url: ..."
|
|
342
|
+
* message, like the Python twin; see request() for network failures.
|
|
343
|
+
*
|
|
344
|
+
* `offset` resumes a download whose first `offset` bytes `buffer` already
|
|
345
|
+
* appends to. `restart` empties what `buffer` writes to: it is called when the
|
|
346
|
+
* server sends the whole file, not the rest of it.
|
|
347
|
+
*/
|
|
348
|
+
export declare function webdl(url: string, desc?: string, bar?: boolean, buffer?: Writable | null, { progressCallback, offset, restart, }?: {
|
|
349
|
+
progressCallback?: ProgressCallback;
|
|
350
|
+
offset?: number;
|
|
351
|
+
restart?: () => void;
|
|
352
|
+
}): Promise<Buffer>;
|
|
353
|
+
/**
|
|
354
|
+
* chmod -R 755 on POSIX so the freshly-extracted binaries are executable.
|
|
355
|
+
* (The zip does not carry usable permission bits on every platform.)
|
|
356
|
+
*/
|
|
357
|
+
export declare function makeExecutable(dir: string): void;
|
|
358
|
+
/**
|
|
359
|
+
* Format an asset timestamp as "Mon D", or "Mon D, YYYY" when the year differs.
|
|
360
|
+
*/
|
|
361
|
+
export declare function formatAssetDate(iso?: string, now?: Date): string;
|