Spaces:
Running
Running
Commit History
Today
-
quality(sonar): complexity under limit + React19 SyntheticEvent migration
Z User- paymob webhook: guard chain + status transition extracted (S3776 22->low) - boot: security posture check extracted from start() (S3776 16->low) - FormEvent -> SyntheticEvent across 7 files (React 19 types: the alias is deprecated because it never matched a real DOM event class) Tests 1472/1472, tsc app+server clean, build OK.f57f434 -
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 -
fix(courses): remove subscribe gate — instant playback, auto-scroll, dead-lesson self-heal
ahmdelbaz28-uxOWNER CONTRACT (2026-12-03): the subscribe-to-the-channel gate is GONE. Why: users clicking a course video hit the subscribe wall; the subscribe button did not open YouTube; most playlist videos answered 'video not available'. Root causes addressed end-to-end: SERVER - course-watching.ts: lessonVideo no longer requires a signed unlock ticket; completeSubscribeUnlock procedure deleted; SUBSCRIBE_REQUIRED cannot occur anymore. Login-first (2026-11-22) unchanged. - settings-router.ts: 'subscribeGate' dropped from the public section allowlist (deny-by-default; legacy rows stay server-side). - playlist-sync.ts: deadYouTube self-heal lane — YouTube-linked lessons whose video LEFT the playlist (broken 'الفيديو غير متاح' embeds and legacy placeholder rows) are purged automatically on trusted full-mirror syncs (gh-relay ingest / admin-manual). Throttled watcher ticks never delete. R2/manual lessons are never touched. CLIENT - CourseDetail.tsx: gate screen, settings query, unloc…889e7bd -
fix(mobile+load): full platform review — phone cropping, boot race, hung-provider stalls
Z UserMOBILE (owner report 2026-12-02: admin Users tab clipped on phone): - Users tab approvals rows: min-w-0 + flex-1 on the text block and break-all on the email line — a long unbreakable email token pushed the row past the card edge and the card's overflow-hidden CLIPPED it (reproduced at 320px, row painted 122px off-screen; now wraps inside the row) - Global safety net: html/body overflow-x clip (clip, not hidden — sticky keeps working) so one unbreakable token can never widen the page again - Grid auto-track blowout: 34 grids across 9 files declared cols only at sm/lg (grid gap-4 lg:grid-cols-N) — the implicit auto track sized to max-content, so nowrap content inflated tracks to 715px on a 320px screen (dashboard Recent Activity). Base grid-cols-1 added everywhere - Dialog/AlertDialog primitives: grid-cols-1 on the content grid — the bare shadcn `grid` sized its implicit track to max-content, so dialogs hosting truncate/nowrap rows (lessons manager) scrolled their whol…8054c5d -
feat(mobile): SidebarX-style drawer — floating 20px card, gradient-glow active cell, bottom collapse chevron
ahmdelbaz28-uxPort of Frezyx/sidebarx visual language to the site's mobile drawer: - Floating panel: 10px inset on all anchored edges + safe-area env() calc, borderRadius 20 (theme.decoration), deep shadow — like the SidebarX card - Items: 10px-radius bordered cells; selected = accent gradient fill + 40% border + glow boxShadow (selectedItemDecoration port), replaces old dot - SidebarX signature bottom collapse chevron (aria-labelled, testid mobile-menu-toggle), arrow points to the anchored edge = collapse direction - Icons 20px (SidebarX iconTheme size), light-theme glow override added Zero logic changes: focus trap, Escape, body scroll lock, drag-to-close, drag guard, route-change close, NotificationCenter bell all untouched. Verified: tsc clean, vite build ok, 1465/1465 tests green.5484b55
2 days ago
-
feat(admin): signature triple-bell chime + unmissable bold checkbox marks
Z UserOwner directives 2026-12-01: 1. "عاوز صوت الاشعارات يكون صوت مميز غير الموجود وصوت واضح لكن احترافي" — the two-tone beep is now a signature A-major bell arpeggio (A5→C♯6→E6): each voice layers a soft 2nd/3rd harmonic (glass-bell spectrum), a quiet A4 gives body, a faint A6 sparkle closes the phrase. 8-12ms attacks, exponential decays, peaks ≤0.18, ~1.2s total — clear at phone volume, never harsh. Same API; verified through the REAL poller-bridge path (15 partials recorded: 440/880/1108.73/1318.51/1760 + harmonics). 2. "المربع بينور اصفر بس مش بداخله علامة صح" — the checkmark was a stroke-width-2 hairline at 14px: easy to lose in a bright amber fill on high-DPI phones. The base Checkbox now strokes at 3 (bold, unmissable) and the tri-state is honest: partial select-all shows a MINUS, not a lying full check. Verified on real-touch (pointer:coarse) emulation: 16px compact box, bold dark check on amber, minus on indeterminate. 3. ui-test-server: approvals-q…9f54f8d -
feat(admin): professional glowing approval-gate toggle + fixed multi-select
Z UserOwner report 2026-12-01 (with phone screenshots): 1. ROOT FIX — the mobile 44px touch-target rule inflated role=checkbox and role=switch buttons into ~44px squares: giant ugly checkboxes, distorted rows, an unrecognizable gate 'switch blob'. Form controls now keep their TRUE visual size and get a transparent ::before hit-pad (44px reach) instead — Apple-HIG pattern, applied globally. 2. Multi-select was unreliable because the first selection inserted the inline toolbar (~50px) and shifted the list under the finger mid-tap. The bulk toolbar is now a viewport-fixed floating bar portaled to <body> (Gmail-style): zero layout shift, thumb-reachable approve/reject/clear with safe-area inset. 3. Approval-gate control redesigned: pulsing live status dot, amber glow on the card + switch while enforcing, plain gray when off — state is readable at one glance. Switch thumb now slides correctly in RTL. 4. Checkboxes restyled proportionate to the text (16px, rounded, am…0d73662 -
fix(sonar): final three — real button toast card, lookup-map action verbs, awaited stream consumer
Z User- S6819/S6847/S6845: the actionable toast is now a REAL <button> card (native keyboard activation — no ARIA role, no double-fire Enter handler); announcements keep role=alert; dismiss is an absolutely-positioned sibling so no interactive element nests inside another - S3776: actionLabelFor complexity — verbs moved to a lookup map - S7785: the log-stream consumer is captured and top-level-awaited (raced with a bounded drain) instead of a discarded void call9a1fb7a -
fix(sonar): clean the 9 findings the deep-link commit surfaced on new code
Z User- S3776 (critical): NotificationPollerBridge event assembly split into flat helpers (announceApprovalRequest / actionLabelFor / toastDurationFor) - S3358: duration nested ternary extracted - S4624: push-sw link builder via concatenation (no nested templates) - S6594: RegExp.exec instead of String.match (notification-link + push-sw) - S7785: named async fn + void detach (no async IIFE) - S6847/S6845: actionable toast card gets role=button (interactive element may carry mouse/keyboard listeners + tabIndex); announcements keep alert - S6582: optional chain in the NOTIFICATION_CLICKED handlere70a195 -
feat(notifications): one-tap deep links — every actionable notification opens its action screen
Z UserOwner directive 2026-12-01: clicking a notification must OPEN the place its action happens on (e.g. a join request lands straight on the accept/reject queue), not just flip a read flag. Root fixes: - server: approval fan-out url /admin?tab=users (renders the DASHBOARD tab under path-based routing) -> /admin/users?approvals=1; email dashboardUrl fixed the same way; approval-accepted notice /login -> /dashboard - client: src/lib/notification-link.ts — one resolver for every event (scheme safety + legacy ?tab= normalization + structured-payload fallbacks so a join request can NEVER render link-less), fully unit-tested - toast: the CARD body is clickable now (onOpen + keyboard support), join requests get a 'مراجعة الطلب' action button and 12s dwell - bell rows normalize legacy persisted urls before opening; 'افتح' affordance - push-sw: notificationclick posts the SPA path form (absolute URLs were silently dropped by the page handler) + legacy url normalization - /admin/users?a…6da4d8e -
feat(admin): one-shot bulk approve/reject + professional acceptance notification for approved users
Z UserBULK DECISIONS (owner directive 2026-12-01): the approval queue gains checkbox-per-row + select-all (up to the whole 200-row queue) and two confirm-guarded one-shot buttons. Both procedures route EVERY row through the SAME decideApproval state machine (no duplicated security logic): approve only lifts pending rows, reject skips protected admins, one bad row degrades to a skip entry instead of aborting the batch, duplicates collapse, and the batch is capped at 200 (aligned with the queue page). ACCEPTANCE NOTICE (owner directive 2026-12-01): when a user is approved they now receive a professional notification through BOTH channels that can actually reach them: 1. a dedicated bilingual acceptance email (verdict banner + one sign-in CTA, built from buildAccountApprovedEmail) riding the email_delivery_log ledger as 'approval-accepted' with one transient retry, and 2. an in-app stream event greeting them the moment they sign in. The notice rides decideApproval itself — d…264507b -
feat(admin): in-dashboard back navigation + approval-gate owner switch + AI panel icon fixes
ahmdelbaz28-uxOwner report 2026-12-01, three asks, all root-cured: 1) BACK NAVIGATION (phone back exited the whole site): Root cause: admin tabs were pure React state — the URL never changed, so tab switches pushed NO history entries and the browser back button left /admin entirely (or closed the tab when it was the landing page). Fix: tabs are now URL-synced (/admin + /admin/:tabId route). Every tab switch is a real history entry; phone back walks back through visited tabs and out to the previous page; tabs are deep-linkable (/admin/users...). New one-tap back arrow in the mobile top bar uses history when the SPA has entries and lands on the dashboard otherwise. 2) APPROVAL-GATE OWNER SWITCH (new capability, default ON): The owner can now enable/disable the whole gate from the Users tab. ON (default — the 2026-11-24 contract): registrations land pending and wait for approval. OFF: registrations approve themselves (decidedAt stamped), already-pending accounts en…0d070f3
4 days ago
-
fix(sonar): wave 8 - final sweep, all 21 remaining live findings
Z User- S8689/S5144: documented sanitizer/authority invariants (redact() contract, fixed-hostname + origin-form) - taint-model blind spots, NOSONAR justified - S3776 x3: extract collectNormalizedMessages, verifyRightsAndSweep, ReviewsHeader (16 -> <=15 each) - S8786/S5843: extract_refs_kb trailing-number + kW token validators (differential-fuzz equivalent: 0 mismatches / 200k cases), redact() regex linearized in both probe scripts, HEAD_RE_PARTS regrouped (0/60k) - css:S7924 x2: cyan-500 -> cyan-400 at the flagged rules (4.5:1 cleared) - S7503/S3626 write-strategies, S6582 worker, S4323 cables aliases, S7786 TypeError, S2486 comment style Verified: tsc clean, eslint clean, vitest 1394/1394, py_compile clean.5632e3b -
fix(sonar): wave 7 - cleanup round from live scan (93 findings across 65 files)
Z User- 34 in-scope follow-ups exposed by the 17:59 scan (refactor residuals: S3776 helper splits, S4323 type aliases, S6759 readonly on extracted components, S8786 bounded-regex justifications, S6551 scrub patterns, S9440/S7924 CSS at new positions) - python leftovers: 29x S1481 positional _, S8786 regex canonicalization (fuzz-verified), S3776 task24 step-fn hoisting, S1192 dialog/content-type consts - operator tooling: S9382 documented NOSONARs for deliberate poll/throttle loops + Promise.all for independent probes, S8689 second log site routed through redact(), S5144 second fetch site behind UPSTREAM_HOST_ALLOWLIST Verified: tsc clean, vitest 1394/1394, node --check + py_compile on touched scripts.6780540 -
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 -
fix(sonar): wave 4 - resolve 114 findings (payment-router, sld render/repair, chatbot-prompts, cache, Register, ArticleDetail, chat-format, user-ai-provider, image-quota, email, chatbot-errors, push-state, Footer, notes-router, local-auth, think-filter, settings/maintenance/paymob routers, youtube-watcher, referral, env)
Z User- S3776 extractions (getSystemPrompt via SystemPromptArgs, chatbot-prompts 51->15, email OTP verify flow, local-auth register/login/updateProfile) - S9382: NOSONAR only for documented sequential necessities (Redis SCAN pagination, bulkUpsert pool cap, ordered SQL dump, oEmbed concurrency pool) - S8786: credential regex de-duplicated quantifiers, email validator split, UA WebView regex preserved via differential corpus test - S6551: describeCause/JSON diagnostics; S6759 readonly props; S5906 in tests - contract tests re-pinned to helper-based equivalents (2FA helper call site, finalizeEmailVerification pendingEmail flow, changeEmailWithVerification rate-limit-inside-branch) - all runtime invariants unchanged Verified: tsc clean, eslint 0 errors, vitest 1394/1394.da57150 -
fix(sonar): wave 3 - resolve 100 findings (medium files: health-router, seo-meta, chatbot-stream, CourseDetail, docgen spec/md/font, AiProvidersPanel, SubscribeGate, spa-handler, Articles, AdminNotificationPanel, Documents, NotificationCenter, playlist-sync, approval, chatbot-feedback, chatbot-byok, boot)
Z User- S3776 extractions across components and lib (NotificationCenter push flow 55->11, Articles 41->6, AdminNotificationPanel 22->1, playlist-sync 34->7) - S3358 nested ternaries -> module helpers/sub-components - S9382: Promise.all for independent writes; NOSONAR only for the notify-cap throttle in playlist-sync - S8786: trailing-slash regexes -> shared stripTrailingSlashes loop - S6551: JSON diagnostics; S4782/S6564/S6660/S7737/S7773/S7503/S7737 - approval contract test adapted to Promise.all admin fan-out (same pins) Verified: tsc clean, eslint 0 errors, vitest full suite green.caa8f36 -
fix(sonar): wave 2 - resolve 112 findings (CourseReviews, telegram-bot, saudi-kb, chatbot, shape, css, refs.test)
Z User- CourseReviews: S3776 40->14 via label helpers, S3358, S6759 readonly props - telegram-bot: S3776 extractions (splitForTelegram, handlePrivateMessage, pollLoop, supervisorBody), S9382 throttle NOSONARs, S7503 de-async, S4782, S6582; retry_after sleep removed from loop - chatbot-saudi-kb: S7780 String.raw x12 - chatbot.ts: S3776 cascade/sweep extractions, S107 bundle, S4123 sync validators, S6551 JSON.stringify diagnostics - docgen/shape.ts: bidiRuns decomposed (95->~2), S3358/S4323/S7755, docgen output pinned by existing tests - index.css + elite-animations.css: S9440 consolidated prefers-reduced-motion blocks, S9449 explicit transition properties, S4666 merged duplicate selectors, S9450, S7924 contrast fixes - chatbot-refs.test.ts: S5906 toHaveLength assertions Verified: tsc clean, eslint 0 errors, biome clean, vitest 1394/1394.c2dde89 -
fix(sonar): wave 1 - resolve 511 in-scope findings across 15 app files
Z UserRoot-cause refactors per SonarCloud rules (behavior-preserving): - S3776 cognitive complexity: extracted cohesive helpers in ai-router, chatbot-router, chatbot-refs, chatbot-cables, Admin, ChatBot, skillnet, saadat, pdf, db-init, chat-render, Profile - S3358 nested ternaries -> Record lookups / if-chains / bilingual helper - S7780 String.raw for regex-source literals; S7781 replaceAll - S6594 match->exec / matchAll; S6557 startsWith/endsWith; S7755 .at() - S8786 backtracking: split overlapping-quantifier regexes (citation, refusal, promise/delivery detectors), linear rewrites, documented bounded-pattern NOSONARs where grammar is provably linear - S9382: Promise.all for independent DB upserts; documented NOSONAR for order-dependent/throttled loops only - S3923 real bug: identical-branch ternary in chatbot-cables depthFactor - S6551: honest typed rows instead of String(object) in db-init/sld fence - Source-contract tests re-pinned to the refactored equivalents (admission-gate…9ce5991
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 -
security(audit-run-3): comprehensive security audit fixes (cloudflare security-audit-skill)
Security Audit Run 3Confirmed vulnerabilities fixed: - paymob-webhook: bind SIGNED obj.order.id to stored paymobOrderId (unsigned merchant_order_id was the only correlation key — replay-with-swap class); verify the callback's own signed currency (EGP pin now two-sided); preserve the original charge reference on refund/void events - promo quota release is now transaction-atomic with the refund/reject that compensates it (webhook tx + admin reject tx) - referral reward coupon is granted at ADMIN APPROVAL instead of registration (self-referral coupon farming closed); single decision path in decideApproval - wishlist add/list leak of unpublished (draft) course metadata — existence + isPublished validation on add/toggle, publish predicate on the list join - vision image-quota reservation leak on the per-user daily-cap 429 path (refund exactly once invariant restored); vision lanes re-keyed to the AUTHENTICATED account (u<id>) instead of spoofable client headers - forgotPassword: per-RECIPIENT s…ec34781 -
feat(ui): implement review suggestions #2-#5 — motion discipline, signature completion, proof system, certificate share asset
Z UserSuggestion #2 — one motion per screen (Brand Kit §6): hero is now visually silent except the primary CTA: static Zap badge, static ambient glow, static image frame, static floating cards, static scroll indicator; the ONLY continuous motion is the new .brand-cta-glow pulse (opacity-only pseudo-element, reduced-motion safe). Background icon layer cut 25→5 icons sharing ONE slow 40s transform drift. Suggestion #3 — signature completion: .brand-signature-line now under every Home section title (removed the clashing section-header-glow divider), .brand-signature-hover floors on the AI-section + CTA-banner primary buttons (new optional wrapperClassName on ArcFlashButton — backward compatible). Headline keyword gradient-text switched to the official orange→cyan signature. Suggestion #4 — unified proof system (truthful by construction): green check chip "شهادة موثقة" on course cards, "طالب موثق" badge on every published review (reviews are enrollment-gated server-side…d42fc97 -
feat(brand+seo): signature gradient system + Brand Kit law + noscript SEO fallback
Z UserUI review implementation (safe scope — outside the security agent's files): Suggestion #3 — electric signature (orange→cyan, 3px) now repeats at: - scroll-progress bar pinned page-top (new SignatureProgressBar, rAF, transform-only, reduced-motion safe, RTL origin) mounted in App - boot splash loading bar (was cyan→blue, now the official signature) - course-card top edge reveal on hover (.brand-signature-card in CourseCard) - opt-in utilities .brand-signature-line (section titles) and .brand-signature-hover (primary CTAs) ready for the Home round that follows the security agent's UI rework Suggestion #1 — Brand Kit law: docs/BRAND-KIT.md pins the 60/30/10 color rule, exact token values from index.css, radius/shadow scale, the icon-beside-label button standard, motion rules and the proof system. SEO (review gap #4, minimal fix): <noscript> block in index.html with an Arabic summary + 5 internal links so JS-less crawlers get real text. Verified: tsc clean, biome cl…d4d279d -
fix(ui): icon beside label on every button + WCAG AA button contrast
Z UserRoot cause (icon stacked ABOVE label): ArcFlashButton — the shared CTA used by the landing hero and AI-assistant section — had gap-2 but NO flex display; Tailwind preflight makes <svg> display:block, so the icon rendered as a block ABOVE the text node. Fix at the component root: inline-flex items-center justify-center — every usage inherits the correct icon-beside-name layout. All 39 raw button sites audited via scanner + manual review; shadcn Button, navLinkBase, admin-sidebar-item and btn-primary already carried flex and were healthy. Contrast (computed WCAG 2.1, brand hues preserved): - .btn-primary white-on-accent 2.80:1 -> 6.89:1 (dark text, bg unchanged; light theme 3.68 -> 5.24). Navbar avatar initials fallback same. - cyan-500->blue-600 + white 2.43:1 -> 5.36:1: gradient start deepened to cyan-700 (Faq support CTA, References buttons/badge, ChatBot send/FAB). - emerald buttons keep their bg, text flipped to near-black #04121c: 2.54/3.77:1 -> 7.47/5.03:1 (Quiz finish, Adm…dec24b8
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 -
feat(avatar): profile photo now surfaces in chat bubbles and course reviews
Z UserOwner request (2026-11-26): the photo uploaded from the profile page (31baaf4) should follow the user across every social surface — chat messages and course reviews — not just the profile/navbar. Server: - review-router.listByCourse now projects userAvatar (users.avatar) with each published review; the sibling lesson-comments router already returned it, so the review list was the odd one out. Client: - CourseReviews.tsx: reviewer avatar circle renders the real photo when set (lazy/async, cover-cropped), initials circle stays the fallback for reviewers without a photo — identical geometry, no layout shift. - ChatBot.tsx: MessageBubble gains a stable userAvatar prop (memo-safe — changes only when the user actually changes their photo); user bubbles wear the real photo in place of the generic User icon chip, icon chip remains the fallback. Assistant bubbles keep the site logo. Admin moderation tables intentionally keep compact initials (moderation rows…2e6a64d -
feat(profile): uploadable user avatar — photo replaces the initials box, name under it
Z UserOwner request (2026-11-26): the user dashboard's avatar box showed only the first letter of the name. It now renders the user's actual profile photo (with the name displayed UNDER the photo per the layout requirement) and the user can upload/replace/remove it themselves. Why storage lives in the DB: the HF Space disk is EPHEMERAL (rebuilt on every deploy) — an uploaded file would vanish at the next push. users.avatar (MEDIUMTEXT) persists in the external MySQL and already existed for Google OAuth picture URLs; self-uploads ride the same column as small data URLs. Server: - migration v20 (db-init.ts): users.avatar TEXT→MEDIUMTEXT, idempotent INFORMATION_SCHEMA probe (re-ALTERs only while still plain TEXT) - SafeUser + AuthMeOutput widened with avatar; explicit projection updated — auth.me + session.me now deliver it to the UI (30s SafeUser cache evicted on change via evictUserAuthCache) - auth.updateAvatar mutation (local-auth-router.ts): authed-only, writes ONLY…31baaf4 -
fix(chatbot): Android back button closes the fullscreen chat instead of leaving the site
Z UserOwner report (2026-11-26): on mobile the chat opens fullscreen (desired), so users press the hardware back button to leave the chat — and the SPA interpreted it as site exit, dropping them out of the platform entirely. Root cause: nothing intercepted the back gesture for the overlay. Android back fired a history pop that react-router honored as real navigation (previous route / site exit) while the fullscreen chat stayed stacked above it visually. Cure — pin-one-entry gate (ChatBot.tsx): - while the fullscreen chat is open on mobile, ONE extra history entry is pinned (same URL, flagged state, router idx preserved) — a same-URL popstate the router reads as a no-op - first back press pops that entry: popstate handler closes the chat only; the site never navigates - the X button and the minimize button consume the pinned entry via history.back() (suppressed pop) so the stack never grows stale entries — the NEXT back press after closing leaves the site normally …ef2f7a3 -
fix(notifications): compact mobile toast cards — YouTube bursts no longer wall off the screen
Z UserOwner report (2026-11-26): the YouTube new-episode toast shown on platform entry rendered a very tall card on phones; a multi-event burst stacked up to four of them and covered the entire screen. Root cause (measured): two independent inflators — 1. the broadcast copy carried a ~200-char marketing tail, so one card rendered ~7 text lines ≈ 220px tall 2. the card was a fixed 320px-wide, unclamped box and the stack allowed 4 toasts on every viewport; on a phone that is 800px+ of glass Fix — client (NotificationToast.tsx): - card is fluid-width on mobile (full width minus 32px margins), p-3, 28px icon, message line-clamp-2, title line-clamp-1; ≥sm unchanged (320px, p-4, message line-clamp-3) - responsive stack cap via matchMedia (jsdom-safe fallback): max 2 toasts on mobile, 4 on desktop; displaced events stay in the bell history — a toast is not an inbox - container gains left+right margins on mobile (no overflow on narrow screens) and pointer-ev…2c2b16c -
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
9 days ago
-
fix(chatbot-docgen): EXPLICIT-REQUEST-ONLY hard gate — no unsolicited file generation, no suggestions (v3.9.1)
ahmdelbaz28-uxOwner directive (2026-11-24, absolute): the permanent file-generation capability stays, but it must NEVER fire without an explicit user request, and the bot must NEVER suggest or offer file generation. - docgenSkillAr/En: removed the auto-trigger clause («يستحق ملفاً» / 'long/tabular enough to deserve one') — long or tabular answers now stay plain prose with no docgen board; added THE FUNDAMENTAL CONDITION block (explicit request = the only key, no self-initiated generation, no suggestion/offer/hint ever, format-name-only mention → prose answer, format follows the user's request verbatim with pdf as the only default when a file IS explicitly requested but no format is named). - Removed the post-delivery offer-to-convert clause («اعرض تحويلها» / 'offer the other on request') — one file per reply, never offer another format; the user asks for it themselves. - docgenQuickAr/En (instant lane): same hard gate in condensed form. - ChatBot.tsx welcome messages (EN+AR): remove…cc06b18 -
feat(chatbot-docgen): permanent in-chat document generation — PDF/DOCX/MD (v3.9.0)
ahmdelbaz28-uxOwner directive (2026-11-24): the bot must ALWAYS be able to build real files for the user inside the chat — no external skill loading, ever. - docgen skill 'docgen-file-export' in SKILL_REGISTRY (category export, thinking+instant): routed on file/export intent, emits a ```docgen DocSpec fence with the immediate-execution contract (file in the FIRST reply, verified numbers only, mandatory citations). - api/lib/docgen/: dependency-free deterministic renderers — PDF written from scratch (Type0/Identity-H CID fonts, two embedded GNU FreeFont subsets, full Arabic presentation-form shaping + simplified UAX#9 bidi with N0 bracket-pair + N1/N2 neutral resolution, RTL tables, page footers), DOCX as stored-ZIP OOXML (bidiVisual RTL tables, w:bidi paragraphs, Word-native shaping), and GFM Markdown. - POST /api/docs/gen: public, stateless, size-capped (60k content chars), typed 422 diagnostics — the /api/diagrams/sld contract. - Chat UI: renderDocgenFence download card (format …aea6c23 -
feat(approval): admin gate on registration — owner approves/rejects every join before login
ahmdelbaz28-uxOwner directive (2026-11-24): 'أنا كأدمن لازم أقبل أو أرفض أي حد يسجل في المنصة قبل ما يدخل — وعندي سلطة إلغاء دخول أي حد في أي وقت.' SERVER (enforced at EVERY session-issuance path): - users.approvalStatus (pending|approved|rejected) + decision columns, v17 idempotent migration — DEFAULT 'approved' grandfathers all pre-gate accounts with zero backfill; registration writes 'pending'. - register: creates the account pending, issues NO token/cookie, responds pendingApproval:true — the login gate enforces the rest. - login: gate AFTER credential+2FA verify, BEFORE session issuance — correct credentials are not enough. Stable APPROVAL_PENDING / APPROVAL_REJECTED sentinels drive the localized panels; pending retries never burn the per-account failure throttle. - Google OAuth callback + GIS: all paths gated; new Google sign-ups insert pending and receive NO session (redirect marker / 403 codes). - decideApproval: reject flips status AND bumps tokenVersion in ONE UPDATE (live…a7cb154
11 days ago
-
fix(byok): owner-review UX fixes — delete confirm guard + toggle state-mirror sync
ahmdelbaz28-uxUser-journey review findings (2026-11-23): 1. DELETE had no confirmation — one misclick permanently erased the encrypted key (irreversible: the plaintext never leaves the server, so there is no way to re-derive it). Now asks for explicit confirm with a bilingual message explaining the consequence, same convention as every other destructive action in the app. 2. TOGGLE left the checkbox stale — the checkbox renders config.enabled while handleToggle only flipped the separate state mirror, so after a toggle the checkbox still showed the OLD value; a user re-clicking it silently re-enabled (or re-disabled) the model. Both mirrors now flip optimistically, roll back together on failure, and the server's authoritative config row is adopted on success. Feedback toast states which cascade is now in charge (user model first / platform models).1035617 -
feat(gate): login required for ALL content — no video, article body, or file download for logged-out visitors
ahmdelbaz28-uxOwner contract 2026-11-22: visitors may browse catalog surfaces, but ANY actual content opens only after signing in. Server boundary (the real enforcement): - course.previewVideo REMOVED entirely — the anonymous playback path no longer exists in the codebase; logged-in free-lesson playback stays on course.lessonVideo (authed + subscribe-ticket gated) - course.completeSubscribeUnlock: publicMutation → authMutation, the deviceId branch deleted — tickets are always ACCOUNT-bound; guests get 401 UNAUTHORIZED instead of a ticket - articles.getBySlug: publicQuery → authedQuery — the article BODY is platform content; list/categories stay public (metadata only) - references.getDownloadUrl: publicMutation → authMutation — file downloads require a session; anonymous callers get UNAUTHORIZED Frontend (login-first UX, matching the boundary): - /articles/:slug wrapped in ProtectedRoute → guests redirect to /login - CourseDetail: guests clicking ANY lesson now get the LOGIN wall panel …1635daf -
perf(lists): content-visibility render-skip for long below-fold lists — articles grid, course reviews, lesson rows, dashboard enrollments, admin mod/audit/roster queues
ahmdelbaz28-uxThree CSS utilities (cv-auto 320px / cv-auto-md 180px / cv-auto-row 72px) with contain-intrinsic-size: auto <estimate> — the browser remembers the real rendered size after first paint, so placeholders only apply to never-seen items and later scrolls never shift layout (CLS-safe with the skeleton-geometry + idle-warm work). Applied from index >= 6-12 per list: the first screenful always paints fully; the growing tail stops rendering (style+layout+paint) until scrolled near — rendering cost becomes ~O(viewport) instead of O(list length) on articles/courses/reviews/lessons/audit pages.fe1f1c0 -
fix(lint): zero biome errors — BYOK a11y labels (htmlFor+id), cookie-banner stable handler deps, stable byok translate fn, star-rating role=img, template-literal style, S2245-adjacent void-type cleanup
ahmdelbaz28-ux43a1d74 -
perf(cls): skeleton geometry mirrors the real course grid — /courses CLS 0.165 → ~0
ahmdelbaz28-uxMeasured live (Lighthouse-style, real Chrome): the 0.165 layout shift on /courses came from the FOOTER jumping when the course grid hydrated. Two drifts stacked: skeleton showed 6 cards (2 rows) while a page holds 12 (4 rows), and the skeleton thumbnail used aspect-video (216px at 3-col width) vs the real card's h-48 (192px). Skeleton now renders PAGE_SIZE placeholders with the exact h-48 thumbnail height. Field: vitest 1125/1125, tsc clean, eslint clean. perf_metrics_prod.mjs added for repeatable live web-vitals measurement.7a728a2
12 days ago
-
fix(profile): root-cure email verification & change flow (owner review round)
Z UsercompleteEmailVerification honored the already-verified idempotency return BEFORE pendingEmail - email changes were silently impossible for verified users (the normal verify-then-change order): the confirmation code succeeded while the address never switched. pendingEmail is now read up front and the idempotency short-circuit only fires with no pending change; success carries an emailChanged flag for truthful UI feedback. initiateEmailVerification persisted credentials + pendingEmail BEFORE the provider send - a failed send left an armed change that a later unrelated plain verification (code to the CURRENT address) would silently apply. The write now happens only after a successful send, a plain send clears any lingering pendingEmail, and stale pending changes are disarmed wherever credentials are cleared. completeEmailVerification re-checks address ownership at completion time (the uniqueness check ran at request time; users_email_unique would have surfaced as a raw 500) and wraps th…a37e9f7 -
feat(chatbot): BYOK — bring-your-own-key lane (user's own model first, platform cascade always the baseline)
Z UserOwner contract: the platform ALWAYS runs on owner-managed models. A logged-in user may register ONE custom OpenAI-compatible provider (baseUrl + key + model) via a new key menu inside the chatbot; when enabled, the server tries their endpoint FIRST with the identical system prompt (Saadat identity, citations, ±0.5% discipline) and falls back to the platform cascade on ANY failure — availability can only increase. Vision keeps the platform two-pass pipeline. Backend: - db v16: userAiProviders (1:1 per user, FK cascade, idempotent boot block) - byok-crypto.ts: AES-256-GCM at-rest encryption derived from APP_SECRET (write-only key; only a first3…last4 mask ever leaves the server) - chatbot-byok.ts: provider catalog (OpenRouter/Groq/OpenAI/NVIDIA/Cerebras/ Gemini/custom), config loader (fail-closed SSRF re-check per use), tryByokChat + tryByokStream (same data:{"text"} protocol), testByokProvider - cascade integration: BYOK lane at the TOP of runTextCascade and getStreamResponse; …d241ddf
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 -
fix(admin): dashboard audit — honest notifications composer + server broadcast history
ahmdelbaz28-uxROOT FIXES from the full dashboard audit: 1. Notifications composer lied about the notification type: Admin.tsx hardcoded type:'promo' because the composer offered enrollment/update/ custom — types the server z.enum REJECTS. The composer now speaks the server's vocabulary (promo/system/lesson/file/software/youtube) and the REAL picked type reaches the wire (pinned by E2E wire-contract test). 2. Composer lied about recipients & scheduling: the recipient filter and schedule UI were decorative (backend broadcasts to ALL users, no worker for scheduled sends). Both removed; the composer now states the honest contract (all registered users + Web Push + Telegram). 3. Composer lied about success: the 'sent successfully' toast fired even when the mutation failed. onSend is now awaited by the panel — success toast/history only after the server confirms, error toast on failure. 4. History tab was localStorage-only. New admin.broadcastHistory query serves SERVER t…2efd444
17 days ago
-
fix(recovery): self-healing desktop recovery + edge-challenge resilience
ahmdelbaz28-uxRoot cause of 'desktop won't load' (2026-11-16, measured live): - The qzz.io provider edge (outside our control) serves flagged clients '403 + cf-mitigated: challenge' on the document AND ~26 tRPC calls — XHRs can never solve an interactive challenge, so the shell rendered while all data died; flagged desktops loop in the challenge page. - Locally, recovery was DEAD CODE: index.html's self-heal called __nukeAndReload which cache-nuke.js never defined; a stale HTML shell with a poisoned localStorage buildId passed the version check forever. This commit (all layers, loop-proof by construction): - cache-nuke.js v3: single recovery owner — stale-shell token check (?v= vs /api/version), per-session nuke cap (2) + Arabic guidance banner, one-shot edge-challenge recovery navigation, __nukeAndReload actually exported; inflight guard kills the double-trigger race - index.html: early listener now catches RESOURCE errors (script 404) and unhandledrejection (lazy chunks); boot-s…b452688 -
feat(gate): server-anchored subscribe-to-watch enforcement — no ticket, no video
ahmdelbaz28-uxOwner contract (2026): subscribing to the YouTube channel is a HARD prerequisite for opening ANY course lesson video. The UI gate existed but the server answered lessonVideo/previewVideo regardless — this commit makes the enforcement real at the API boundary: SERVER - api/lib/subscribe-ticket.ts: HMAC-signed unlock tickets (APP_SECRET), account- (u<id>) or device-bound (d<uuid>), expiry clamped 1..60d, timing-safe verify, fail-closed on any malformation. - api/lib/subscribe-gate-config.ts: server reader for the admin-managed "subscribeGate" settings section (cached, fails closed to ON). - course.lessonVideo + course.previewVideo: REFUSE playback data without a valid ticket — 403 SUBSCRIBE_REQUIRED (covers guests and students, free previews and paid lessons alike). - course.completeSubscribeUnlock: issues the ticket at the confirm step (the ONLY unlock path; no ticket ever = no playback). CLIENT - subscribe-gate lib: ticket storage + stable device subject; clear paths fo…29bdef8
19 days ago
-
fix(ui): Escape now dismisses the cookie banner from anywhere — root cure
ahmdelbaz28-uxProd audit tour (owner directive: 'قم بجولة... لو في اي خطأ قم باصلاحه') found Escape was DEAD on production: the backdrop button's onKeyDown only fires while that button holds focus, and nothing focuses it on load — so the advertised keyboard dismissal (SonarCloud S1082 intent) never worked for real keyboard users. Root cure: window-level keydown listener while the banner is visible — works regardless of focus. Guard rails added: - E2E spec: 5 journeys incl. 'Escape with nothing focused' (the exact prod failure), consent persistence across navigation — 5/5 PASS - scripts/cookie_banner_probe.mjs: all-4-paths live probe - scripts/prod_audit_tour.mjs: full-site crawl tool; expectations corrected for by-design behaviours discovered by the tour: · /api/health open (Docker container healthcheck) · /manifest.webmanifest is the real manifest path · unknown routes return HTTP 404 (SEO-correct) + SPA NotFound page · auth.me 401 for anonymous visitors = self-heal probe by design …d98e0e5 -
feat(ui): remove the regenerate chip from the chat — owner directive
ahmdelbaz28-ux'بعد رد المساعد الذكي ليظهر في الشات كلمة regenerate reply — مش عاوز دي تظهر في الشات' The 'Regenerate reply' control that appeared under the last assistant reply is gone completely — root removal, not a cosmetic hide: - MessageBubble: chip render block, showRegenerate/onRegenerate props - ChatBot: regenMsgId target computation + handleRegenerate handler - E2E: the regenerate journey spec deleted; new guard spec asserts ZERO regenerate controls (EN/AR text, aria, title) after a real streamed reply — permanent regression protection - typeahead/vision-retry journeys unchanged and still green Verified: tsc clean, build clean, 948/948 unit, 6/6 chat E2E (including the new absence check).b522c6c -
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 -
feat(chat): proactive professional audit — regenerate chip + vision-retry image carry + type-ahead composer
ahmdelbaz28-uxOwner directive: do what a professional sees is missing, unprompted. Full-audit findings (none previously requested): 1. ↻ REGENERATE — retry existed only on error bubbles; a mediocre reply could never be re-asked without retyping. New chip on the LAST real reply (idle-only, welcome/error-excluded) removes the pair and re-sends the exact question — text AND attached image. 2. ROOT-CURE vision-retry blindness — handleRetry re-sent only the text; the attached image (upload OR live screen frame) was silently dropped, so a retried vision question got answered by a model that could no longer SEE anything. The image now rides the re-send (dataUrl in memory, persisted thumb after reload) and screen_capture re-arms the LIVE SCREEN TEACHER prompt. Same contract applied to regenerate. 3. TYPE-AHEAD — the composer was hard-disabled while streaming; users stared at a frozen input. Now editable mid-stream (send guard + stop button slot make mid-stream sends impossib…8f4e6ee