You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-10Lines changed: 36 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,8 +95,8 @@ Missions are grouped into three categories on the Hub:
95
95
96
96
***Frontend:** HTML5, CSS3 (Retro-Cyberpunk aesthetic with CRT effects, scanlines, and neon animations). Fully responsive with mobile media queries (`<600px`, `601–900px`).
97
97
***Database & Auth:****Firebase** (Firestore for XP/Leaderboard/Daily Scores and Firebase Auth for Email/Password + Google Sign-In).
98
-
***Audio Engine:****Web Audio API** — procedurally generated success, error, and click sounds, plus two selectable ambient music tracks (Cyberpunk and Dark Ambient) with reverb, arpeggios, kick/hihat rhythm, and LFO modulation.
99
-
***Logic:** Modular ES6+ JavaScript.
98
+
***Audio Engine:****Web Audio API** — procedurally generated success, error, and click sounds, plus three selectable ambient music tracks (Cyberpunk, Dark Ambient, Hacker Terminal) with reverb, arpeggios, kick/hihat rhythm, and LFO modulation.
99
+
***Logic:** Modular ES6+ JavaScript with clear single-responsibility module boundaries.
100
100
***AI Integration:** OpenRouter API (Mistral-7B) for live phishing scenario generation with a local fallback engine.
101
101
***Adaptive Learning:**`adaptive.js` engine delivers difficulty scaling (timer, extra steps) and actionable safety protocols based on user XP rank.
102
102
@@ -106,12 +106,13 @@ Missions are grouped into three categories on the Hub:
106
106
107
107
| Mechanic | Description |
108
108
| :--- | :--- |
109
-
|**XP & Leaderboard**| Earn XP for every successful mission and climb the global top-5 ranks (stored in Firestore). |
109
+
|**XP & Leaderboard**| Earn XP for every successful mission and climb the global ranks (stored in Firestore). |
110
+
|**Daily XP Cap**| Each mission awards XP only once per calendar day — enforced server-side in Firestore. Replaying a mission after earning XP that day gives 0 XP, preventing spam farming. Resets at midnight. |
110
111
|**Rank System**| Novice (0 XP) → Specialist (100 XP) → Elite Guardian (500 XP), with a progress bar. |
111
112
|**Adaptive Difficulty**| Timer and scenario complexity scale with XP rank. Novice: 30s timer. Specialist: 27s + extra social engineering steps. Elite: 25s + extra steps. |
|**Mission Locks**| Dark Web (50 XP), AI Crime Lab (75 XP), Incident Response (100 XP), Mission Creator (150 XP). Locked missions show a 🔒 overlay with the required XP. |
114
-
|**🔔 Notification Bell**| When you earn enough XP to unlock a mission or feature, a red badge appears on the 🔔 bell icon in the top bar. Click it to see all unlocks — no intrusive popups. Mark all as read to clear the badge. |
115
+
|**🔔 Notification Bell**| When you earn enough XP to unlock a mission or feature, a red badge appears on the 🔔 bell icon in the top bar. Badge only lights up for genuinely new unlocks earned since your last visit — not on every page load. Mark all as read to clear it. |
115
116
|**Hard Mode**| Unlocked at 300 XP — all missions run at Elite difficulty. |
116
117
|**Mission Completion Tracker**| Profile page shows ✅/⬜ status for all 10 missions. |
117
118
|**Unlocks Panel**| Progress bars in the profile show how close you are to each locked mission/feature. |
@@ -128,7 +129,7 @@ Missions are grouped into three categories on the Hub:
128
129
|**Activity Ticker**| Live scrolling feed on the Hub simulating global community activity. |
129
130
|**High Contrast Mode**| Accessibility toggle persisted via `localStorage`. |
130
131
|**⚙️ Settings Panel**| Gear icon (fixed, top-right) opens a panel with Font Size (Small/Medium/Large dropdown), Music Track selector, Volume slider, Mute button, and Music ON/OFF toggle. All settings persisted via `localStorage`. |
131
-
|**Music Tracks**|Two selectable ambient tracks: ⚡ Cyberpunk (120 BPM minor pentatonic arpeggio + kick/hihat + reverb) and 🌑 Dark Ambient (slow evolving pads + sub-bass + occasional deep thuds). |
132
+
|**Music Tracks**|Three selectable ambient tracks: ⚡ Cyberpunk (120 BPM minor pentatonic arpeggio + kick/hihat + reverb), 🌑 Dark Ambient (slow evolving pads + sub-bass + occasional deep thuds), and 💻 Hacker Terminal (glitchy bleeps + low pulse). |
132
133
|**Audio Controls**| Volume slider, mute button, music toggle, and track selector — all inside the ⚙️ Settings panel. |
133
134
|**Breadcrumbs**| Auto-injected navigation trail on all mission pages. |
134
135
|**Personalized Greeting**| Hub shows "Hi, [name]!" using `displayName` for Google users or the part before `@` for email/password users. |
@@ -142,7 +143,7 @@ Missions are grouped into three categories on the Hub:
142
143
CyberArena/
143
144
├── hub.html # Mission Hub — missions only, top bar with Profile & Bell
* The project is pre-configured with a demo Firebase project (`cyberarena-77a96`). To use your own, update `js/firebase.js` with your project credentials.
195
+
* Ensure your Firestore security rules allow authenticated users to read and write their own document:
* Open `index.html`in any modern web browser. A local server (e.g., VS Code Live Server) is recommended for Firebase ES modules to load correctly.
192
203
4. **Or visit the live hosted version directly at [https://cyberarena-77a96.web.app](https://cyberarena-77a96.web.app)**
@@ -211,15 +222,30 @@ CyberArena/
211
222
| `muted` | Audio mute state |
212
223
| `volume` | Master volume level (0–1) |
213
224
| `musicOn` | Ambient music on/off state |
214
-
| `musicTrack` | Selected music track (`cyberpunk`or `dark`) |
225
+
| `musicTrack` | Selected music track (`cyberpunk`, `dark`, or `hacker`) |
215
226
| `fontSize` | Font size class (`font-sm`, `font-md`, `font-lg`) |
216
227
| `settingsPanelOpen` | Whether the ⚙️ settings panel is open or closed |
217
228
| `openrouter_api_key` | OpenRouter API key for live AI phishing scenarios |
229
+
| `lastSeenXP` | XP value at last hub visit — used to detect genuinely new unlocks for the 🔔 bell |
218
230
| `seenUnlocks` | Array of unlock IDs already processed — prevents duplicate bell notifications |
219
231
| `unlockNotifications` | Array of unlock notification objects `{ id, label, description, read }` for the 🔔 bell |
220
232
221
233
---
222
234
235
+
## 🔒 XP Integrity
236
+
237
+
XP farming is prevented by a **per-mission daily cap** enforced server-side in Firestore:
238
+
239
+
- Each mission can award XP only **once per calendar day** per user.
240
+
- On completion, `updateXP()` writes `dailyXP.{missionId}_{YYYY-MM-DD} = true` to the user's Firestore document.
241
+
- On the next call for the same mission that day, the flag is detected before any write occurs and the functionreturns early.
242
+
- The key is date-scoped, so XP resets naturally at midnight with no cleanup job needed.
243
+
- Because the check happens against Firestore (not `localStorage`), it cannot be bypassed by clearing browser storage.
244
+
245
+
The Daily Challenge has its own separate replay protection via `dailyScores/{dateKey}/players`in Firestore.
246
+
247
+
---
248
+
223
249
## 🛡️ Security Education at its Best
224
250
CyberArena isn't just a game — it's a training ground forthe digital age. By simulating the psychological and technical tactics of hackers, we empower users to become the strongest linkin the security chain.
0 commit comments