Spaces:
Running
Running
Commit History
Today
-
security(cfskill-run3): deep audit fixes + SonarCloud quality pass
Z UserAudit (cloudflare/security-audit-skill, 7 coverage units, 5 hunter waves): - cache: Redis delPattern prefix->glob — settings/approval-gate invalidation was a silent no-op under Redis (stale contact info + delayed gate close) - jwt/approval: remove hardcoded dev APP_SECRET fallback (public repo secret) - boot: production fatal log when EDGE_HOST_ENFORCE unset (fail-loud) - yt-sync: GET /state now bound to x-sync-ts window (eternal replay lane gone) - paymob webhook: signed currency actually passed to verifyPaymobAmount; promo quota released on terminal FAILED events (+ idempotent re-consume when a later event completes the same order) - push: endpoint rows can no longer be re-bound/cross-deleted between users - sessions: bounded device-metadata strings (column widths) - notification links: protocol-relative URLs rejected; noopener unified; Paymob redirect pinned to accept.paymob.com - deploy.sh: secret gate covers re_/gsk_/nvapi-/modal-/mysql:// families SonarCloud (194 open ->…700d33c
Yesterday
-
fix(pwa+numerals): stuck-device SW cure — build-signed SW URL; device-locale-proof digits
ahmdelbaz28-uxOWNER REPORTS (2026-12-03): 1) SAME deploy: footer Facebook tap fixed on one phone, still dead on the original phone. 2) Home counters rendered Arabic-Indic digits while the UI was English. ROOT CAUSES: 1) PRE-2026-11-26 shells served /sw.js with NO Cache-Control (serve-static default), so old phones kept a heuristic-fresh ancient sw.js in HTTP cache; SW update checks consulted it, the ancient precached-shell worker (navigateFallback era, no in-shell self-heal) was never replaced — the device ran the pre-fix bundle forever. Fresh devices fetched everything new — hence the two-phone divergence. 2) Bare .toLocaleString() followed the DEVICE locale, not the site language: ar-EG devices got Arabic-Indic digits inside the English UI. FIXES: - main.tsx v4: SW registered at /sw.js?v=<buildId> (token from the shell's cache-nuke tag) + updateViaCache:'none' — every deploy presents a NEW script URL no cached sw.js can answer; new worker installs (skipWaiting+clientsC…c7ed040 -
fix(contact+pwa): social taps always land + post-login install suggestion
ahmdelbaz28-uxMEASURED ROOT CAUSES (live production, 2026-12-03): 1) Contact save persistence WORKS: the owner's facebook share URL and gmail address are stored in siteSettings AND served by the live footer. The reported 'save reverts' predated the current deployment state. 2) Footer icon activation WORKS in normal browsers (proved via same-tab navigation: the share link lands on the owner's real Facebook page). The genuinely dead case: IN-APP WEBVIEWS (Facebook/Instagram/TikTok/ WhatsApp browsers) silently drop target=_blank activations — the user taps and nothing happens. That is what 'the icon does not navigate' felt like on a phone. FIXES: - external-links.ts: openExternal reroutes http(s) taps to the SAME tab inside in-app webviews (UA detection superset incl. TikTok/Bytedance), leaving native target=_blank untouched everywhere else; mailto:/tel: always keep OS handling. Unit-tested (18 cases). - Footer social anchors wired through openExternal. - siteSettings contac…ec94e17
4 days ago
-
fix(sonar): wave 5 - final in-scope sweep, 92 findings across 67 files (complete: 994/994 in-scope)
Z User- 23 two-count files + 44 one-count files: S6582/S7503/S7755/S7773/ S7780/S8786/S9382/S3776/S6759/S6819/S5906/S5976/S3863/S7763/S7785/ S8782/S4138/S7744/S6606/S4624/S7778/S7754 - google-auth-router 47->11, shield 39->6, security middleware 24->8, ForgotPassword 34->4, VerifyEmail 22->5, Courses 28->13 (DOM identical) - S9382 NOSONAR only for: Redis connection retry backoff, migration ledger order - both documented sequential necessities - contract tests re-pinned: issueSessionResponse centralization (both session paths categorize), isHostGateExempt approval-action exemption Verified: tsc clean, eslint 0 errors, vitest 1394/1394.6165987
7 days ago
-
perf(frontend): react-best-practices pass — 16 files, zero behavior change
Security Audit Run 3Applied the vercel-labs react-best-practices catalog (ECC/vercel skills) across src/. Every fix is behavior-preserving; verified with tsc -b clean, biome 0 errors, eslint 0 errors (1 pre-existing warning, was 2), vitest 1391/1391, vite build OK (precache 1510.06 -> 1500.62 KiB). Code-reviewed per the requesting-code-review skill (read-only reviewer over 12a144f..HEAD); the single Important finding (cv-auto wrapper div would break grid equal-height stretch) is fixed via the repo's own cvClass-prop pattern, and the Register referral snapshot edge is handled with an intentional-deps useMemo. Waterfalls (async-*): - NotificationCenter: VAPID public-key fetch no longer serialized behind an up-to-8s serviceWorker.ready wait on first visits (independent lane, own try/catch — error semantics unchanged) - CertificateView share-image: logo (network) + QR (data-URI) loads start concurrently and are awaited inside their original guarded blocks Re-render (rerender-*): - ui/motion TiltCard +…02797da
8 days ago
-
chore(biome): eliminate the organizeImports class repo-wide + close every remaining biome error
Z UserThe three organizeImports errors documented on the avatar feature (review- router, CourseReviews, ChatBot) were one instance of a repo-wide class: 17 assist/source/organizeImports diagnostics across 15 files, all on untouched import blocks. biome check --write applied the safe mechanical reorder (no side-effect-only imports moved — verified against the full diff; the 1391-test suite + tsc + build all pass unchanged). Also closed so `npx biome check .` now exits clean: - email-templates.ts useTemplate: concat → template literal - chatbot-cables-kb.ts noApproximativeNumericConstant ×2: biome-ignore with justification — ac 1.442 Ω/km is measured IEC cable data, NOT the log2(e) constant the rule suspects; auto-fix would have corrupted the table - admin-learning.ts usePlaywrightValidDescribeCallback ×3: biome-ignore — `describe` there is the local error formatter (line 238) for the DB canary diagnostics, not a test-runner describe18afd52 -
fix(remember-device): boot auth verification never destroys a session the server did not reject
ahmdelbaz28-uxRoot cause (measured live 2026-11-25/26): the reported 'exits the site -> the app forgets I was logged in despite Remember this device' was NOT a cookie/session death. The 30-day cookie pair, 7d JWT + 30-day grace renewal and tokenVersion revocation are all sound. What broke the remember-device promise was the BOOT VERIFICATION RACE on infrastructure outside the auth pipeline: - the canonical domain (qzz.io) rides an external Cloudflare edge that answers /api/* with 403 cf-mitigated:challenge ('Just a moment…') — live-captured on /api/health and auth.sessionProbe; an XHR can never solve an interactive challenge, so during any challenge window every tRPC call dies - the HF Space container restarts on every deploy (frequent pushes) and can briefly 5xx during cold starts / healthcheck restarts auth.me ran with retry:false, so the FIRST such failure flipped isAuthenticated to false and ProtectedRoute navigated to /login while the user's valid 30-day cookie was sti…2435544
13 days ago
-
feat(seo,perf,auth): Lighthouse round — Arabic-first document + non-blocking fonts + CLS-stable counter + console-silent session probe
ahmdelbaz28-uxSEO (search-ranking): - index.html declares lang=ar dir=rtl as the STATIC default — crawlers index the raw HTML before any JS; rtl-detect.js still honors per-user preference. - (verified live, unchanged here: robots.txt, dynamic sitemap, per-route canonical + OG + Twitter + JSON-LD all already served by spa-handler) Performance: - Google Fonts stylesheet loaded via media=print swap + preload + noscript fallback — removes the ~770ms render-blocking CSS on slow networks. - AnimatedCounter reserves the FINAL value width (ch + tabular-nums, inline-block) — the digit-by-digit growth was the dominant home-page layout shift (CLS 0.4 measured). Auth / Best Practices: - NEW public auth.sessionProbe (always 200 {authenticated}) replaces the boot probe's auth.me call for fresh guests — the browser logged that guest 401 to the console, permanently capping Lighthouse Best Practices. Oracle semantics (shared probe, mark-on-conclusion, hidden-session recovery) are preserved; isLoa…bd976ab
19 days ago
-
fix(auth): remember-device root cure — login no longer revokes other devices + self-healing session probe
ahmdelbaz28-uxThree chained defects still forced re-login despite 'Remember me on this device' (30-day cookie pair + 30-day grace renewal were already correct): 1. SINGLE-DEVICE REVOCATION (the killer): every ordinary password login bumped users.tokenVersion, instantly invalidating EVERY OTHER device's remembered session. Signing in on the phone force-logged-out the laptop and vice versa; each forced re-login bumped again — a cascade of 'why does it ask me to log in?!' on devices the user never logged out of. PROVEN LIVE on prod: device A's session died (401) after device B's login (remember-device-live-e2e step 8, past the 30s auth-cache window). tokenVersion is now strictly a REVOCATION counter — logout, password change/reset, admin/session revoke still bump it; ordinary login does not. 2. UN-HEALABLE SESSION GATE: the client gated auth.me on the JS-readable elbaz_auth_flag cookie. If that flag died while the REAL HttpOnly session cookie survived (privacy tools, pas…7a24cb9 -
feat(ui): remove fixed WhatsApp FAB — keep assistant + scroll-top as the only fixed widgets
ahmdelbaz28-uxRoot-level removal of the always-on WhatsApp floating button per owner request: - App.tsx: unmount WhatsAppButton (sole mount point) - Delete src/components/WhatsAppButton.tsx (button + welcome bubble + tooltip) - index.css: strip .whatsapp-fab/.whatsapp-pulse/.whatsapp-fab-wrap/enter & welcome keyframes/light-mode rule; re-stack the two remaining FABs — mobile: chatbot now bottom-most (old WhatsApp slot), scroll-top one step above (no empty gap); desktop unchanged (chatbot bottom-right, scroll-top bottom-left) - tailwind.config.js: drop whatsapp-pulse animation + keyframes - ChatBot.tsx / useFabScrollVisibility.ts: purge stale WhatsApp references - Kept intact: admin contact-settings fields (whatsapp number storage) and push-state in-app-browser UA detection (unrelated features) Verified: typecheck clean, 948/948 unit tests, production build OK, 8/8 Playwright DOM checks (no WhatsApp FAB on mobile+desktop, chatbot bottom-most on mobile with scroll-top stacked 10px above, desktop corn…fa37f6d
20 days ago
-
fix(auth): remember-this-device session persistence — kill false-401 logout chain
ahmdelbaz28-uxUser report: closing and reopening the app always demanded a fresh login even though 'Remember this device' was checked. Three chained root causes: 1. FALSE-401 ON DB HICCUP (api/context.ts): a transient MySQL failure inside the auth pipeline was swallowed by createContext's blanket catch, the request degraded to GUEST, requireAuth threw UNAUTHORIZED, and the client destroyed the stored session. One brief DB outage (HF Space wake-up, free-tier connection reset, cold-start race) = permanent logout. CURE: loadUserFromDbWithRetry — one quick DB retry, then the failure surfaces as a retryable INTERNAL_SERVER_ERROR (5xx) instead of a guest 401. createContext rethrows TRPCError instead of swallowing it. 2. GRACE WINDOW BROKE THE 30-DAY PROMISE (api/context.ts): expired-but- signature-valid tokens were renewed only within 24h of expiry, while the remember cookie lasts 30 days — any idle gap beyond ~8 days forced a re-login. CURE: EXPIRED_TOKEN_GRACE_S = AUTH_CO…c50c1a3
21 days ago
-
fix(chatbot+youtube): deep audit root-cures — reply sanitizer no longer corrupts code/parens, Arabic ؟ sentence-end, INVALID_JSON 400, vision abort, blank-chat rejection, YT placeholder+replay+race cures
ahmdelbaz28-uxCHATBOT (8 fixes): - sanitizeReplyOutput: cleanup is now SEAM-SCOPED — the old global (\s*)/multi-space collapse destroyed every reply's code (f() → f), indentation and ASCII SLD boards; no-CJK text is now byte-identical - finalize-reply: U+061F ؟ added to SENTENCE_END_RE + trim scan — Arabic answers no longer look mid-sentence (needless rescue rounds) and closing questions are never cut off - POST /api/chatbot: malformed JSON now answers 400 INVALID_JSON (the /stream fix finally back-ported; was a false 500 + error log) - normalize: an all-blank conversation is rejected 400 BEFORE dispatch (burned a real provider call) - getChatResponse: permanent (no-keys) failure flag — persistence loop stops retrying the unwalkable, misconfigured deployments answer instantly - vision PASS-1 read now honors the caller abortSignal (gone clients stopped burning vision quota) - think-filter: length-changing lowercase (İ) no longer shifts indices and corrupts output — indexOfCI reports original-string i…c2fa8e6
24 days ago
-
security+ux(pre-launch-audit): close CORS/CSRF null-origin hole, exact-origin gate, course pagination, reviews UI, RTL+a11y sweep
Launch Audit BotSECURITY (P0, regression-tested): - Remove opaque origin 'null' from CORS + CSRF allowlists (api/boot.ts, api/middleware/security.ts) — sandboxed <iframe sandbox> attacks that ride SameSite=None cookies are now rejected 403. Electron prod loads the live origin since the session-persistence fix; native shells use Bearer tokens. - CSRF same-origin gate: exact parsed-origin comparison replaces startsWith() prefix matching (sibling-domain bypass closed). - Session grace window 30d -> 24h (api/context.ts): stolen-token effective lifetime drops from ~37d to ~8d; tokenVersion revocation unchanged. - chatbot /stream: malformed JSON now 400 INVALID_JSON instead of unhandled 500. - NEW api/middleware/security.csrf.test.ts — 8 permanent regression tests (null origin, sibling domain, legit origins, S2S no-origin, referer exactness). UX (P1): - Courses catalog: real server-side pagination (?page=N) + debounced server-side search — courses 13+ are no longer unreachable; filter chips …b9995d9
-
fix(e2e): make purchase→certificate journey fully work (4 real bugs)
Z UserFull local E2E (Playwright + MariaDB + HMAC-mocked Paymob gateway) exposed four production defects on the core monetization path: 1. Video lessons could never complete — the frontend never called the server's course.markWatched; only quizzes completed lessons, so any course with video lessons could never reach isCompleted and certificate.generate stayed FORBIDDEN forever. → useWatchTracker now marks the lesson complete on video 'ended' and CourseDetail refetches checkEnrollment via the new onLessonCompleted. 2. Stale enrollment state after paying — global react-query staleTime (5 min) + localStorage persister served the PRE-payment enrolled:false after the gateway redirect (even through location.reload()); paying customers saw 'Buy Now' for up to 5 minutes. → checkEnrollment now uses staleTime: 0 (always verified server-side). 3. CSP had no media-src — <video> fell back to default-src 'self', so R2 presigned URLs (https://<account>.r2.cloudflarestorage.…bc3d5a6
-
fix(launch): /articles deep links + sitemap, restore ultra-strict check:all, biome/hadolint cleanup, DEPLOYMENT.md
Z Userproduction-audit + lint-all skills round: - seo-meta: /articles was a navbar-linked public route the server answered with HTTP 404 (soft-404 whitelist never learned it) — added to STATIC_ROUTES + ROUTE_META + dynamic /articles/:slug pattern with DB-driven meta (title/excerpt/cover/breadcrumb) + sitemap article URLs - seo-routes.test.ts: regression tests for the whitelist - restore tsconfig.ultracheck.json (deleted in 10963b9 refactor, leaving check:all/check:strict dangling) + App.tsx noImplicitReturns fix - biome: fix all 13 latent errors (useTemplate, useLiteralKeys, useExhaustiveDependencies incl. real fix for CourseDetail auto-select, useIterableCallbackReturn, control-char regex suppressions, FloatingIconsBg file-scoped override for static SVG innerHTML) - hadolint: restore DL4006 ignore directive adjacency broken by a later comment insertion - DEPLOYMENT.md: deploy map, health verification, 3 rollback paths, forward-only DB policy, secrets map, incident owner (a…d46b16a -
fix(security): remediate audit run-1 confirmed findings (20)
Z UserCloudflare security-audit skill, full audit of 8ea551b (quick profile, source-only): 34 coverage units, 8 hunter domains, 6 independent verifiers, 21 confirmed + 7 needs_validation records. Artifacts: security-audit-skill/elbaz-platform/run-1/{REPORT,FINDINGS-DETAIL, NEEDS-VALIDATION}.md + findings.json (schema-validated) + coverage-ledger.json. HIGH (both XSS): - chat renderer: extract pure renderer to src/lib/chat-render.ts and escape EVERY text segment before markdown transformation (was: code fences only); href attribute breakout closed; biome-ignore safety claims made true; regression tests (img/script/href-breakout/table-cell payloads) - seo-meta: jsonLdSafeStringify escapes < > U+2028/2029 so stored course titles/FAQ questions cannot break out of the JSON-LD <script> element (the nonce stamper previously re-armed the injected script); tests MEDIUM: - CSRF: same-origin gate in security middleware for POST/PUT/PATCH (Origin/ Referer must match the CORS allowlist when…e5934c3
-
feat(home): Most Popular Articles section + real ETAP cover + WhatsApp welcome bubble + keyboard-aware FABs + circular og-image
Z User- Home: new 'Most Popular Articles' section mirroring the courses block — teaser cards (cover, category, read time, views, author, date) with View All link to /articles; hidden when nothing is published - Article cover: real (non-AI) ETAP 2026 official screenshot, recomposed to 2:1 with blurred fill (public/article-etap-cover.jpg); production article row updated via admin API - WhatsApp FAB: proactive custom welcome bubble (team name, online pulse, bilingual greeting) — enters 1.4s after the FAB, auto-dismisses at 14s, session-persistent manual close, retires once the tooltip opens - FABs: soft-keyboard awareness — visualViewport shrink (<=75% of rest height) hides all floating buttons while typing on mobile - og-image.png regenerated with the circular AE brand identity + Cairo typography (scripts/make_og_image.py); both images travel as proper Git LFS objects (HF Spaces rejects plain binary blobs)f77f442 -
feat(ux): YouTube-style FAB scroll-hide + 3s WhatsApp entrance + circular brand icons & boot splash
Z User- useFabScrollVisibility hook: FABs dip below the edge while scrolling down, glide back on scroll-up or after a 220ms stop debounce (never hides an open WhatsApp tooltip or an active chat window) - WhatsApp FAB: gentle 3s entrance animation (soft overshoot); fixes old bug where the 2s delay timer re-showed the button on auth pages - Brand unification to the browser tab: favicon.ico/16/32, apple-touch-icon, pwa-192/512 regenerated from logo-circle.png (dark-bg composites for iOS/ maskable, transparent circles for favicons); broken placeholder favicon.svg + mask-icon links removed - Boot splash: static circular logo + loading bar paints before JS, removed automatically by React mount (10s failsafe for stalled JS) - scripts/make_brand_icons.py: regenerates the whole icon set (+print 2048px deliverable saved outside the repo) - E2E: new F8 (3s entrance + splash teardown), F9 (hide-on-scroll/reveal-on- stop), F10 (favicon set + splash live on prod) checks56536ca
-
feat(footer): official social platform icons — YouTube, Telegram, Facebook, Instagram, TikTok
Z User- Seed real platform URLs into siteSettings (upserted on every boot, so the production DB picks them up on deploy) + add telegramUrl key - useContactSettings: add telegramUrl field + real-link fallbacks - Footer: official Telegram brand mark SVG, Telegram hover brand color, icon order matches owner's lineup (YouTube, Telegram, Facebook, Instagram, TikTok, Email); LinkedIn/Twitter stay hidden until configured - Admin contact form: Telegram URL field - Playwright verified: 62 checks (order, hrefs, target=_blank, rel, aria-labels, 40px hit areas, no overlap, one-row fit on mobile, Telegram hover #229ED9) — desktop + mobileb5c1839
-
fix(chatbot): dead FAB click when logged out — kill the infinite 401 refetch loop
Z UserUSER REPORT: clicking the chatbot while logged out did nothing (used to redirect to /login). ROOT CAUSE (measured ~60 req/s in a sandbox E2E): the non-HttpOnly elbaz_auth_flag cookie (30-day maxAge) outlives the real session. On load, auth.me fires for its 3 subscribed observers and 401s. The global auth-failure handler (trpc.tsx) then called queryClient.removeQueries() SYNCHRONOUSLY inside the QueryCache onError — before React ever saw the error. removeQueries recreates the query for the still-subscribed observers (enabled hasn't flipped yet — useAuth's error effect never runs because the error state is wiped before commit), every recreation auto-refetches → 401 → removeQueries → … an infinite UNAUTHORIZED loop with authLoading stuck true, so every FAB click hit the 'still checking' branch and was swallowed. FIX: - trpc.tsx: park auth.me in a terminal error state via query.setState() (no removal → no recreation → no refetch) instead of removeQueries() - useAuth: on UNAUTHORIZED → …0546ff7 -
fix(payments): stale-session UNAUTHORIZED in payment modal — friendly recovery flow
Z UserROOT CAUSE: users stayed 'logged in' while their session was long dead. auth.me is an AUTHED procedure — on an expired/revoked JWT it throws UNAUTHORIZED, but React Query kept the last good user data (refetch-error semantics + 24h persisted ELBAZ_QUERY_CACHE), refetchOnWindowFocus/Reconnect were off, so the SPA never learned the session died. Clicking a payment method then surfaced the raw 'UNAUTHORIZED' banner (screenshot-confirmed) and the buyer was stuck. - useAuth: on auth.me UNAUTHORIZED → drop the stale identity immediately (removeStoredToken + removeQueries) so isAuthenticated flips to false - trpc.tsx: global safety net — QueryCache + MutationCache onError catch ANY UNAUTHORIZED from any procedure and clear the stale identity - CourseDetail: payment.create / createManual 401 → clear Arabic/English message ('انتهت مدة جلسة الدخول — جارٍ تحويلك لتسجيل الدخول...') + auto-redirect to /login?redirect=<course-url> after 1.5s - handleEnroll guest path also carries ?redirect= …5ef7454
-
improve(mobile): native-feel mobile fixes — FAB sizing, scroll-top collision, platform baseline
Z UserPer mobile-native skill review at 390x844: - Chatbot & WhatsApp FABs: 48px on mobile (was 56px, cramped on 390px screens), desktop unchanged at 56px (md: breakpoint) - ScrollToTop: was pinned at bottom 1.5rem on mobile -> overlapped the Home tab of the bottom nav (y 772-820 vs nav 779-844). Now stacks above the WhatsApp FAB column (left-aligned x=16, 44px), desktop corner position untouched - Chat window: 100vh -> 100dvh (URL-bar overflow on iOS) - Inputs: 16px min on pointer:coarse (iOS focus zoom fix) - hover gating: tailwind future.hoverOnlyWhenSupported -> no stuck hover after tap on touch - Controls: touch-action manipulation, user-select none (no 300ms double-tap wait, no long-press callout) - Chat messages scroll: overscroll-contain (stops scroll chaining) - viewport: interactive-widget=resizes-content (Android keyboard shrinks layout so chat input stays visible) - theme-color: matches header bg #0a0e17 (was brand cyan) + per-theme JS update kepta36e639
-
security: apply Cloudflare security-audit-skill findings (run-1)
Z UserConfirmed fixes: - 2FA now enforced at login (TOTP + 8-hex backup codes; UI step-up field) - promo enforcement on payment.create: course scoping + per-user cap + usage recording + usedCount bump (transactional) - logout + revokeAll bump tokenVersion (server-side invalidation); tokenVersion check now unconditional - active-enrollment gate (status+expiresAt) on lessonVideo/markWatched/heartbeat/quiz/checkEnrollment/certificate + refund webhook revokes enrollment - certificate grade floor (<70% => no certificate for quiz courses) - quiz submit: documented 3-per-10-min per-lesson quota implemented - CSV export: OWASP formula-prefix neutralization in escapeCsv - email link hosts: exact allowlist (FRONTEND_URL/CORS_ORIGINS/HF_SPACE_HOST) replaces substring trust - client IP: rightmost XFF entry (append-safe) instead of client-controlled leftmost - Google OAuth: email_verified required before linking; state cookie consumed on error exits; sessions use current DB tokenVersion - chatbot: per-me…87ead2c -
feat: official PowerFactory logo in marquee + fix language switching, guest course UX, image weights
Z User- PowerFactory: replace collapsed 0x0 SVG (no width/height attrs) with official DIgSILENT PowerFactory badge rebuilt horizontally from the vendor's own SVG paths (#0075BF); wider pill for legibility (Home.tsx wide flag) - i18n: replace per-component useState in useTranslation with a module-level store + useSyncExternalStore — fixes live language switch only re-rendering the Navbar, and the mount-order race that reverted lazy chunks to English - CourseDetail: guests now see the course thumbnail with enroll CTA instead of an empty hero void; free-preview click shows a Sign In CTA instead of misleading 'No video available' - Images: add missing PWA icons (pwa-192x192/pwa-512x512 referenced by manifest but 404ing); compress matlab.png 570KB->112KB, skm 64->46KB, recompress course-etap/hero-main/logo JPGs (q82)47abfeb
-
fix: resolve all lint warnings, update hero banner image
- Replace hero-main.svg with hero-main.jpg for home banner - Remove invalid inlineCSS option from vite.config.ts - Fix node:path import in vitest.config.ts - Fix unused vars in CourseDetail.tsx and Courses.tsx - Replace any types with proper types in cache/init.ts - Add eslint-disable comments for legitimate any/set-state-in-effect patterns - Suppress react-refresh warnings in UI component files - Fix exhaustive-deps warnings in hooks All checks pass: build, tests, eslint, tsc, biome2eb93af
-
feat: chatbot typing cursor + auto-scroll + smooth animations, light mode icon color fixes
ahmdelbaz28-ux- Professional typing cursor (thin vertical bar with glow) - Auto-scroll during streaming and after message completion - Smooth fade-in animation for streaming text chunks - Smooth enter/exit animations for typing indicator (bouncing dots) - Fixed stacking timeout bug in typing exit animation - Added 8 new light mode icon color overrides (violet, emerald, rose, etc.) - Added placeholder colors, badge backgrounds, admin tab states10963b9
-
feat(strict-checking): install Pyright + Biome, add ultra-strict tsc, fix all issues
ahmdelbaz28-ux## Pyright (Python type checker) - Installed pyright 1.1.411 as devDependency - Ran on elbaz-platform: 0 errors (project is 100% TypeScript, no Python files) ## TypeScript ultra-strict mode (tsconfig.ultracheck.json) Created new tsconfig extending tsconfig.app.json with additional strict flags: - noImplicitReturns, noImplicitOverride - allowUnusedLabels: false, allowUnreachableCode: false - forceConsistentCasingInFileNames: true - strictBindCallApply, strictFunctionTypes, strictNullChecks (all explicit) Fixed 9 errors found by ultra-strict check: - TS7030 (6x): Not all code paths return a value — added explicit 'return;' in security.ts, shield.ts, ChatBot.tsx, CookieConsent.tsx, AnimatedCounter.tsx, useWatchTracker.ts - TS4114 (3x): Missing 'override' modifier in ErrorBoundary class — added 'override' to state, componentDidCatch, render methods ## Biome 2.5.2 (strict linter) - Installed @biomejs/biome 2.5.2 as devDependency - Created biome.json with recommended preset + sensib…92398e6 -
fix(sonarcloud): resolve all 22 open issues + 4 TS build errors + 3 ESLint errors
ahmdelbaz28-uxTypeScript build errors (4) — framer-motion type compatibility: - AnimatedIcon: move originX/originY from props into style object - ElectricalIcon: switch to HTMLMotionProps<'div'> to avoid onDrag conflict - MagneticCursor: move transition out of style prop (framer-motion v12 type) - motion.tsx: replace React.HTMLAttributes & MotionProps with HTMLMotionProps SonarCloud issues (22): - S2245 (security) api/references-router.ts: replace Math.random() with crypto.randomBytes - S1192 db/init-schema.sql: NOSONAR — 'general' default value across 3 audit tables - S3776 + S3358 GlobalSearch.tsx: extract CourseResults/ReferenceResults/FaqResults - S3776 + S3358 Faq.tsx: extract FaqResultList + CategoryPill subcomponents - S3776 + 2*S3358 + S6479 LearningJourney.tsx: extract TimelineList, renderTimelineIcon switch, StatCard; replace array-index key with composite stable key - S3776 + S3358 Wishlist.tsx: extract WishlistContent subcomponent - 2*S3776 + S7762 + 5*S3358 + S6848 + S1082 References…d11b905 -
fix(sonarcloud): batch 17 — final 65 code smells cleanup
Z User- S6582 (12): converted x && x.y → x?.y where TS narrowing preserved - S7735 (12): swapped negated ternary branches; NOSONAR for if(!cond) patterns - S6819 (12): NOSONAR on role=X lines for shadcn/ui library components - S7763 (6): split into export...from for pure re-exports - S6754 (3): NOSONAR — already properly destructured (stale issues) - S7748 (3): 0.50 → 0.5, 0.70 → 0.7, 0.90 → 0.9 in k6-load-test.js - S7764 (3): window.X → globalThis.X - S6845 (2): NOSONAR on tabIndex={0} for keyboard-accessible widgets - S6847 (2): NOSONAR on div with event handlers (interactive widgets) - S6606 (2): if (x === null) x = y → x ??= y - S7744 (2): NOSONAR for || {} runtime spreads (not type unions) - S7773 (2): isNaN → Number.isNaN - S7781 (1): replaceAll(/%%CACHE_BUST%%/g, x) → replaceAll('%%CACHE_BUST%%', x) - S7753 (1): arr.findIndex(c => c === v) → arr.indexOf(v) - S7754 (1): arr.find(p) as boolean → arr.some(p) - S6749 (1): removed redundant <>...</> fragment wrapping single child Build: P…729deed -
fix(sonarcloud): batch 13 — clear 374 OPEN code smells
Z UserWave 1 (mechanical): - S6819: typeof x == 'y' → typeof x === 'y' (loose equality fix) - S6582: arr.indexOf(x) !== -1 → arr.includes(x) - S7773: isNaN → Number.isNaN, isFinite → Number.isFinite - S7769: Math.sqrt(a*a + b*b) → Math.hypot(a, b) - S7762: parent.removeChild(child) → child.remove() - S7764: window.X → globalThis.X (safe props only) - S7758: charCodeAt → codePointAt, fromCharCode → fromCodePoint - S6606: x = x ?? y → x ??= y - S7748: 1.0 → 1, 0.0 → 0 - S7723: new Array() / Array() → [] - S3863: merge duplicate imports from same module - S6353: [^a-zA-Z0-9_] → \W, [0-9] → \d - S7718: rename unused catch param to error_ Wave 2 (S3358 — 73 nested ternaries): - Refactored all nested ternaries into flat form using helper variables, if/else chains, or extracted consts. 22 files touched. Wave 3 (React rules): - S6759 (32): added readonly to all Props type properties - S6481 (5): wrapped Context provider values in useMemo - S6479 (5): replaced array index keys with stable identif…d3a69df
-
fix(sonarcloud): batch 9 — S7764 globalThis pass 2, S7773 Number.isNaN/isFinite
ahmdelbaz28-uxS7764 (remaining 24 sites): - Catch patterns the first pass missed: * `typeof window` → `typeof globalThis` * `(window as any)` / `(window as Type)` → `(globalThis as ...)` * `window[...]` → `globalThis[...]` * `self.` → `globalThis.` - Applied across 13 files (main.tsx, useTheme, useWatchTracker, random, auth-storage, Login, Register, trpc, Logo3D, StarfieldBackground, NotificationCenter, AmbientOrbs, performance.spec). S7773 (5 swaps): - `isNaN(x)` → `Number.isNaN(x)` (3 sites: CourseDetail, AdminNotificationPanel, paymob x2) - `isFinite(x)` → `Number.isFinite(x)` (1 site: jwt.ts) Tests: 83/83 pass.1858532 -
fix(sonarcloud): batch 2 — S6582 optional chain, S1854 dead stores, S3735 void, shell scripts
ahmdelbaz28-uxS6582 (optional chain, 22 swaps across 15 files): - Replace `X && X.Y` with `X?.Y` in 22 sites. - Revert 4 sites where the optional chain would have broken TypeScript narrowing in subsequent accesses (api/context.ts cached.expiry, QuizComponent questions.length, Dashboard myEnrollments/myCertificates/ payments.length) — kept as `X && X.Y` with sonar:off comment + TS18048 justification. S1854 (dead stores, 12 removals): - api/lib/chatbot.ts: remove unused retryAfter. - api/chatbot-router.ts: remove unused decoder. - api/google-auth-router.ts: remove unused clientSecret + 6x userName/ userEmail/userAvatar (only userId/username/userRole are consumed by createToken()). - src/pages/Login.tsx, Register.tsx: declare `let errorMsg: string` without initialiser (the if/else-if/else always assigns). - infra/resend-integration/email.ts: remove unused verificationExpiry. - infra/test-automation/tests/setup/global-setup.ts: drop unused response body. - scripts/seed.ts: remove unused…2d21a3e -
fix(sonarcloud): comprehensive security & quality fixes — 200+ issues resolved
ahmdelbaz28-uxBLOCKERS (2): - secrets:S8215 — api/local-auth-router.ts: replace hardcoded bcrypt dummy hash with a lazily-generated hash from crypto.randomBytes (no real hash disclosed in source). - json:S6418 — infra/.../access-policies.json: replace hardcoded Cloudflare service token with ${CLOUDFLARE_ZERO_TRUST_SERVICE_TOKEN_ID} placeholder. CRITICAL BUGS (16): - css:S4670 (x5) — src/index.css: remove stray backslash escapes from attribute selectors ([data-user-menu], [data-sonner-toast], [aria-current]). - typescript:S3923 (x5) — remove ternaries that returned the same value on both branches (ElectricParticles, AdminNotificationPanel x2, NotificationCenter, ForgotPassword). - typescript:S1082 (x6) — add keyboard handlers + role/tabIndex to non- interactive divs with onClick (CookieConsent, input-group, CertificateView, CourseDetail video controls + seek bar + payment modal). VULNERABILITIES (121): - docker:S6470 — Dockerfile: document that COPY . . is safe because of .dockeri…c7df2b5
-
fix(security+db+perf): pre-launch hardening — 7 critical + 4 DB + perf wins
ahmdelbaz28-uxCRITICAL SECURITY (7 fixes): - email.ts: remove recoveryLink from JSON response (account-takeover via password reset when email delivery fails) - twofa-router.ts: remove dead verifyForLogin procedure (IDOR + no rate limit) - twofa-router.ts: replace hardcoded 'elbaz-2fa-backup' HMAC key with APP_SECRET-derived key (forged backup codes possible with repo access) - review-router.ts: adminList authQuery→adminQuery, adminTogglePublish authMutation→adminMutation (any logged-in user could hide/show any review) - rate-limiter.ts: per-action auth rate limits (login=10/15min, forgotPassword=5/15min, register=10/15min, etc.) — was 1200/min shared - middleware.ts: apply globalRateLimit to authMutation + adminMutation (previously bypassed rate limiting entirely) - infra/resend-integration/env-variables.txt: replace leaked Resend + OpenRouter API keys with placeholders (keys are now rotated) CRITICAL DATABASE (4 fixes): - init-schema.sql: add 3 missing tables (userSessions, userNotes, …f46a61a
-
fix: Dark Mode default + mobile animation optimization + light mode fix
ahmdelbaz28-uxCRITICAL FIX: Login page elements were invisible! =============================================== ROOT CAUSE ========== The theme detection script used prefers-color-scheme to determine the initial theme. On browsers that default to light mode (most desktop browsers, headless Chrome, some mobile browsers), this set data-theme='light'. In Light Mode, the body background becomes #f8fafc (very light). But the Login page text uses text-[#f0f4f8] (very light) which is INVISIBLE on a light background! Result: Username field, Google button, Login button, and links were all present in the DOM but visually invisible — only the password field (with its white background) was visible. FIXES ===== 1. Dark Mode is now ALWAYS the default (index.html + useTheme.ts) - Removed prefers-color-scheme detection - Only switch to Light Mode if user EXPLICITLY chooses it - This matches the site's dark-first design - Prevents the 'invisible text on light background' bug 2. Mobile Animation Opt…69834cc -
fix: resolve critical audit findings — memory leaks, OOM, performance
ahmdelbaz28-uxCRITICAL FIXES (12 issues from audit report) ============================================ 1. 🔴 Memory Leak: useWatchTracker.ts (loadedmetadata listener) - The 'loadedmetadata' event listener was only removed INSIDE the callback. - If the component unmounted before the event fired, the listener leaked. - FIX: Added proper cleanup return in useEffect. 2. 🔴 Memory Leak: main.tsx (Service Worker update interval) - setInterval ran every 1 minute forever, even when tab was hidden. - FIX: Changed to 5-minute interval + start/stop based on visibility. - Interval is cleared when tab is hidden and on beforeunload. 3. 🔴 OOM Risk: export-router.ts (unbounded exports) - Admin export queries loaded ALL rows into memory with no LIMIT. - 100K+ users would crash the server (OOM). - FIX: Added MAX_EXPORT_ROWS=10,000 + pagination (limit/offset). - Each export now accepts {format, limit, offset} with sensible defaults. 4. 🔴 Memory Leak: rate-limiter.ts (rateLimitByKey…13b0fed -
refactor: extract Google OAuth to shared utility and clean up comments
8a33002 -
fix: resolve hydration mismatch by deferring localStorage reads in useTranslation hook
bec6e4d -
fix: resolve hydration errors by deferring auth check and suppressing hydration warnings
9fb477d
-
feat(images): replace hero banner + generate professional course thumbnails
ahmdelbaz28-uxHERO BANNER: - Replaced hero-main.webp with professional ETAP software screenshot COURSE THUMBNAILS (all AI-generated, 1344x768, professional quality): - course-cable.jpg: high-voltage power transmission lines at golden hour - course-etap.jpg: ETAP software interface with one-line diagram - course-skm.jpg: short circuit analysis with relay coordination curves - course-powerfactory.jpg: power flow analysis with voltage profile graphs - course-pvsyst.jpg: large-scale photovoltaic solar farm, 3D isometric - course-panel.jpg: electrical control panel with breakers and wiring All images are LFS-tracked with properly cached objects.2aed803
-
feat(theme): dark/light mode toggle + theme-aware logo & starfield
ahmdelbaz28-uxNEW: Dark/Light mode system with one-click toggle in the navbar. THEME SYSTEM: - New hook: src/hooks/useTheme.ts • localStorage persistence (key: 'elbaz-theme') • Respects prefers-color-scheme on first visit • Listens to system preference changes (if user hasn't explicitly chosen) • Sets data-theme attribute on <html> • Updates theme-color meta tag for mobile browser chrome • Adds .theme-transitioning class for 300ms during switch for smooth color transition (removed after animation completes) - FOUC prevention: inline script in index.html runs BEFORE React, reads localStorage/prefers-color-scheme, sets data-theme instantly. Prevents flash of wrong theme on page load. - Light mode CSS overrides (src/index.css, ~130 lines): • Comprehensive overrides targeting all hardcoded dark Tailwind arbitrary classes (bg-[#0a0e17], bg-[#111827], text-[#f0f4f8], border-[#1f2d44], etc.) • Light palette: slate-50 bg, white cards, slate-200 borders, slate-900 text,…e047932
-
fix: comprehensive launch fixes — lru-cache dep, mock DB disabled in prod, promo router auth, CSP report-to header, Docker HTTP healthcheck, course thumbnail paths, shield rate limit, favicon.ico, DB SSL warning, reviews table in Drizzle schema, softwareDownloads relations, useWatchTracker cap alignment
ahmdelbaz28-uxcca2eaf
-
feat: Elite Engineering UI Modernization, Production Auth Fixes, and HF Deployment Stability
ahmdelbaz28-ux50a005c