Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/libnpmhook/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/libnpmhook/lib/index.js
'use strict'

const fetch = require('npm-registry-fetch')
const validate = require('aproba')

const eu = encodeURIComponent
const cmd = module.exports = {}
cmd.add = (name, endpoint, secret, opts = {}) => {
  validate('SSSO', [name, endpoint, secret, opts])
  let type = 'package'
  if (name.match(/^@[^/]+$/)) {
    type = 'scope'
  }
  if (name[0] === '~') {
    type = 'owner'
    name = name.slice(1)
  }
  return fetch.json('/-/npm/v1/hooks/hook', {
    ...opts,
    method: 'POST',
    body: { type, name, endpoint, secret },
  })
}

cmd.rm = (id, opts = {}) => {
  validate('SO', [id, opts])
  return fetch.json(`/-/npm/v1/hooks/hook/${eu(id)}`, {
    ...opts,
    method: 'DELETE',
  }).catch(err => {
    if (err.code === 'E404') {
      return null
    } else {
      throw err
    }
  })
}

cmd.update = (id, endpoint, secret, opts = {}) => {
  validate('SSSO', [id, endpoint, secret, opts])
  return fetch.json(`/-/npm/v1/hooks/hook/${eu(id)}`, {
    ...opts,
    method: 'PUT',
    body: { endpoint, secret },
  })
}

cmd.find = (id, opts = {}) => {
  validate('SO', [id, opts])
  return fetch.json(`/-/npm/v1/hooks/hook/${eu(id)}`, opts)
}

cmd.ls = (opts = {}) => {
  return cmd.ls.stream(opts).collect()
}

cmd.ls.stream = (opts = {}) => {
  const { package: pkg, limit, offset } = opts
  validate('S|Z', [pkg])
  validate('N|Z', [limit])
  validate('N|Z', [offset])
  return fetch.json.stream('/-/npm/v1/hooks', 'objects.*', {
    ...opts,
    query: {
      package: pkg,
      limit,
      offset,
    },
  })
}

Spamworldpro Mini