PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/@aptos-labs/aptos-cli/dist/tasks

Просмотр файла: install.js

import { execSync } from "child_process";
import { existsSync } from "fs";
import { GH_CLI_DOWNLOAD_URL, PNAME } from "../utils/consts.js";
import { execSyncShell } from "../utils/execSyncShell.js";
import { getCurrentOpenSSLVersion } from "../utils/versions.js";
import { getOS } from "../utils/getUserOs.js";
import { getLocalBinPath } from "../utils/getLocalBinPath.js";
import { getLatestVersionGh } from "../utils/ghOperations.js";
export const installCli = async () => {
    const path = getLocalBinPath();
    if (existsSync(path)) {
        console.log("Aptos CLI is already installed");
        return;
    }
    const latestCLIVersion = await getLatestVersionGh();
    console.log(`Downloading aptos CLI version ${latestCLIVersion}`);
    const os = getOS();
    if (os === "Windows") {
        const url = `${GH_CLI_DOWNLOAD_URL}/${PNAME}-v${latestCLIVersion}/${PNAME}-${latestCLIVersion}-${os}-x86_64.zip`;
        execSync(`powershell -Command "if (!(Test-Path -Path 'C:\\tmp')) { New-Item -ItemType Directory -Path 'C:\\tmp' } ; Invoke-RestMethod -Uri ${url} -OutFile C:\\tmp\\aptos.zip; Expand-Archive -Path C:\\tmp\\aptos.zip -DestinationPath C:\\tmp -Force; Move-Item -Path C:\\tmp\\aptos.exe -Destination \"${path}\""`);
    }
    else if (os === "MacOS") {
        execSyncShell("brew install aptos", { encoding: "utf8" });
    }
    else {
        let osVersion = "x86_64";
        let opensSslVersion = "1.0.0";
        try {
            opensSslVersion = getCurrentOpenSSLVersion();
        }
        catch (error) {
            console.log("Could not determine OpenSSL version, assuming older version (1.x.x)");
        }
        if (opensSslVersion.startsWith("3.")) {
            osVersion = "22.04-x86_64";
        }
        console.log(`Downloading CLI binary ${os}-${osVersion}`);
        const url = `${GH_CLI_DOWNLOAD_URL}/${PNAME}-v${latestCLIVersion}/${PNAME}-${latestCLIVersion}-${os}-${osVersion}.zip`;
        execSync(`curl -L -o /tmp/aptos.zip ${url}; unzip -o -q /tmp/aptos.zip -d /tmp; mv /tmp/aptos ${path};`);
    }
};
//# sourceMappingURL=install.js.map

Выполнить команду


Для локальной разработки. Не используйте в интернете!