-
Notifications
You must be signed in to change notification settings - Fork 17
[Keylog] Support new keylog format #262
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
base: main
Are you sure you want to change the base?
Conversation
| const data: number[] = await response.json(); | ||
| setKeylog(data); | ||
| const events = await fetchNDJSON(); | ||
| const startTime = new Date(contestInfo?.status.type === ContestStatus.Type.running ? contestInfo.status.startedAtUnixMs : 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to change
| case ContestStatus.Type.before: | ||
| return contestInfo.status.scheduledStartAtUnixMs ?? 0; | ||
| case ContestStatus.Type.running: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to return undefined, not 0
fa4ec22 to
690e872
Compare
| ); | ||
| } | ||
|
|
||
| interface KeyboardEvent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name clash with the https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
| .trim() | ||
| .split("\n") | ||
| .filter((line) => line.trim()) | ||
| .map((line) => JSON.parse(line) as KeyboardEvent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a single last line is not fully read/written we won't be showing all the keyboard events. Maybe it's a good idea to add the try/catch somewhere else or extract this whole procedure to a function that would try to read all the events
| .trim() | ||
| .split("\n") | ||
| .filter((line) => line.trim()) | ||
| .map((line) => JSON.parse(line) as KeyboardEvent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds computationally heavy considering that a keylog file might be more than a megabyte. Moving it to a seperate worker that would fetch and cache the keylog data is probably a good idea



































































support new format