403Webshell
Server IP : 104.21.38.3  /  Your IP : 172.70.142.41
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/wwwroot/savinassociates.com/wp-content/plugins/redux-framework/extendify-sdk/src/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/savinassociates.com/wp-content/plugins/redux-framework/extendify-sdk/src/api/axios.js
import axios from 'axios'
import { useUserStore } from '@extendify/state/User'

const Axios = axios.create({
    baseURL: window.extendifyData.root,
    headers: {
        'X-WP-Nonce': window.extendifyData.nonce,
        'X-Requested-With': 'XMLHttpRequest',
        'X-Extendify': true,
    },
})

function findResponse(response) {
    return Object.prototype.hasOwnProperty.call(response, 'data')
        ? response.data
        : response
}

function handleErrors(error) {
    if (!error.response) {
        return
    }
    console.error(error.response)
    // TODO: add a global error message system
    return Promise.reject(findResponse(error.response))
}

function addDefaults(request) {
    const userState = useUserStore.getState()
    const remainingImports = userState.apiKey
        ? 'unlimited'
        : userState.remainingImports()
    if (request.data) {
        request.data.remaining_imports = remainingImports
        request.data.entry_point = userState.entryPoint
        request.data.total_imports = userState.imports
        request.data.participating_tests = userState.activeTestGroups()
    }
    return request
}

function checkDevMode(request) {
    request.headers['X-Extendify-Dev-Mode'] =
        window.location.search.indexOf('DEVMODE') > -1
    request.headers['X-Extendify-Local-Mode'] =
        window.location.search.indexOf('LOCALMODE') > -1
    return request
}

function checkForSoftError(response) {
    if (Object.prototype.hasOwnProperty.call(response, 'soft_error')) {
        window.dispatchEvent(
            new CustomEvent('extendify::softerror-encountered', {
                detail: response.soft_error,
                bubbles: true,
            }),
        )
    }
    return response
}

Axios.interceptors.response.use(
    (response) => checkForSoftError(findResponse(response)),
    (error) => handleErrors(error),
)

// TODO: setup a pipe function instead of this nested pattern
Axios.interceptors.request.use(
    (request) => checkDevMode(addDefaults(request)),
    (error) => error,
)

export { Axios }

Youez - 2016 - github.com/yon3zu
LinuXploit