Skip to content
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
16 changes: 9 additions & 7 deletions generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -886,13 +886,20 @@ type WatchDemoOutput {
success: Boolean!
}

type WebPushKeysOutput {
success: Boolean!
type WebPushPlatformCount {
devices: Int!
platform: String!
}

type WebPushStatusOutput {
active_7d: Int!
configured: Boolean!
last_delivered_at: timestamptz
managed_by_environment: Boolean!
never_delivered: Int!
new_7d: Int!
platforms: [WebPushPlatformCount!]!
players: Int!
subscriptions: Int!
}

Expand Down Expand Up @@ -38866,11 +38873,6 @@ type mutation_root {
denyNameChange(name: String!, steam_id: bigint!): SuccessOutput
forfeitMatch(match_id: uuid!, winning_lineup_id: uuid!): SuccessOutput

"""
Generates a fresh self-signed VAPID keypair; invalidates every existing subscription
"""
generateWebPushKeys: WebPushKeysOutput

"""
Live pod GSI snapshot — slots, sides, alive/dead. Drives the stream-deck.
"""
Expand Down
36 changes: 23 additions & 13 deletions generated/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -821,14 +821,21 @@ export interface WatchDemoOutput {
__typename: 'WatchDemoOutput'
}

export interface WebPushKeysOutput {
success: Scalars['Boolean']
__typename: 'WebPushKeysOutput'
export interface WebPushPlatformCount {
devices: Scalars['Int']
platform: Scalars['String']
__typename: 'WebPushPlatformCount'
}

export interface WebPushStatusOutput {
active_7d: Scalars['Int']
configured: Scalars['Boolean']
last_delivered_at: (Scalars['timestamptz'] | null)
managed_by_environment: Scalars['Boolean']
never_delivered: Scalars['Int']
new_7d: Scalars['Int']
platforms: WebPushPlatformCount[]
players: Scalars['Int']
subscriptions: Scalars['Int']
__typename: 'WebPushStatusOutput'
}
Expand Down Expand Up @@ -12922,8 +12929,6 @@ export interface mutation_root {
denyInvite: (SuccessOutput | null)
denyNameChange: (SuccessOutput | null)
forfeitMatch: (SuccessOutput | null)
/** Generates a fresh self-signed VAPID keypair; invalidates every existing subscription */
generateWebPushKeys: (WebPushKeysOutput | null)
/** Live pod GSI snapshot — slots, sides, alive/dead. Drives the stream-deck. */
getLiveStreamSpecState: (LiveStreamSpecState | null)
getTestUploadLink: GetTestUploadResponse
Expand Down Expand Up @@ -37194,15 +37199,22 @@ export interface WatchDemoOutputGenqlSelection{
__scalar?: boolean | number
}

export interface WebPushKeysOutputGenqlSelection{
success?: boolean | number
export interface WebPushPlatformCountGenqlSelection{
devices?: boolean | number
platform?: boolean | number
__typename?: boolean | number
__scalar?: boolean | number
}

export interface WebPushStatusOutputGenqlSelection{
active_7d?: boolean | number
configured?: boolean | number
last_delivered_at?: boolean | number
managed_by_environment?: boolean | number
never_delivered?: boolean | number
new_7d?: boolean | number
platforms?: WebPushPlatformCountGenqlSelection
players?: boolean | number
subscriptions?: boolean | number
__typename?: boolean | number
__scalar?: boolean | number
Expand Down Expand Up @@ -57623,8 +57635,6 @@ export interface mutation_rootGenqlSelection{
denyInvite?: (SuccessOutputGenqlSelection & { __args: {invite_id: Scalars['uuid'], type: Scalars['String']} })
denyNameChange?: (SuccessOutputGenqlSelection & { __args: {name: Scalars['String'], steam_id: Scalars['bigint']} })
forfeitMatch?: (SuccessOutputGenqlSelection & { __args: {match_id: Scalars['uuid'], winning_lineup_id: Scalars['uuid']} })
/** Generates a fresh self-signed VAPID keypair; invalidates every existing subscription */
generateWebPushKeys?: WebPushKeysOutputGenqlSelection
/** Live pod GSI snapshot — slots, sides, alive/dead. Drives the stream-deck. */
getLiveStreamSpecState?: (LiveStreamSpecStateGenqlSelection & { __args: {match_id: Scalars['uuid']} })
getTestUploadLink?: GetTestUploadResponseGenqlSelection
Expand Down Expand Up @@ -101977,10 +101987,10 @@ export type SubscriptionGenqlSelection = subscription_rootGenqlSelection



const WebPushKeysOutput_possibleTypes: string[] = ['WebPushKeysOutput']
export const isWebPushKeysOutput = (obj?: { __typename?: any } | null): obj is WebPushKeysOutput => {
if (!obj?.__typename) throw new Error('__typename is missing in "isWebPushKeysOutput"')
return WebPushKeysOutput_possibleTypes.includes(obj.__typename)
const WebPushPlatformCount_possibleTypes: string[] = ['WebPushPlatformCount']
export const isWebPushPlatformCount = (obj?: { __typename?: any } | null): obj is WebPushPlatformCount => {
if (!obj?.__typename) throw new Error('__typename is missing in "isWebPushPlatformCount"')
return WebPushPlatformCount_possibleTypes.includes(obj.__typename)
}


Expand Down
30 changes: 24 additions & 6 deletions generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2779,21 +2779,42 @@ export default {
80
]
},
"WebPushKeysOutput": {
"success": [
5
"WebPushPlatformCount": {
"devices": [
40
],
"platform": [
80
],
"__typename": [
80
]
},
"WebPushStatusOutput": {
"active_7d": [
40
],
"configured": [
5
],
"last_delivered_at": [
4584
],
"managed_by_environment": [
5
],
"never_delivered": [
40
],
"new_7d": [
40
],
"platforms": [
100
],
"players": [
40
],
"subscriptions": [
40
],
Expand Down Expand Up @@ -152370,9 +152391,6 @@ export default {
]
}
],
"generateWebPushKeys": [
100
],
"getLiveStreamSpecState": [
45,
{
Expand Down
19 changes: 11 additions & 8 deletions hasura/metadata/actions.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ type Query {
webPushStatus: WebPushStatusOutput
}

type Mutation {
generateWebPushKeys: WebPushKeysOutput
}

type Mutation {
bakeShaders(
game_server_node_id: uuid!
Expand Down Expand Up @@ -987,14 +983,21 @@ type SuccessOutput {
success: Boolean!
}

type WebPushPlatformCount {
platform: String!
devices: Int!
}

type WebPushStatusOutput {
configured: Boolean!
managed_by_environment: Boolean!
subscriptions: Int!
}

type WebPushKeysOutput {
success: Boolean!
players: Int!
active_7d: Int!
new_7d: Int!
never_delivered: Int!
last_delivered_at: timestamptz
platforms: [WebPushPlatformCount!]!
}

type DraftGamePreviewPlayer {
Expand Down
10 changes: 1 addition & 9 deletions hasura/metadata/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,6 @@ actions:
permissions:
- role: administrator
comment: Web push setup status for the application settings page; never returns the private key
- name: generateWebPushKeys
definition:
kind: synchronous
handler: '{{HASURA_GRAPHQL_ACTIONS_HOOK}}'
forward_client_headers: true
permissions:
- role: administrator
comment: Generates a fresh self-signed VAPID keypair; invalidates every existing subscription
- name: bakeShaders
definition:
kind: synchronous
Expand Down Expand Up @@ -1334,8 +1326,8 @@ custom_types:
source: default
type: object
- name: SuccessOutput
- name: WebPushPlatformCount
- name: WebPushStatusOutput
- name: WebPushKeysOutput
- name: ScanStartedOutput
- name: OrphanObject
- name: OrphanScanResultOutput
Expand Down
2 changes: 1 addition & 1 deletion src/notifications/preferences/notification-categories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const IN_APP_KEYS: PreferenceKey[] = [
{ key: "TeamInvite", defaultEnabled: true },
{ key: "TournamentTeamInvite", defaultEnabled: true },
{ key: "DraftInvite", defaultEnabled: true },
{ key: "MatchImported", defaultEnabled: false },
{ key: "MatchImported", defaultEnabled: true },
{ key: "MatchStatsReady", defaultEnabled: true },
{ key: "ClipReady", defaultEnabled: true },
{ key: "AwardGranted", defaultEnabled: true },
Expand Down
11 changes: 1 addition & 10 deletions src/notifications/push/push-notifications.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,13 @@ export class PushNotificationsController {
// never returns the private key.
@HasuraAction()
public async webPushStatus() {
const [subscriptions] = await this.pushNotifications.countSubscriptions();

return {
configured: this.pushNotifications.isConfigured(),
managed_by_environment: this.pushNotifications.isManagedByEnvironment(),
subscriptions,
...(await this.pushNotifications.getSubscriptionStats()),
};
}

@HasuraAction()
public async generateWebPushKeys() {
await this.pushNotifications.generateKeys();

return { success: true };
}

@Post("subscribe")
@UseGuards(SteamGuard)
public async subscribe(
Expand Down
Loading
Loading