Uname:Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64

403WebShell
403Webshell
Server IP : 82.148.16.210  /  Your IP : 216.73.216.169
Web Server : nginx/1.29.5
System : Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /srv/projects/env4/src/dev/frontend3/node_modules/table/node_modules/gitinfo/dist/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /srv/projects/env4/src/dev/frontend3/node_modules/table/node_modules/gitinfo/dist/utils.js
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.findGitPath = exports.isGitDirectory = exports.parseRemoteOriginUrl = exports.parseIni = void 0;

var _fs = _interopRequireDefault(require("fs"));

var _url = _interopRequireDefault(require("url"));

var _ini = _interopRequireDefault(require("ini"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// @flow

/**
 * Converts [INI](https://en.wikipedia.org/wiki/INI_file) string into an object.
 *
 * @access protected
 */
const parseIni = name => {
  let config;
  /* istanbul ignore next */

  if (!_fs.default.existsSync(name)) {
    throw new Error('INI file ("' + name + '") does not exist.');
  }

  config = _fs.default.readFileSync(name, {
    encoding: 'utf8'
  });
  config = _ini.default.parse(config);
  return config;
};
/**
 * Extracts information about the the repository from the
 * supplied URL (presumably, the remote origin URL).
 *
 * @access protected
 * @param input Supported Git remote origin URL (https, git or SVN).
 */


exports.parseIni = parseIni;

const parseRemoteOriginUrl = input => {
  let url; // git@github.com:gajus/gitdown.git
  // https://github.com/gajus/gitdown.git
  // https://github.com/gajus/gitdown

  if (input.includes('com:')) {
    url = input.split('com:')[1];
  } else {
    const parsedUrl = _url.default.parse(input);

    if (parsedUrl && parsedUrl.path) {
      url = parsedUrl.path.slice(1);
    } else {
      /* istanbul ignore next */
      throw new Error('Cannot parse origin URL.');
    }
  }

  if (/\.git$/.test(url)) {
    url = url.slice(0, -4);
  }

  url = url.split('/');
  /* istanbul ignore next */

  if (url.length !== 2) {
    throw new Error('Invalid remote origin URL ("' + input + '").');
  }

  return {
    name: url[1],
    username: url[0]
  };
};
/**
 * Tells whether a supplied path is a .git directory.
 *
 * @access protected
 */


exports.parseRemoteOriginUrl = parseRemoteOriginUrl;

const isGitDirectory = path => {
  try {
    _fs.default.statSync(path + '/HEAD');

    _fs.default.statSync(path + '/objects');

    _fs.default.statSync(path + '/refs');

    _fs.default.statSync(path + '/config');

    return true;
  } catch (error) {
    return false;
  }
};
/**
 * Finds a .git directory by ascending the directory tree.
 *
 * @access protected
 * @param startPath The path where to start the search.
 */


exports.isGitDirectory = isGitDirectory;

const findGitPath = startPath => {
  let dirname;
  let gitpath;
  dirname = startPath;

  do {
    if (_fs.default.existsSync(dirname + '/.git')) {
      gitpath = dirname + '/.git';
      break;
    }

    dirname = _fs.default.realpathSync(dirname + '/..');
  } while (_fs.default.existsSync(dirname) && dirname !== '/');
  /* istanbul ignore next */


  if (!gitpath) {
    throw new Error('Cannot locate .git directory.');
  }

  return gitpath;
};

exports.findGitPath = findGitPath;

Youez - 2016 - github.com/yon3zu
LinuXploit