Commit Graph

37 Commits

Author SHA1 Message Date
tdurieux f91db91cee wip 2026-05-04 11:30:42 +02:00
tdurieux 117406f2ce refactor: route anonymize preview through the backend
The form's live README/PR preview was running its own copy of
ContentAnonimizer in the browser. The two implementations had been
drifting — recent fixes for word boundaries (#175/#249), accent
matching (#280), custom replacements (#285), and the diacritic-stripped
variants only landed on the server. Reviewers saw one anonymization;
authors composing the form saw another.

Add POST /api/anonymize-preview that takes a snippet (or a batch) plus
the user's options and runs them through the same ContentAnonimizer
the file route uses. Replace the client-side anonymizeReadme() body
with a debounced call to that endpoint. The PR view's
anonymizePrContent() runs as a synchronous template expression, so it
now reads from a {original -> anonymized} cache that's refreshed in
the background whenever the PR details, terms, or options change.

Single-flight + debounce keep the form responsive; an in-flight
request is dropped on the next change.
2026-05-04 11:05:50 +02:00
tdurieux 3f095f0734 always use githubStream 2026-05-04 10:47:58 +02:00
tdurieux 88fe8570fd fix: include file path in cache ETag
Without the path, two different files in the same repo (same sha, same
anonymization options) shared an ETag. If a browser ever sent the cached
ETag for one file while requesting another, the server would have
returned 304 against the wrong cache entry. Fold the path into the
ETag so each file has its own fingerprint.

Follow-up to b3c1030 (#439).
2026-05-03 21:19:39 +02:00
tdurieux b3c1030e5c fix: revalidate cached files when anonymization options change
Files were being served with Cache-Control: max-age=18144000 (210 days)
keyed only on the upstream ?v=<sha>. Editing the term list left the
same URL serving stale anonymized bytes — visible to users in regular
tabs but not in incognito. The previous fix-by-incognito recipe in #439
is exactly this.

Switch to ETag-based revalidation that fingerprints both the upstream
sha and the saved anonymization options, with Cache-Control:
no-cache, must-revalidate. Browsers now revalidate on every request and
get a 304 when nothing has changed, or fresh content as soon as terms,
image/link/etc. options are updated.

Fixes #439.
2026-05-03 20:31:32 +02:00
tdurieux a5f66d6844 multiple fixes 2026-05-03 15:30:54 +02:00
tdurieux 88f826aab4 update design 2026-04-24 14:55:18 +02:00
Thomas Durieux 188066e91d Fix 9 bugs and add 103 tests for core anonymization, config, and routing (#669) 2026-04-15 09:41:00 +02:00
Thomas Durieux 8198a4b44a Standardize error responses with consistent format and human-readable messages (#667) 2026-04-15 09:27:08 +02:00
Thomas Durieux f4209110c7 Fix all 93 ESLint issues (3 errors, 90 warnings) (#666) 2026-04-15 09:04:22 +02:00
Thomas Durieux 95324fd09f Replace isomorphic-dompurify with sanitize-html for Node 21 compat (#663) 2026-04-15 04:57:21 +02:00
Thomas Durieux c6d6806d7a fix: prevent admin status reset on login (#659) 2026-04-15 04:34:36 +02:00
Thomas Durieux f3641c8ce3 Set up CI with ESLint linter and Mocha test runner (#661) 2026-04-15 04:34:03 +02:00
Thomas Durieux 812f8b6314 Sanitize markdown HTML output with DOMPurify to prevent XSS (#658) 2026-04-15 04:22:38 +02:00
Thomas Durieux b2d77faa6c try to fix repo access 2025-04-01 22:27:41 +02:00
tdurieux 532c094388 fix: improve token management 2024-06-18 12:00:53 +02:00
tdurieux dcf483ea03 feat: improve download anonymized repository 2024-05-06 11:52:32 +02:00
tdurieux ca04339529 feat: list files in folder in webview 2024-05-02 11:49:00 +01:00
tdurieux 3536f78a99 fix(#283): Fix webview for web in folder 2024-04-30 11:28:32 +01:00
tdurieux 72c8f80bce fix: fix file path in webview 2024-04-28 09:38:49 +01:00
tdurieux 17abc47d08 fix: fix webview on root repo 2024-04-28 08:08:39 +01:00
tdurieux 17cb1f294f chore: remove all reference to originalFiles 2024-04-27 18:04:51 +01:00
tdurieux 2a145730b7 Improve log and GH token validation 2024-04-27 16:19:33 +01:00
tdurieux 710f7328e7 feat: flatten file tree for better performance 2024-04-26 10:32:09 +01:00
tdurieux daf3276f7f fix: fix queue admin 2024-04-12 09:56:39 +01:00
tdurieux 03835e86ab fix: handle error in queue admin 2024-04-11 17:48:41 +01:00
tdurieux 79c6b603b4 fix: handle error in queue admin 2024-04-11 17:22:08 +01:00
tdurieux 6b9574add3 fix: improve repository rename 2024-04-11 17:13:01 +01:00
tdurieux 61c6a79949 feat: check repo status before update 2024-04-11 15:25:45 +01:00
tdurieux 389030adc9 refactor: rely more on the db instead of querying GH 2024-04-06 15:15:08 +01:00
tdurieux 968a59726c feat: increase caching when file version is provided 2024-04-06 10:05:07 +01:00
tdurieux 27c54b0182 feat: add link to website if enabled 2024-04-05 12:10:07 +01:00
tdurieux ca3996775b chore: cleanup console 2024-04-03 20:38:48 +01:00
tdurieux 42c3a58a46 feat: add edit button on repo view 2024-04-03 19:11:10 +01:00
tdurieux 1d4bab7866 fix: fix webview & improve download progress 2024-04-03 18:25:33 +01:00
tdurieux db67f53b2c fix: fix GitHubDownload 2024-04-03 13:24:34 +01:00
tdurieux 4d12641c7e feat: introduce streamers that handle the stream and anonymization from github 2024-04-03 11:13:01 +01:00