Skip to content

Commit

Permalink
add version info
Browse files Browse the repository at this point in the history
  • Loading branch information
kilbot committed Jun 3, 2024
1 parent 7ca140b commit ae6424c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
12 changes: 9 additions & 3 deletions includes/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use WP_REST_Response;
use WP_REST_Server;


/**
*
*/
Expand Down Expand Up @@ -50,7 +51,7 @@ public function __construct() {
add_filter( 'determine_current_user', array( $this, 'determine_current_user' ), 20 );
add_filter( 'rest_authentication_errors', array( $this, 'rest_authentication_errors' ), 50, 1 );

// Adds uuid for the WordPress install
// Adds info about the WordPress install
add_filter( 'rest_index', array( $this, 'rest_index' ), 10, 1 );

// These filters allow changes to the WC REST API response
Expand Down Expand Up @@ -219,9 +220,11 @@ public function get_auth_header() {
}

/**
* Add uuid to the WP REST API index.
* Adds info to the WP REST API index response.
* - UUID
* - Version Info
*
* @param WP_REST_Response $response Response data
* @param WP_REST_Response $response Response data.
*
* @return WP_REST_Response
*/
Expand All @@ -232,6 +235,9 @@ public function rest_index( WP_REST_Response $response ): WP_REST_Response {
update_option( 'woocommerce_pos_uuid', $uuid );
}
$response->data['uuid'] = $uuid;
$response->data['wp_version'] = get_bloginfo( 'version' );
$response->data['wc_version'] = WC()->version;
$response->data['wcpos_version'] = VERSION;

return $response;
}
Expand Down
3 changes: 3 additions & 0 deletions includes/Templates/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ function ( $store ) {
'home' => home_url(),
'gmt_offset' => get_option( 'gmt_offset' ),
'timezone_string' => get_option( 'timezone_string' ),
'wp_version' => get_bloginfo( 'version' ),
'wc_version' => WC()->version,
'wcpos_version' => VERSION,
'wp_api_url' => get_rest_url(),
'wc_api_url' => get_rest_url( null, 'wc/v3' ),
'wc_api_auth_url' => get_rest_url( null, 'wcpos/v1/jwt' ),
Expand Down
2 changes: 1 addition & 1 deletion woocommerce-pos.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
// minimum requirements.
const WC_MIN_VERSION = '5.3';
const PHP_MIN_VERSION = '7.4';
const MIN_PRO_VERSION = '1.4.0';
const MIN_PRO_VERSION = '1.5.0';

// load .env flags (for development).
function load_env( $file ) {
Expand Down

0 comments on commit ae6424c

Please sign in to comment.