Server IP : 85.214.239.14 / Your IP : 18.119.116.77 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 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 : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/wordpress/wp-content/plugins/really-simple-ssl/settings/src/LetsEncrypt/ |
Upload File : |
import {create} from 'zustand'; import produce from 'immer'; import * as rsssl_api from "../utils/api"; import {__} from "@wordpress/i18n"; import sleeper from "../utils/sleeper"; import {dispatch} from '@wordpress/data'; const useLetsEncryptData = create(( set, get ) => ({ actionIndex:-1, progress:0, attemptCount:0, refreshTests:false, actionsList:[], updateVerificationType: async (verificationType) => { await rsssl_api.runLetsEncryptTest('update_verification_type', verificationType).then((response) => { let msg = verificationType==='dir' ? __('Switched to Directory', 'really-simple-ssl') : __('Switched to DNS', 'really-simple-ssl'); const notice = dispatch('core/notices').createNotice( 'success', msg, { __unstableHTML: true, id: 'rsssl_switched_to_dns', type: 'snackbar', isDismissible: true, } ).then(sleeper(3000)).then((response) => { dispatch('core/notices').removeNotice('rsssl_switched_to_dns'); }); }); }, setAttemptCount: (attemptCount) => {set(state => ({ attemptCount }))}, setProgress: (progress) => {set(state => ({ progress }))}, setActionsList: (actionsList) => {set(state => ({ actionsList }))}, setActionsListItem: (index, action) => { set( produce((state) => { state.actionsList[index] = action; }) ) }, setActionsListProperty: (index, property, value) => { set( produce((state) => { //first, check if the actionsList has index and property if (typeof state.actionsList[index] === 'undefined' || typeof state.actionsList[index][property]) { return; } state.actionsList[index][property] = value; }) ) }, setRefreshTests: (refreshTests) => {set(state => ({ refreshTests }))}, setActionIndex: (actionIndex) => {set(state => ({ actionIndex }))}, switchButtonDisabled:false, setSwitchButtonDisabled: (switchButtonDisabled) => {set(state => ({ switchButtonDisabled }))}, })); export default useLetsEncryptData;