UNPKG

@fromjs/backend

Version:
48 lines (47 loc) 1.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = require("path"); const fs = require("fs"); class BackendOptions { constructor({ bePort, proxyPort, sessionDirectory, onReady, dontTrack, block, disableDefaultBlockList, backendOriginWithoutPort, }) { this.bePort = bePort; this.proxyPort = proxyPort; this.sessionDirectory = sessionDirectory; this.onReady = onReady; this.dontTrack = dontTrack; this.block = block; this.disableDefaultBlockList = disableDefaultBlockList; this.backendOriginWithoutPort = backendOriginWithoutPort; } getCertDirectory() { return path.resolve(this.sessionDirectory, "certs"); } getTrackingDataDirectory() { return path.resolve(this.sessionDirectory, "tracking-data"); } getSessionJsonPath() { return path.resolve(this.sessionDirectory, "session.json"); } getLocStorePath() { return path.resolve(this.sessionDirectory, "locs"); } getChromeUserDataDirectory() { return path.resolve(this.sessionDirectory, "chrome"); } getBackendServerCertDirPath() { return path.resolve(this.sessionDirectory, "be-server-cert"); } getBackendServerCertPath() { return path.resolve(this.getBackendServerCertDirPath(), "cert.pem"); } getBackendServerPrivateKeyPath() { return path.resolve(this.getBackendServerCertDirPath(), "key.pem"); } getBackendServerCertInfo() { return { key: fs.readFileSync(this.getBackendServerPrivateKeyPath()), cert: fs.readFileSync(this.getBackendServerCertPath()), }; } } exports.BackendOptions = BackendOptions;