Changeset 3835631
- Timestamp:
- 11/30/2026 04:55:34 PM (less than one hour ago)
- Location:
- hibira-waiting-room
- Files:
-
- 16 edited
- 1 copied
-
tags/0.2.0 (copied) (copied from hibira-waiting-room/trunk )
-
tags/0.2.0/hibira-waiting-room.php (modified) (2 diffs)
-
tags/0.2.0/includes/class-hibira-wr-admin.php (modified) (2 diffs)
-
tags/0.2.0/includes/class-hibira-wr-checkout.php (modified) (3 diffs)
-
tags/0.2.0/includes/class-hibira-wr-client.php (modified) (1 diff)
-
tags/0.2.0/includes/class-hibira-wr-gate.php (modified) (1 diff)
-
tags/0.2.0/includes/class-hibira-wr.php (modified) (2 diffs)
-
tags/0.2.0/readme.txt (modified) (4 diffs)
-
tags/0.2.0/uninstall.php (modified) (1 diff)
-
trunk/hibira-waiting-room.php (modified) (2 diffs)
-
trunk/includes/class-hibira-wr-admin.php (modified) (2 diffs)
-
trunk/includes/class-hibira-wr-checkout.php (modified) (3 diffs)
-
trunk/includes/class-hibira-wr-client.php (modified) (1 diff)
-
trunk/includes/class-hibira-wr-gate.php (modified) (1 diff)
-
trunk/includes/class-hibira-wr.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
hibira-waiting-room/tags/0.2.0/hibira-waiting-room.php
r3808590 r3835631 4 4 * Plugin URI: https://hibira.io/guides/woocommerce 5 5 * Description: A fair virtual queue for product drops and flash sales. Shoppers wait their turn on a Hibira waiting room, come back with a signed pass, and the pass is checked again at checkout. 6 * Version: 0. 1.16 * Version: 0.2.0 7 7 * Requires at least: 6.5 8 8 * Requires PHP: 7.4 … … 21 21 defined( 'ABSPATH' ) || exit; 22 22 23 define( 'HIBIRA_WR_VERSION', '0. 1.1' );23 define( 'HIBIRA_WR_VERSION', '0.2.0' ); 24 24 define( 'HIBIRA_WR_FILE', __FILE__ ); 25 25 define( 'HIBIRA_WR_DIR', plugin_dir_path( __FILE__ ) ); -
hibira-waiting-room/tags/0.2.0/includes/class-hibira-wr-admin.php
r3808590 r3835631 92 92 register_setting( $group, $p . 'skip_bots', $yesno ); 93 93 register_setting( $group, $p . 'once_per_pass', $yesno ); 94 register_setting( $group, $p . 'fail_open', $yesno ); 94 95 } 95 96 … … 352 353 'skip_staff' => __( 'Shop managers skip the line', 'hibira-waiting-room' ), 353 354 'skip_bots' => __( 'Search engines can still read product pages (they cannot buy)', 'hibira-waiting-room' ), 355 'fail_open' => __( 'Let shoppers in if the waiting room can\'t be reached', 'hibira-waiting-room' ), 354 356 ); 355 357 foreach ( $rules as $name => $label ) { -
hibira-waiting-room/tags/0.2.0/includes/class-hibira-wr-checkout.php
r3808590 r3835631 52 52 $pass = Hibira_WR::current_pass(); 53 53 if ( ! $pass ) { 54 return self::queue_message();54 return Hibira_WR::failed_open() ? '' : self::queue_message(); 55 55 } 56 56 if ( Hibira_WR::on( 'once_per_pass' ) && '' !== $pass['ticket'] && self::ticket_used( $pass['ticket'], $order ? $order->get_id() : 0 ) ) { … … 71 71 return $passed; 72 72 } 73 if ( Hibira_WR::bypass( true ) || Hibira_WR::current_pass() ) {73 if ( Hibira_WR::bypass( true ) || Hibira_WR::current_pass() || Hibira_WR::failed_open() ) { 74 74 return $passed; 75 75 } … … 83 83 return; 84 84 } 85 if ( Hibira_WR::bypass( true ) || Hibira_WR::current_pass() ) {85 if ( Hibira_WR::bypass( true ) || Hibira_WR::current_pass() || Hibira_WR::failed_open() ) { 86 86 return; 87 87 } -
hibira-waiting-room/tags/0.2.0/includes/class-hibira-wr-client.php
r3808590 r3835631 30 30 $this->base = untrailingslashit( (string) $base ); 31 31 $this->transport = $transport; 32 } 33 34 /** 35 * Whether the room's public status answers within $timeout seconds, the 36 * way a shopper's browser would reach the waiting page. A network error, 37 * a timeout or a 5xx is false. 38 */ 39 public function reachable( $room, $timeout = 1.5 ) { 40 $url = $this->base . '/waitroom/' . rawurlencode( $this->key ) . '/' . rawurlencode( $room ); 41 if ( $this->transport ) { 42 $out = call_user_func( $this->transport, 'GET', $url, '' ); 43 if ( is_wp_error( $out ) ) { 44 return false; 45 } 46 $status = (int) $out[0]; 47 } else { 48 $res = wp_remote_get( 49 $url, 50 array( 51 'timeout' => $timeout, 52 'redirection' => 0, 53 ) 54 ); 55 if ( is_wp_error( $res ) ) { 56 return false; 57 } 58 $status = (int) wp_remote_retrieve_response_code( $res ); 59 } 60 return $status > 0 && $status < 500; 32 61 } 33 62 -
hibira-waiting-room/tags/0.2.0/includes/class-hibira-wr-gate.php
r3808590 r3835631 41 41 return; 42 42 } 43 if ( Hibira_WR::failed_open() ) { 44 /** 45 * Fires when a shopper is let in because the waiting page could not be reached. 46 * 47 * @param string $url The page the shopper asked for. 48 */ 49 do_action( 'hibira_wr_fail_open', self::current_url() ); 50 return; 51 } 43 52 wp_redirect( Hibira_WR::waiting_page_url( self::current_url() ), 302, 'Hibira Waiting Room' ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- the waiting page is on the Hibira host. 44 53 exit; -
hibira-waiting-room/tags/0.2.0/includes/class-hibira-wr.php
r3808590 r3835631 27 27 'skip_bots' => 'yes', 28 28 'once_per_pass' => 'yes', 29 'fail_open' => 'no', 29 30 ); 30 31 } … … 74 75 } 75 76 return 'https://' . preg_replace( '#^wss?://#', '', $host ); 77 } 78 79 /** 80 * Whether shoppers can reach the waiting page right now, for the 81 * "let shoppers in if the waiting room can't be reached" rule. One check 82 * per room is kept for 15 seconds, so a busy store sends at most one 83 * check every 15 seconds. 84 */ 85 public static function queue_reachable() { 86 $cache = self::PREFIX . 'up_' . md5( self::base_url() . '|' . self::get( 'key' ) . '|' . self::room() ); 87 $known = get_transient( $cache ); 88 if ( 'yes' === $known || 'no' === $known ) { 89 return 'yes' === $known; 90 } 91 /** 92 * Filters how long, in seconds, to wait for the waiting page before letting a shopper in. 93 * 94 * @param float $timeout 95 */ 96 $timeout = (float) apply_filters( 'hibira_wr_fail_open_timeout', 1.5 ); 97 $up = self::client()->reachable( self::room(), $timeout ); 98 set_transient( $cache, $up ? 'yes' : 'no', 15 ); 99 return $up; 100 } 101 102 /** True when the fail-open rule is on and the waiting page can't be reached right now. */ 103 public static function failed_open() { 104 return self::on( 'fail_open' ) && ! self::queue_reachable(); 76 105 } 77 106 -
hibira-waiting-room/tags/0.2.0/readme.txt
r3808590 r3835631 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 0. 1.17 Stable tag: 0.2.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 32 32 * From WooCommerce > Waiting room, your server sends the room's settings (title, rate, start time, pass lifetime, your store address and the waiting page look: logo address, colour, message and theme) to Hibira's HTTP API and reads the room's counters. No customer or order data is sent. 33 33 * Passes are checked on your server with your app secret; checking a pass sends nothing to Hibira. 34 * With "Let shoppers in if the waiting room can't be reached" ticked, your server requests the room's public status from your Hibira app's host at most once every 15 seconds. The request carries only your app key and room name. 34 35 35 36 Terms: https://hibira.io/legal/terms — Privacy policy: https://hibira.io/legal/privacy … … 55 56 A pass can be copied to another browser while it is valid, so the plugin records the place in line on the order and refuses a second paid order with the same place. 56 57 58 = What if the waiting room can't be reached? = 59 60 By default shoppers without a pass are still sent to the waiting page. Tick "Let shoppers in if the waiting room can't be reached" to let them in instead when the waiting page doesn't answer within 1.5 seconds (or answers with a server error). The check runs at most once every 15 seconds per room. 61 57 62 = What happens to shoppers already in the cart when I turn it on? = 58 63 … … 71 76 == Upgrade Notice == 72 77 78 = 0.2.0 = 79 Adds an optional rule that lets shoppers in when the waiting room can't be reached. 80 73 81 = 0.1.1 = 74 82 Adds logo, colour, message and theme settings for the waiting page. 75 83 76 84 == Changelog == 85 86 = 0.2.0 = 87 * New option "Let shoppers in if the waiting room can't be reached" (off by default): if the room's status check times out or fails, shoppers go straight in, including at add to cart and checkout. 77 88 78 89 = 0.1.1 = -
hibira-waiting-room/tags/0.2.0/uninstall.php
r3808590 r3835631 9 9 defined( 'WP_UNINSTALL_PLUGIN' ) || exit; 10 10 11 foreach ( array( 'app_id', 'key', 'secret', 'host', 'enabled', 'room', 'scope', 'products', 'categories', 'skip_staff', 'skip_bots', 'once_per_pass' ) as $hibira_wr_name ) {11 foreach ( array( 'app_id', 'key', 'secret', 'host', 'enabled', 'room', 'scope', 'products', 'categories', 'skip_staff', 'skip_bots', 'once_per_pass', 'fail_open' ) as $hibira_wr_name ) { 12 12 delete_option( 'hibira_wr_' . $hibira_wr_name ); 13 13 } -
hibira-waiting-room/trunk/hibira-waiting-room.php
r3808590 r3835631 4 4 * Plugin URI: https://hibira.io/guides/woocommerce 5 5 * Description: A fair virtual queue for product drops and flash sales. Shoppers wait their turn on a Hibira waiting room, come back with a signed pass, and the pass is checked again at checkout. 6 * Version: 0. 1.16 * Version: 0.2.0 7 7 * Requires at least: 6.5 8 8 * Requires PHP: 7.4 … … 21 21 defined( 'ABSPATH' ) || exit; 22 22 23 define( 'HIBIRA_WR_VERSION', '0. 1.1' );23 define( 'HIBIRA_WR_VERSION', '0.2.0' ); 24 24 define( 'HIBIRA_WR_FILE', __FILE__ ); 25 25 define( 'HIBIRA_WR_DIR', plugin_dir_path( __FILE__ ) ); -
hibira-waiting-room/trunk/includes/class-hibira-wr-admin.php
r3808590 r3835631 92 92 register_setting( $group, $p . 'skip_bots', $yesno ); 93 93 register_setting( $group, $p . 'once_per_pass', $yesno ); 94 register_setting( $group, $p . 'fail_open', $yesno ); 94 95 } 95 96 … … 352 353 'skip_staff' => __( 'Shop managers skip the line', 'hibira-waiting-room' ), 353 354 'skip_bots' => __( 'Search engines can still read product pages (they cannot buy)', 'hibira-waiting-room' ), 355 'fail_open' => __( 'Let shoppers in if the waiting room can\'t be reached', 'hibira-waiting-room' ), 354 356 ); 355 357 foreach ( $rules as $name => $label ) { -
hibira-waiting-room/trunk/includes/class-hibira-wr-checkout.php
r3808590 r3835631 52 52 $pass = Hibira_WR::current_pass(); 53 53 if ( ! $pass ) { 54 return self::queue_message();54 return Hibira_WR::failed_open() ? '' : self::queue_message(); 55 55 } 56 56 if ( Hibira_WR::on( 'once_per_pass' ) && '' !== $pass['ticket'] && self::ticket_used( $pass['ticket'], $order ? $order->get_id() : 0 ) ) { … … 71 71 return $passed; 72 72 } 73 if ( Hibira_WR::bypass( true ) || Hibira_WR::current_pass() ) {73 if ( Hibira_WR::bypass( true ) || Hibira_WR::current_pass() || Hibira_WR::failed_open() ) { 74 74 return $passed; 75 75 } … … 83 83 return; 84 84 } 85 if ( Hibira_WR::bypass( true ) || Hibira_WR::current_pass() ) {85 if ( Hibira_WR::bypass( true ) || Hibira_WR::current_pass() || Hibira_WR::failed_open() ) { 86 86 return; 87 87 } -
hibira-waiting-room/trunk/includes/class-hibira-wr-client.php
r3808590 r3835631 30 30 $this->base = untrailingslashit( (string) $base ); 31 31 $this->transport = $transport; 32 } 33 34 /** 35 * Whether the room's public status answers within $timeout seconds, the 36 * way a shopper's browser would reach the waiting page. A network error, 37 * a timeout or a 5xx is false. 38 */ 39 public function reachable( $room, $timeout = 1.5 ) { 40 $url = $this->base . '/waitroom/' . rawurlencode( $this->key ) . '/' . rawurlencode( $room ); 41 if ( $this->transport ) { 42 $out = call_user_func( $this->transport, 'GET', $url, '' ); 43 if ( is_wp_error( $out ) ) { 44 return false; 45 } 46 $status = (int) $out[0]; 47 } else { 48 $res = wp_remote_get( 49 $url, 50 array( 51 'timeout' => $timeout, 52 'redirection' => 0, 53 ) 54 ); 55 if ( is_wp_error( $res ) ) { 56 return false; 57 } 58 $status = (int) wp_remote_retrieve_response_code( $res ); 59 } 60 return $status > 0 && $status < 500; 32 61 } 33 62 -
hibira-waiting-room/trunk/includes/class-hibira-wr-gate.php
r3808590 r3835631 41 41 return; 42 42 } 43 if ( Hibira_WR::failed_open() ) { 44 /** 45 * Fires when a shopper is let in because the waiting page could not be reached. 46 * 47 * @param string $url The page the shopper asked for. 48 */ 49 do_action( 'hibira_wr_fail_open', self::current_url() ); 50 return; 51 } 43 52 wp_redirect( Hibira_WR::waiting_page_url( self::current_url() ), 302, 'Hibira Waiting Room' ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- the waiting page is on the Hibira host. 44 53 exit; -
hibira-waiting-room/trunk/includes/class-hibira-wr.php
r3808590 r3835631 27 27 'skip_bots' => 'yes', 28 28 'once_per_pass' => 'yes', 29 'fail_open' => 'no', 29 30 ); 30 31 } … … 74 75 } 75 76 return 'https://' . preg_replace( '#^wss?://#', '', $host ); 77 } 78 79 /** 80 * Whether shoppers can reach the waiting page right now, for the 81 * "let shoppers in if the waiting room can't be reached" rule. One check 82 * per room is kept for 15 seconds, so a busy store sends at most one 83 * check every 15 seconds. 84 */ 85 public static function queue_reachable() { 86 $cache = self::PREFIX . 'up_' . md5( self::base_url() . '|' . self::get( 'key' ) . '|' . self::room() ); 87 $known = get_transient( $cache ); 88 if ( 'yes' === $known || 'no' === $known ) { 89 return 'yes' === $known; 90 } 91 /** 92 * Filters how long, in seconds, to wait for the waiting page before letting a shopper in. 93 * 94 * @param float $timeout 95 */ 96 $timeout = (float) apply_filters( 'hibira_wr_fail_open_timeout', 1.5 ); 97 $up = self::client()->reachable( self::room(), $timeout ); 98 set_transient( $cache, $up ? 'yes' : 'no', 15 ); 99 return $up; 100 } 101 102 /** True when the fail-open rule is on and the waiting page can't be reached right now. */ 103 public static function failed_open() { 104 return self::on( 'fail_open' ) && ! self::queue_reachable(); 76 105 } 77 106 -
hibira-waiting-room/trunk/readme.txt
r3808590 r3835631 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 0. 1.17 Stable tag: 0.2.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 32 32 * From WooCommerce > Waiting room, your server sends the room's settings (title, rate, start time, pass lifetime, your store address and the waiting page look: logo address, colour, message and theme) to Hibira's HTTP API and reads the room's counters. No customer or order data is sent. 33 33 * Passes are checked on your server with your app secret; checking a pass sends nothing to Hibira. 34 * With "Let shoppers in if the waiting room can't be reached" ticked, your server requests the room's public status from your Hibira app's host at most once every 15 seconds. The request carries only your app key and room name. 34 35 35 36 Terms: https://hibira.io/legal/terms — Privacy policy: https://hibira.io/legal/privacy … … 55 56 A pass can be copied to another browser while it is valid, so the plugin records the place in line on the order and refuses a second paid order with the same place. 56 57 58 = What if the waiting room can't be reached? = 59 60 By default shoppers without a pass are still sent to the waiting page. Tick "Let shoppers in if the waiting room can't be reached" to let them in instead when the waiting page doesn't answer within 1.5 seconds (or answers with a server error). The check runs at most once every 15 seconds per room. 61 57 62 = What happens to shoppers already in the cart when I turn it on? = 58 63 … … 71 76 == Upgrade Notice == 72 77 78 = 0.2.0 = 79 Adds an optional rule that lets shoppers in when the waiting room can't be reached. 80 73 81 = 0.1.1 = 74 82 Adds logo, colour, message and theme settings for the waiting page. 75 83 76 84 == Changelog == 85 86 = 0.2.0 = 87 * New option "Let shoppers in if the waiting room can't be reached" (off by default): if the room's status check times out or fails, shoppers go straight in, including at add to cart and checkout. 77 88 78 89 = 0.1.1 = -
hibira-waiting-room/trunk/uninstall.php
r3808590 r3835631 9 9 defined( 'WP_UNINSTALL_PLUGIN' ) || exit; 10 10 11 foreach ( array( 'app_id', 'key', 'secret', 'host', 'enabled', 'room', 'scope', 'products', 'categories', 'skip_staff', 'skip_bots', 'once_per_pass' ) as $hibira_wr_name ) {11 foreach ( array( 'app_id', 'key', 'secret', 'host', 'enabled', 'room', 'scope', 'products', 'categories', 'skip_staff', 'skip_bots', 'once_per_pass', 'fail_open' ) as $hibira_wr_name ) { 12 12 delete_option( 'hibira_wr_' . $hibira_wr_name ); 13 13 }
Note:
See TracChangeset
for help on using the changeset viewer.