Plugin Directory


Ignore:
Timestamp:
10/25/2026 12:38:56 AM (3 days ago)
Author:
ofirs1988
Message:

Update to version 1.2.2 from GitHub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gen-wave/trunk/src/Core/AgentAuth.php

    r3642637 r3763844  
    2828    }
    2929
     30    /**
     31     * The verify-domain challenge is answered only while this site is talking to
     32     * the panel (connect, disconnect): a short window opened before the request
     33     * and closed after it. Five minutes covers a slow panel; it closes itself.
     34     */
     35    private const CHALLENGE_WINDOW = 'genwave_challenge_open';
     36
     37    public static function openChallenge(): void
     38    {
     39        set_transient(self::CHALLENGE_WINDOW, 1, 5 * MINUTE_IN_SECONDS);
     40    }
     41
     42    public static function closeChallenge(): void
     43    {
     44        delete_transient(self::CHALLENGE_WINDOW);
     45    }
     46
     47    public static function challengeOpen(): bool
     48    {
     49        return (bool) get_transient(self::CHALLENGE_WINDOW);
     50    }
     51
    3052    /** True once the site has completed the signed connect. */
    3153    public static function isConnected(): bool
    … …  
    4567        }
    4668
     69        // The panel calls back to verify-domain during this request: answer it now, and only now.
     70        self::openChallenge();
    4771        $response = wp_remote_post(self::panelUrl() . '/api/plugin/connect', [
    4872            'headers' => ['Content-Type' => 'application/json', 'Accept' => 'application/json'],
    … …  
    5680        ]);
    5781
     82        self::closeChallenge();
     83
    5884        if (is_wp_error($response)) {
    5985            return ['success' => false, 'message' => $response->get_error_message()];
    … …  
    93119
    94120        if (!empty($licenseKey)) {
     121            self::openChallenge();
    95122            wp_remote_post(self::panelUrl() . '/api/plugin/disconnect', [
    96123                'headers' => ['Content-Type' => 'application/json', 'Accept' => 'application/json'],
    … …  
    102129                'sslverify' => ! preg_match('#(localhost|127\.0\.0\.1|\.local)#', self::panelUrl()),
    103130            ]);
     131            self::closeChallenge();
    104132        }
    105133
Note: See TracChangeset for help on using the changeset viewer.