This commit is contained in:
Javier Casares 2026-08-17 16:07:31 +00:00
commit 21df13f02a
5 changed files with 76 additions and 9 deletions

View file

@ -300,11 +300,20 @@ class Robotstxt_Manager_Updater {
);
if ( 'premium' === $type ) {
$api_key_raw = get_option( 'robotstxt_manager_api_key', '' );
$api_key = is_string( $api_key_raw ) ? Robotstxt_Manager_Encryption::decrypt( $api_key_raw ) : '';
// Preferred: a short-lived download token (Core 1.9.0+) — keeps the
// long-lived API key out of the update transient and access logs.
$token = $client->exchange_download_token( $slug );
if ( '' !== $api_key ) {
$args['api_key'] = $api_key;
if ( '' !== $token ) {
$args['token'] = $token;
} else {
// Fallback (older Core): the API key itself.
$api_key_raw = get_option( 'robotstxt_manager_api_key', '' );
$api_key = is_string( $api_key_raw ) ? Robotstxt_Manager_Encryption::decrypt( $api_key_raw ) : '';
if ( '' !== $api_key ) {
$args['api_key'] = $api_key;
}
}
}