Making WordPress.org


Ignore:
Timestamp:
06/08/2023 02:34:42 AM (3 years ago)
Author:
dd32
Message:

Theme Directory: Refactor the API calls to properly query the user with favorites.

This reverts [12630] which was a quick-fix for the issue, but it was actually caused by [12600].

This refactors the API query code to avoid using jsonp requests for ease of debugging, and slims down the request to what it actually needs to query for.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/themes/theme-directory/1.0/index.php

    r6462 r12632  
    1818function api_send_json( $data ) {
    1919    // Allow cross-domain calls from *.wordpress.org
    20     if ( isset( $_SERVER['HTTP_ORIGIN'] ) && preg_match( '!^https?://[^.]+\.wordpress\.org/!i', $_SERVER['HTTP_ORIGIN'] ) ) {
     20    if ( isset( $_SERVER['HTTP_ORIGIN'] ) && preg_match( '!^https?://([^.]+\.)?wordpress\.org/?$!i', $_SERVER['HTTP_ORIGIN'] ) ) {
    2121        header( 'Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN'] );
     22        header( 'Access-Control-Allow-Credentials: true' ); // Allow cookies to be used.
    2223    }
    2324
Note: See TracChangeset for help on using the changeset viewer.