!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/wincloud_gateway/node_modules/strapi-utils/lib/   drwxr-xr-x
Free 13.1 GB of 57.97 GB (22.6%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     hooks.js (2.09 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
'use strict';

const { eq, remove, cloneDeep } = require('lodash/fp');

/**
 * @typedef Hook
 * @property {Array<Function>} _handlers - A registry of handler used by the hook
 * @property {function(Function):Hook} register - Register a new handler into the hook's registry
 * @property {function(Function):Hook} delete- Delete the given handler from the hook's registry
 * @property {Function} call - Not implemented by default, can be replaced by any implementation.
 */

/**
 * Create a default Strapi hook
 * @return {Hook}
 */
const createHook = () => {
  const state = {
    handlers: [],
  };

  return {
    get handlers() {
      return state.handlers;
    },

    register: handler => {
      state.handlers.push(handler);
    },

    delete: handler => {
      state.handlers = remove(eq(handler), state.handlers);
    },

    call() {
      throw new Error('Method not implemented');
    },
  };
};

/**
 * Create an async series hook.
 * Upon execution, it will execute every handler in order with the same context
 * @return {Hook}
 */
const createAsyncSeriesHook = () => ({
  ...createHook(),

  async call(context) {
    for (const handler of this.handlers) {
      await handler(context);
    }
  },
});

/**
 * Create an async series waterfall hook.
 * Upon execution, it will execute every handler in order and pass the return value of the last handler to the next one
 * @return {Hook}
 */
const createAsyncSeriesWaterfallHook = () => ({
  ...createHook(),

  async call(param) {
    let res = param;

    for (const handler of this.handlers) {
      res = await handler(res);
    }

    return res;
  },
});

/**
 * Create an async parallel hook.
 * Upon execution, it will execute every registered handler in band.
 * @return {Hook}
 */
const createAsyncParallelHook = () => ({
  ...createHook(),

  call(context) {
    const promises = this.handlers.map(handler => handler(cloneDeep(context)));

    return Promise.all(promises);
  },
});

module.exports = {
  // Internal utils
  internals: {
    createHook,
  },
  // Hooks
  createAsyncSeriesHook,
  createAsyncSeriesWaterfallHook,
  createAsyncParallelHook,
};

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0376 ]--