Skip to content

feat: Track game activity metadata#536

Open
micuele wants to merge 2 commits into
leanprover-community:mainfrom
micuele:feat/game-activity-metadata
Open

feat: Track game activity metadata#536
micuele wants to merge 2 commits into
leanprover-community:mainfrom
micuele:feat/game-activity-metadata

Conversation

@micuele

@micuele micuele commented Jul 3, 2026

Copy link
Copy Markdown

Adds activity metadata for inactive-game detection.

Lean4Game can now record first-seen, import, and play timestamps in games/.lean4game/activity.json and exposes them via /api/game-activity.

@micuele micuele changed the title Feat: Track game activity metadata feat: Track game activity metadata Jul 3, 2026

@joneugster joneugster left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea!

Comment thread relay/src/index.ts
}
})
})
.get('/api/game-activity', async (_req, res) => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This endpoint now provides an easy way to query all hidden games. Previously, I think, that was only possible by brute-forcing the URL.

I'm not saying this is necessarily bad, but I think this should be communicated clearly (as it's relaxing the security on one feature) and/or be explicitly mentioned in the docs.

const defaultActivityPath = path.join(process.cwd(), 'games', '.lean4game', 'activity.json')

export const gameActivityStore = new GameActivityStore(
process.env.GAME_ACTIVITY_FILE || defaultActivityPath

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In lean4web there is a list of all env variables: https://github.com/leanprover-community/lean4web/blob/main/doc/Installation.md#environment-variables

Maybe you could add something similar to the documentation?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! I’ll also update the documentation for the new environment variable and the /api/game-activity endpoint

Comment thread relay/src/services/GameActivityStore.ts Outdated
return this.update(owner, repo, 'seen', now)
}

private update(owner: string, repo: string, event: 'import' | 'play' | 'seen', now: Date): Promise<void> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Event-Typ als enum?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants