HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //proc/self/root/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/lib/whoami.js
var npm = require('./npm.js')
var output = require('./utils/output.js')

module.exports = whoami

whoami.usage = 'npm whoami [--registry <registry>]\n(just prints username according to given registry)'

function whoami (args, silent, cb) {
  // FIXME: need tighter checking on this, but is a breaking change
  if (typeof cb !== 'function') {
    cb = silent
    silent = false
  }

  var registry = npm.config.get('registry')
  if (!registry) return cb(new Error('no default registry set'))

  var auth = npm.config.getCredentialsByURI(registry)
  if (auth) {
    if (auth.username) {
      if (!silent) output(auth.username)
      return process.nextTick(cb.bind(this, null, auth.username))
    } else if (auth.token) {
      return npm.registry.whoami(registry, { auth: auth }, function (er, username) {
        if (er) return cb(er)
        if (!username) {
          var needNewSession = new Error(
            'Your auth token is no longer valid. Please log in again.'
          )
          needNewSession.code = 'ENEEDAUTH'
          return cb(needNewSession)
        }

        if (!silent) output(username)
        cb(null, username)
      })
    }
  }

  // At this point, if they have a credentials object, it doesn't have a token
  // or auth in it.  Probably just the default registry.
  var needAuth = new Error(
    'this command requires you to be logged in.'
  )
  needAuth.code = 'ENEEDAUTH'
  process.nextTick(cb.bind(this, needAuth))
}