Add visitor-IP header setting, checkout-button toggles, and configurable timer maximum
Test and Release / test (push) Successful in 1m13s
Test and Release / release (push) Successful in 5s

- Core\ClientIp: trusted-header resolution for rate limiting behind Cloudflare/proxies
- Settings: show/hide Pay Later and Debit/Credit Card (Pay Later off by default)
- add_time rule: optional max_timer_seconds (uncapped by default), editable in rule form

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-15 11:40:06 -08:00
1 parent 4f92cfdade
commit e4d9042aba
14 files changed
+278 -16

No files matched your search

+9
View File
@@ -46,6 +46,7 @@ final class RuleConfig {
}
$cap = self::optionalMinutes( $in['cap_minutes'] ?? '', 'The per-donation limit', $errors );
$max = self::optionalMinutes( $in['max_total_minutes'] ?? '', 'The total limit', $errors );
$clk = self::optionalMinutes( $in['max_timer_minutes'] ?? '', 'The longest the timer can get', $errors );
if ( $errors ) {
return array( 'config' => null, 'errors' => $errors );
}
@@ -59,6 +60,7 @@ final class RuleConfig {
'unit_minor' => $unit,
'cap_seconds_per_donation' => $cap,
'max_total_seconds' => $max,
'max_timer_seconds' => $clk,
'basis' => $basis,
),
'errors' => array(),
@@ -128,6 +130,9 @@ final class RuleConfig {
if ( isset( $c['max_total_seconds'] ) ) {
$s .= ', ' . Format::duration( (int) $c['max_total_seconds'] ) . ' in total';
}
if ( isset( $c['max_timer_seconds'] ) ) {
$s .= ', up to ' . Format::duration( (int) $c['max_timer_seconds'] ) . ' on the clock';
}
return $s;
case 'counter':
$label = (string) ( $c['label'] ?? '' );
@@ -158,6 +163,9 @@ final class RuleConfig {
if ( 'add_time' === $type ) {
$res = AddTimeRule::fromConfig( $cfg )->apply( $d, 0, 0, 0 );
$lines[] = $res['delta'] > 0 ? 'Timer: +' . Format::duration( $res['delta'] ) : 'Timer: no time added';
if ( isset( $cfg['max_timer_seconds'] ) ) {
$lines[ count( $lines ) - 1 ] .= ' (the timer never goes above ' . Format::duration( (int) $cfg['max_timer_seconds'] ) . ')';
}
} elseif ( 'counter' === $type ) {
$res = CounterRule::fromConfig( $cfg )->apply( $d, 0, 0 );
$lbl = (string) ( $cfg['label'] ?? '' );
@@ -182,6 +190,7 @@ final class RuleConfig {
$f['unit_amount'] = Format::decimal( (int) ( $c['unit_minor'] ?? 100 ), $currency );
$f['cap_minutes'] = isset( $c['cap_seconds_per_donation'] ) ? (string) intdiv( (int) $c['cap_seconds_per_donation'], 60 ) : '';
$f['max_total_minutes'] = isset( $c['max_total_seconds'] ) ? (string) intdiv( (int) $c['max_total_seconds'], 60 ) : '';
$f['max_timer_minutes'] = isset( $c['max_timer_seconds'] ) ? (string) intdiv( (int) $c['max_timer_seconds'], 60 ) : '';
} elseif ( 'counter' === $type ) {
$f['step'] = (int) ( $c['step'] ?? 1 );
$f['unit_amount'] = Format::decimal( (int) ( $c['per_minor'] ?? 1000 ), $currency );