mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-19 08:35:14 +00:00
store client ips in bigquery table
This commit is contained in:
+9
-8
@@ -42,6 +42,7 @@ export type ClientPingMessage = z.infer<typeof ClientPingMessageSchema>
|
||||
export type ClientIntentMessage = z.infer<typeof ClientIntentMessageSchema>
|
||||
export type ClientJoinMessage = z.infer<typeof ClientJoinMessageSchema>
|
||||
|
||||
export type PlayerRecord = z.infer<typeof PlayerRecordSchema>
|
||||
export type GameRecord = z.infer<typeof GameRecordSchema>
|
||||
|
||||
const PlayerTypeSchema = z.nativeEnum(PlayerType);
|
||||
@@ -105,11 +106,6 @@ export const BoatAttackIntentSchema = BaseIntentSchema.extend({
|
||||
y: z.number(),
|
||||
})
|
||||
|
||||
export const UpdateNameIntentSchema = BaseIntentSchema.extend({
|
||||
type: z.literal('updateName'),
|
||||
name: z.string(),
|
||||
})
|
||||
|
||||
export const AllianceRequestIntentSchema = BaseIntentSchema.extend({
|
||||
type: z.literal('allianceRequest'),
|
||||
requestor: z.string(),
|
||||
@@ -228,20 +224,25 @@ export const ClientIntentMessageSchema = ClientBaseMessageSchema.extend({
|
||||
|
||||
export const ClientJoinMessageSchema = ClientBaseMessageSchema.extend({
|
||||
type: z.literal('join'),
|
||||
clientIP: z.string().nullable(),
|
||||
lastTurn: z.number() // The last turn the client saw.
|
||||
})
|
||||
|
||||
export const ClientMessageSchema = z.union([ClientPingMessageSchema, ClientIntentMessageSchema, ClientJoinMessageSchema]);
|
||||
|
||||
export const PlayerRecordSchema = z.object({
|
||||
clientID: z.string(),
|
||||
username: z.string(),
|
||||
ip: z.string().nullable(),
|
||||
})
|
||||
|
||||
export const GameRecordSchema = z.object({
|
||||
id: z.string(),
|
||||
gameConfig: GameConfigSchema,
|
||||
players: z.array(PlayerRecordSchema),
|
||||
startTimestampMS: z.number(),
|
||||
endTimestampMS: z.number(),
|
||||
durationSeconds: z.number(),
|
||||
date: z.string(),
|
||||
usernames: z.array(z.string()),
|
||||
num_turns: z.number(),
|
||||
turns: z.array(TurnSchema)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user