Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add waiting room turnstile integration fields #3764

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3764.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
waiting_room: add waiting room turnstile integration fields
```
4 changes: 4 additions & 0 deletions waiting_room.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ type WaitingRoom struct {
QueueingStatusCode int `json:"queueing_status_code"`
EnabledOriginCommands []string `json:"enabled_origin_commands,omitempty"`
CookieAttributes *WaitingRoomCookieAttributes `json:"cookie_attributes,omitempty"`
TurnstileMode string `json:"turnstile_mode,omitempty"`
TurnstileAction string `json:"turnstile_action,omitempty"`
}

// WaitingRoomStatus describes the status of a waiting room.
Expand Down Expand Up @@ -70,6 +72,8 @@ type WaitingRoomEvent struct {
DisableSessionRenewal *bool `json:"disable_session_renewal,omitempty"`
Suspended bool `json:"suspended"`
ShuffleAtEventStart bool `json:"shuffle_at_event_start"`
TurnstileMode string `json:"turnstile_mode,omitempty"`
TurnstileAction string `json:"turnstile_action,omitempty"`
}

type WaitingRoomRule struct {
Expand Down
12 changes: 10 additions & 2 deletions waiting_room_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ var waitingRoomJSON = fmt.Sprintf(`
"cookie_suffix": "example_shop",
"additional_routes": [{"host": "shop2.example.com", "path": "/shop/checkout"}],
"queueing_status_code": 200,
"enabled_origin_commands": ["revoke"]
"enabled_origin_commands": ["revoke"],
"turnstile_mode": "invisible",
"turnstile_action": "log"
}
`, waitingRoomID, testTimestampWaitingRoom.Format(time.RFC3339Nano), testTimestampWaitingRoom.Format(time.RFC3339Nano),
testTimestampWaitingRoomEventStart.Format(time.RFC3339Nano))
Expand All @@ -65,7 +67,9 @@ var waitingRoomEventJSON = fmt.Sprintf(`
"session_duration": null,
"disable_session_renewal": null,
"queueing_method": "random",
"custom_page_html": "{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}"
"custom_page_html": "{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}",
"turnstile_mode": "invisible",
"turnstile_action": "log"
}
`, waitingRoomEventID, testTimestampWaitingRoomEvent.Format(time.RFC3339Nano),
testTimestampWaitingRoomEvent.Format(time.RFC3339Nano),
Expand Down Expand Up @@ -131,6 +135,8 @@ var waitingRoom = WaitingRoom{
AdditionalRoutes: []*WaitingRoomRoute{{Host: "shop2.example.com", Path: "/shop/checkout"}},
QueueingStatusCode: 200,
EnabledOriginCommands: []string{"revoke"},
TurnstileMode: "invisible",
TurnstileAction: "log",
}

var waitingRoomEvent = WaitingRoomEvent{
Expand All @@ -150,6 +156,8 @@ var waitingRoomEvent = WaitingRoomEvent{
DisableSessionRenewal: nil,
QueueingMethod: "random",
CustomPageHTML: "{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}",
TurnstileMode: "invisible",
TurnstileAction: "log",
}

var waitingRoomStatus = WaitingRoomStatus{
Expand Down
Loading