Commit graph

23 commits

Author SHA1 Message Date
3ba7eaefd0 Show full Wikipedia 429 error message 2026-05-14 10:15:19 +01:00
fd59e2a9a4 Guard oauth callback against missing session tokens 2026-05-14 10:14:59 +01:00
5ba380d590 Add how-it-works steps to home page and fix post-OAuth redirect
- Add three-step explanation (Search, Review, Save or skip) below the
  search form on the index page
- After a LoginNeeded during save, redirect to OAuth with next= pointing
  back to the article page showing the same candidate

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 15:22:01 +01:00
c9b4e2face Add redirect support, live candidate list, per-article save count, and error pages
- Detect redirect targets (e.g. "handling stolen goods" → "Possession of
  stolen goods") and use piped links [[target|title]] in edits; exclude
  articles already linking to the redirect target from candidates
- Remove candidates from the list in real time as they are checked and
  found invalid, with live count update in the summary
- Track and display per-article save count in the stats line
- Rename "Find Link" to "Missing Link" throughout
- Show redirect target in the article heading
- Report save errors to the user via error page instead of crashing
- Filter self-links using case-insensitive first-letter comparison

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 13:53:35 +01:00
0239b83555 Track processed candidates in session and use OAuth for API calls
- Record skips, saves, and no-match results in session["skipped"] so
  revisiting an article resumes past already-checked candidates
- Filter self-links (case-insensitive first letter) from hit list
- Use OAuth session for all API reads when logged in for higher rate limits
- Add "for" template to exclusion list to avoid bad edits
- Improve API error handling with HTTP status codes logged to stderr

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 12:46:13 +01:00
2c197f5c43 Add live search progress, session counter, and fix URLs
- Search candidates client-side with JS, showing "Checking X..." spinner
  instead of leaving user waiting on a blank page
- Fix broken api_valid_hit endpoint (get_diff returns dict, not tuple)
- Remove server-side get_best_hit; article_page now returns candidate list
  immediately and JS iterates via /api/1/valid_hit
- URL now reflects current article via history.replaceState (?title=X),
  Skip navigates to ?after=X to advance past it
- Track saves in session; show count as green badge in navbar
- Add session counter incremented on each successful save

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 12:24:15 +01:00
bc6265d4cd Redesign UI and fix several bugs
- Add navbar with login/logout, search form, and Find Link branding
- Clean up index page: search-only, examples behind ?debug=1
- Improve article page: remove debug clutter, named Wikipedia links, collapsible candidates
- Add SVG favicon (🔗 emoji)
- Fix diff CSS: compact layout, auto table layout to eliminate wide marker column gap
- Catch TokenRequestDenied in OAuth start and show error page
- Store username in session at login; clear bad session on API failure
- Raise NoMatch when diff is empty (edit already applied)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 11:30:12 +01:00
da83f0791d Fix OAuth User-Agent header and improve error handling
- Set User-Agent on OAuth1Session during token fetch and access token
  exchange so Wikimedia doesn't reject the requests with 403
- Extract handle_post() from article_page() for clarity
- Catch api.MediawikiError in get_best_hit() to skip bad API responses
  rather than crashing the page
- Catch mediawiki_api.APIError on save and return a 502 with the error
  text instead of a 500 traceback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 18:11:23 +01:00
1be844e57a Correct spelling mistake 2025-01-16 18:37:07 -06:00
b76a6707f2 Consider all matches, not just exact matches 2023-12-09 18:45:19 +00:00
113dfd3630 Refactor: new get_hit_count function 2023-12-06 20:58:01 +00:00
98ea589c58 Add more detailed docstring 2023-12-06 20:57:24 +00:00
dd9b7be198 Improve article_title_to_search_query function
Add more detailed docstring
2023-12-06 20:44:20 +00:00
fc0d6f114a Don't crash when there is no match 2023-12-06 11:30:04 +00:00
ea95c82b37 Rename wikidata_oauth to mediawiki_oauth 2023-12-06 11:29:03 +00:00
128d84fce9 Redirect to oauth_start if not logged in. 2023-12-06 09:53:35 +00:00
32a7e939a5 Rename article2.html to article.html 2023-11-26 14:13:51 +00:00
f54401ef05 Show list of hits on article page 2023-11-25 20:59:10 +00:00
8901831568 Adjust OAuth to work better 2023-11-25 19:59:28 +00:00
b6cc79291b Move article link route to 2023-11-25 19:58:58 +00:00
be4db13179 Adjust favicon 404 route for type hints 2023-11-25 19:58:24 +00:00
99db7df7f1 Add 'type: ignore' for mypy 2023-11-25 19:57:47 +00:00
f07b407e7a Initial commit 2023-10-04 12:56:21 +01:00