icoa-cli 2.19.72 → 2.19.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1040,6 +1040,20 @@ export function registerExamCommand(program) {
1040
1040
  state.answers[num] = c;
1041
1041
  state._lastQ = num;
1042
1042
  saveExamState(state);
1043
+ // Per-question sync to server (real exam only). Best-effort, fire-and-forget.
1044
+ // If timer expires or network drops before final submit, the server still
1045
+ // has the answer. Final submit is authoritative and overwrites this.
1046
+ const tokenForSync = state.session.token;
1047
+ if (tokenForSync && state.session.examId !== 'demo-free') {
1048
+ const cfg = getConfig();
1049
+ const url = `${cfg.ctfdUrl || 'https://practice.icoa2026.au'}/api/icoa/exams/${state.session.examId}/answer`;
1050
+ fetch(url, {
1051
+ method: 'POST',
1052
+ headers: { 'Content-Type': 'application/json' },
1053
+ body: JSON.stringify({ token: tokenForSync, question: num, answer: c }),
1054
+ signal: AbortSignal.timeout(5000),
1055
+ }).catch(() => { }); // silent failure — local state still saved
1056
+ }
1043
1057
  const answered = Object.keys(state.answers).length;
1044
1058
  const total = state.session.questionCount;
1045
1059
  printSuccess(`Q${num}: ${c} ✓ (${answered}/${total} answered)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icoa-cli",
3
- "version": "2.19.72",
3
+ "version": "2.19.73",
4
4
  "description": "ICOA CLI — The world's first CLI-native CTF competition terminal",
5
5
  "type": "module",
6
6
  "bin": {