tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Configuration.ts (5301B)


      1 /**
      2 * @license
      3 * Copyright 2022 Google Inc.
      4 * SPDX-License-Identifier: Apache-2.0
      5 */
      6 
      7 import type {SupportedBrowser} from './SupportedBrowser.js';
      8 
      9 /**
     10 * Defines experiment options for Puppeteer.
     11 *
     12 * See individual properties for more information.
     13 *
     14 * @public
     15 */
     16 export type ExperimentsConfiguration = Record<string, never>;
     17 
     18 /**
     19 * Defines options to configure Puppeteer's behavior during installation and
     20 * runtime.
     21 *
     22 * See individual properties for more information.
     23 *
     24 * @public
     25 */
     26 export interface Configuration {
     27  /**
     28   * Defines the directory to be used by Puppeteer for caching.
     29   *
     30   * Can be overridden by `PUPPETEER_CACHE_DIR`.
     31   *
     32   * @defaultValue `path.join(os.homedir(), '.cache', 'puppeteer')`
     33   */
     34  cacheDirectory?: string;
     35  /**
     36   * Specifies an executable path to be used in
     37   * {@link PuppeteerNode.launch | puppeteer.launch}.
     38   *
     39   * Can be overridden by `PUPPETEER_EXECUTABLE_PATH`.
     40   *
     41   * @defaultValue **Auto-computed.**
     42   */
     43  executablePath?: string;
     44  /**
     45   * Specifies which browser you'd like Puppeteer to use.
     46   *
     47   * Can be overridden by `PUPPETEER_BROWSER`.
     48   *
     49   * @defaultValue `chrome`
     50   */
     51  defaultBrowser?: SupportedBrowser;
     52  /**
     53   * Defines the directory to be used by Puppeteer for creating temporary files.
     54   *
     55   * Can be overridden by `PUPPETEER_TMP_DIR`.
     56   *
     57   * @defaultValue `os.tmpdir()`
     58   */
     59  temporaryDirectory?: string;
     60  /**
     61   * Tells Puppeteer to not download during installation.
     62   *
     63   * Can be overridden by `PUPPETEER_SKIP_DOWNLOAD`.
     64   */
     65  skipDownload?: boolean;
     66  /**
     67   * Tells Puppeteer to log at the given level.
     68   *
     69   * @defaultValue `warn`
     70   */
     71  logLevel?: 'silent' | 'error' | 'warn';
     72  /**
     73   * Defines experimental options for Puppeteer.
     74   */
     75  experiments?: ExperimentsConfiguration;
     76 
     77  chrome?: ChromeSettings;
     78  ['chrome-headless-shell']?: ChromeHeadlessShellSettings;
     79  firefox?: FirefoxSettings;
     80 }
     81 
     82 /**
     83 * @public
     84 */
     85 export interface ChromeSettings {
     86  /**
     87   * Tells Puppeteer to not download the browser during installation.
     88   *
     89   * Can be overridden by `PUPPETEER_CHROME_SKIP_DOWNLOAD`.
     90   *
     91   * @defaultValue false
     92   */
     93  skipDownload?: boolean;
     94  /**
     95   * Specifies the URL prefix that is used to download the browser.
     96   *
     97   * Can be overridden by `PUPPETEER_CHROME_DOWNLOAD_BASE_URL`.
     98   *
     99   * @remarks
    100   * This must include the protocol and may even need a path prefix.
    101   * This must **not** include a trailing slash similar to the default.
    102   *
    103   * @defaultValue https://storage.googleapis.com/chrome-for-testing-public
    104   */
    105  downloadBaseUrl?: string;
    106  /**
    107   * Specifies a certain version of the browser you'd like Puppeteer to use.
    108   *
    109   * Can be overridden by `PUPPETEER_CHROME_VERSION`
    110   * or `PUPPETEER_SKIP_CHROME_DOWNLOAD`.
    111   *
    112   * See {@link PuppeteerNode.launch | puppeteer.launch} on how executable path
    113   * is inferred.
    114   *
    115   * @example 119.0.6045.105
    116   * @defaultValue The pinned browser version supported by the current Puppeteer
    117   * version.
    118   */
    119  version?: string;
    120 }
    121 
    122 /**
    123 * @public
    124 */
    125 export interface ChromeHeadlessShellSettings {
    126  /**
    127   * Tells Puppeteer to not download the browser during installation.
    128   *
    129   * Can be overridden by `PUPPETEER_CHROME_HEADLESS_SHELL_SKIP_DOWNLOAD`
    130   * or `PUPPETEER_SKIP_CHROME_HEADLESS_SHELL_DOWNLOAD`.
    131   *
    132   * @defaultValue false
    133   */
    134  skipDownload?: boolean;
    135  /**
    136   * Specifies the URL prefix that is used to download the browser.
    137   *
    138   * Can be overridden by `PUPPETEER_CHROME_HEADLESS_SHELL_DOWNLOAD_BASE_URL`.
    139   *
    140   * @remarks
    141   * This must include the protocol and may even need a path prefix.
    142   * This must **not** include a trailing slash similar to the default.
    143   *
    144   * @defaultValue https://storage.googleapis.com/chrome-for-testing-public
    145   */
    146  downloadBaseUrl?: string;
    147  /**
    148   * Specifies a certain version of the browser you'd like Puppeteer to use.
    149   *
    150   * Can be overridden by `PUPPETEER_CHROME_HEADLESS_SHELL_VERSION`.
    151   *
    152   * See {@link PuppeteerNode.launch | puppeteer.launch} on how executable path
    153   * is inferred.
    154   *
    155   * @example 119.0.6045.105
    156   * @defaultValue The pinned browser version supported by the current Puppeteer
    157   * version.
    158   */
    159  version?: string;
    160 }
    161 
    162 /**
    163 * @public
    164 */
    165 export interface FirefoxSettings {
    166  /**
    167   * Tells Puppeteer to not download the browser during installation.
    168   *
    169   * Can be overridden by `PUPPETEER_FIREFOX_SKIP_DOWNLOAD`.
    170   *
    171   * @defaultValue true
    172   */
    173  skipDownload?: boolean;
    174  /**
    175   * Specifies the URL prefix that is used to download the browser.
    176   *
    177   * Can be overridden by `PUPPETEER_FIREFOX_DOWNLOAD_BASE_URL`.
    178   *
    179   * @remarks
    180   * This must include the protocol and may even need a path prefix.
    181   * This must **not** include a trailing slash similar to the default.
    182   *
    183   * @defaultValue https://archive.mozilla.org/pub/firefox/releases
    184   */
    185  downloadBaseUrl?: string;
    186  /**
    187   * Specifies a certain version of the browser you'd like Puppeteer to use.
    188   *
    189   * Can be overridden by `PUPPETEER_FIREFOX_VERSION`.
    190   *
    191   * See {@link PuppeteerNode.launch | puppeteer.launch} on how executable path
    192   * is inferred.
    193   *
    194   * @example stable_129.0
    195   * @defaultValue The pinned browser version supported by the current Puppeteer
    196   * version.
    197   */
    198  version?: string;
    199 }