[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-110937":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":13,"stars90d":15,"forks30d":15,"starsTrendScore":17,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":23,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":15,"starSnapshotCount":15,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},110937,"elite-1337","jawadelyousfi17\u002Felite-1337","jawadelyousfi17","Explore 1337 student rankings, track your Common Core progress, and find projects waiting for correction across Khouribga, Benguerir, Tétouan, and Rabat.","https:\u002F\u002Felite-1337.app",null,"TypeScript",57,6,51,0,1,3,43.64,false,"main",true,[],"2026-11-21 15:01:19","2026-11-22 15:54:29","# Elite 1337\n\nA Next.js leaderboard for people with 42 Intra accounts. It uses 42 OAuth and live 42 API data to rank students at configured 1337 campuses. This is an independent community project.\n\n## Local setup\n\nRequires Node.js 20+ and a 42 API application.\n\n```sh\nnpm install\ncp .env.example .env.local\n# Add your 42 application ID and secret to .env.local.\n# Generate AUTH_SECRET with: openssl rand -base64 32\nnpm run dev\n```\n\nThe 42 application's registered redirect URI must be **exactly** `http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fauth\u002Fcallback\u002F42` for local sign-in. If the developer portal permits only one redirect URI, use a separate 42 development application. The production URI for this app is `https:\u002F\u002Fwww.elite-1337.app\u002Fapi\u002Fauth\u002Fcallback\u002F42`. A site root URL alone does not complete Auth.js OAuth. The provider ID is `42`, which determines the callback path. Keep `.env.local` private; it is ignored by Git.\n\nThe live 42 API was queried to verify the 1337 campus IDs `16` (Khouribga), `21` (Benguerir), `55` (Tétouan), `75` (Rabat), and Common Core `42cursus` ID `21`. The app always includes these four campuses. An optional `FORTYTWO_CAMPUS_IDS` value is validated against this list. `FORTYTWO_CURSUS_ID` should be `21`.\n\nAny authenticated 42 Intra account can open the leaderboard. Ranking eligibility is separate: only current students in the configured campus dataset appear in the results.\n\n## How rankings work\n\nThe server fetches every page of `\u002Fv2\u002Fcursus_users` filtered by campus and canonical cursus, using `page[size]=100` and stable ID ordering. The API responses include the cursus level and nested user `active?` field, so thousands of individual profile requests are unnecessary. It verifies the reported `X-Total` count and unique cursus record IDs for each campus before showing ranks. If any page fails or the count changes, it shows an explicit incomplete-data state and publishes no partial ranking.\n\nAn eligible student must have a verified student account, active Common Core enrollment, and a finite level in the configured cursus. The classifier excludes API-marked staff, nonstudents, alumni, ended enrollments, inactive users, and IDs in the optional auditable `FORTYTWO_EXCLUDED_USER_IDS` configuration. A second distinct active record in that cursus is ambiguous and excluded. The `blackholed_at` field is a deadline on many active records, so it is not used alone to label or exclude a student. Students with multiple 1337 campus memberships have one global rank and one rank per campus. Ranks use competition ties; login and immutable 42 user ID make display order stable. Search and pagination happen after complete scope ranks are calculated.\n\nCohorts follow HUB’s promo grouping of the Common Core `cursus_users.begin_at` field: March 2019 is `2019-03`, every other 2019 start belongs to `2019-10`, and all other years use `YYYY`. Missing or invalid dates show as Unknown. Promo options are discovered from the shared ranked and blackholed population, so new years appear without a hardcoded list. The same cohort is used for leaderboard filters and ranks, profiles, corrections, XP comparisons, and stats. This grouping does not change ranking eligibility. It is computed from the existing raw campus caches, so it adds no 42 requests and needs no cache-key change. The leaderboard defaults to the signed-in student's primary campus and Common Core entry cohort. Every visit opens on that view, and Reset returns to it; other campuses and cohorts remain available for comparison. Every selected population restarts ranks at #1, while ties retain competition ranks. Login search does not change rank numbers.\n\nThe `\u002Fpiscines` page queries complete, bounded lists of users by verified 42 Piscine year, month and primary campus. A Common Core enrollment verifies an Accepted label, including former students. The current API data does not prove rejection; those candidates remain Unknown and the Not accepted filter has no results. Piscine levels are omitted until they can be retrieved reliably within the API budget. Student photos follow the rules in the avatar section below. On-site and external Intra links are separate, and external links open in a new tab.\n\nThe private dashboard and each on-site student profile show the latest updated project plus workstation session time from 42 locations. This is an API-derived total, not an official Intra accounting figure. Weekly progress uses Monday–Sunday UTC with a 30-hour target. Monthly progress preserves the 28th–27th UTC cycle with a 120-hour target. Wallet and correction points appear on the signed-in student's dashboard. Profile and project details cache for ten minutes; session time caches for five minutes. If an optional 42 endpoint fails, its card shows an unavailable state without hiding the ranking dataset.\n\nThe XP calculator supports a student's progress or a custom starting level. Click the pencil beside the starting level, type a value such as `10.89` (0–30, up to two decimal places), then press Enter or click away to save; Escape cancels. Custom plans offer both Common Core tracks and Advanced projects, count each project's full XP, and carry no personal completion history, rank, or automatic coalition bonus. The coalition bonus toggle and percentage remain available for custom plans, with the clan row hidden; the bonus starts off until enabled. Changing the custom starting level keeps the selected projects and marks. `\u002Fxp?level=10.89` opens that starting point directly. It uses the existing project catalogs without fetching a student's journey or coalition.\n\n## Cluster Explorer (V3)\n\nThe protected `\u002Fclusters` route supports Khouribga, Benguerir, Tétouan, and Rabat. It requires a 42 session and verified membership in at least one of those campuses. Members can switch among the four campuses. The 42 API's `\u002Fv2\u002Fcampus\u002F:id\u002Flocations?filter[active]=true` endpoint supplies active sessions; the server verifies every active page before publishing occupancy. Host groups are discovered from observed workstation names, so campuses need not share the same cluster IDs. The browser receives workstation IDs and anonymous states only, never user IDs, logins, photos, raw location records, or precise session timestamps.\n\nThe directory combines current active hosts with a bounded sample of the 100 most recent campus location records. That sample is **not** a complete enabled-seat inventory. Occupied means one valid open session on a host from a complete, fresh snapshot. Conflicts, malformed or stale sessions, incomplete API pages, and old snapshots are Unknown. Available requires a verified enabled inventory entry and no active session; because no authoritative inventory has been provided yet, the current deployment cannot certify empty seats. The Find Empty Seats control therefore reports zero verified available seats rather than guessing from absence of a session.\n\nThe screenshots supplied for Khouribga are a visual reference, not verified workstation coordinates. `src\u002Flib\u002Fcluster-layout.ts` defines a version-controlled layout registry with campus, cluster, workstation, x\u002Fy position, optional rotation and room label, and enabled status. It is intentionally empty. The UI uses an explicitly labeled directory fallback on every campus. Add a physical map only after an authoritative layout and enabled-seat inventory have been supplied and checked against 42 host IDs.\n\nThe client checks for updates every 60 seconds while visible and avoids overlapping requests. Anonymous active-host snapshots are cached server-side for 180 seconds; the recent-host sample is cached for one day. The UI shows the actual snapshot time and marks states Unknown after four minutes or an API failure. These caches limit API traffic but, like the ranking cache, do not provide a global request budget across all serverless instances. If traffic outgrows the current setup, the smallest viable addition is a shared cache and distributed rate limiter; a database is not needed just to render anonymous occupancy.\n\n## API limits and caching\n\nThe shared server-side 42 client spaces requests at least 600 ms apart and caps its own traffic at 1,180 requests per hour per server instance, leaving a small margin under the stated 1,200\u002Fhour application limit. HTTP 429 and transient server failures use bounded exponential backoff. The initial complete fetch is about a few dozen paginated requests and can take tens of seconds.\n\nNext.js Data Cache retains successful complete ranking and Piscine datasets for one hour. Failed or partial refreshes are not cached as complete data. Cache freshness is displayed on the leaderboard. Serverless instances do not share the in-memory request pacer, and cache behavior depends on deployment infrastructure; this MVP cannot guarantee a global application-wide request limit or durable rankings without shared infrastructure. Heavy concurrent cold starts can hit the 42 limit. The UI shows a rate-limit or incomplete-data state in that case. If traffic grows, move the API pacer and complete snapshots to shared persistent infrastructure.\n\n## Student photos\n\nBy default, each student shows their 42 Intra photo. The 42 API returns `user.image` URLs on `cdn.intra.42.fr`, which answer HTTP 403 to a browser without an Intra session. The server keeps only the validated `small` (175 × 175) CDN path in the cached datasets. Pages emit HMAC-signed `\u002Fapi\u002Fphotos\u002F:userId` references. That route requires the 42 session, then downloads the photo with the application token, checks its image bytes, and returns it with `private, max-age=86400, immutable` caching (the CDN path changes when a student changes their photo). CDN downloads are not 42 API calls and do not use the API request budget. If the CDN refuses a photo, the avatar falls back to initials. As of 2026-10-22, token-authenticated CDN reads succeeded consistently; an earlier test on 2026-10-19 saw repeated 403s, so watch for regressions.\n\n## Verify\n\n```sh\nnpm run typecheck\nnpm test\nnpm run build\nnpm run verify:api  # optional live check; uses your 42 API request budget\n```\n\nTests cover cohort semantics, Piscine filters and admission uncertainty, ties, campus scope, eligibility, pagination, incomplete pages, HTTP 429 retry, logtime boundaries and overlap, and the local hourly budget. V3 tests cover workstation normalization, campus groups, session conflicts and staleness, availability versus Unknown, disabled seats, privacy, membership checks, authenticated endpoint behavior, and API failure fallback. V3.1 tests cover upload validation, owner checks, private reads, replacement, deletion, batched mapping, missing objects, and storage errors. Mock fixtures exist only in tests and never appear as real student records.\n\n## Vercel deployment\n\nSet `FORTYTWO_CLIENT_ID`, `FORTYTWO_CLIENT_SECRET`, `FORTYTWO_CURSUS_ID=21`, `AUTH_SECRET`, and `AUTH_URL=https:\u002F\u002Fwww.elite-1337.app` as private Vercel environment variables. `FORTYTWO_CAMPUS_IDS=16,21,55,75` and `FORTYTWO_EXCLUDED_USER_IDS` are optional. V3.1 avatars additionally require private `SUPABASE_URL` and `SUPABASE_SERVICE_ROLE_KEY` values plus the one-time SQL setup above. Register `https:\u002F\u002Fwww.elite-1337.app\u002Fapi\u002Fauth\u002Fcallback\u002F42` as the exact 42 redirect URI. Redeploy after changing Vercel environment variables, then check a real 1337 sign-in. The protected pages allow up to 60 seconds for a cold complete refresh; verify that your Vercel plan supports that function duration. Use HTTPS in production.\n","Elite 1337 是一个基于 Next.js 的开源学生成绩排行榜系统，专为 42 网络（42 Network）旗下 1337 编程学校（Khouribga、Benguerir、Tétouan、Rabat 四个校区）设计。它通过 42 Intra 官方 API 实时拉取学生在 Common Core（cursus ID 21）中的等级、活跃状态与入学时间等数据，自动计算并展示全局及分校区排名，支持按 cohort（入学期）筛选与搜索。项目采用 TypeScript 开发，集成 42 OAuth 认证，具备数据完整性校验、异常降级提示与配置化排除机制。适用于 1337 学生自我进度追踪、校区间横向对比及教学管理辅助场景。",2,"2026-11-24 04:40:00","CREATED_QUERY"]