Skip to content

feat(learn): add public embed for progress trackers - #1284

Open
ayesha1145 wants to merge 10 commits into
alphaonelabs:mainfrom
ayesha1145:feat/progress-trackers-embed
Open

ayesha1145 wants to merge 10 commits into
alphaonelabs:mainfrom
ayesha1145:feat/progress-trackers-embed

Conversation

@ayesha1145

Copy link
Copy Markdown
Contributor

Part of #1251 (step 4 of 4).

Stacked on #1283 (step 3), #1277 (step 2) and #1276 (step 1). Until those merge, this PR's diff also shows their commits. Please review only the last commit ("feat(learn): add public embed for progress trackers"). I'll rebase once they merge so only that commit remains.

What

  • GET /api/trackers/embed/:code: public, read-only view of a tracker its owner made public (no login)
  • New page /trackers/embed?code=... (learn/public/tracker-embed.html): a small progress card that can be shown in an iframe on another site
  • Tracker detail page: an "Embed on another site" box with a copy button, shown only for public trackers
  • README endpoint table updated

Design notes

  • Private by default: only trackers with is_public = 1 can be read through the embed; a private, missing or malformed code all return the same 404
  • Only title, description, current/target value, percentage and color are returned. The owner and the tracker id are never exposed
  • The embed code must look like a UUID before the database is touched
  • The embed page is the only page that drops X-Frame-Options; every other page still refuses framing (tests check /trackers, /surveys and /about)
  • The embed page builds its content with textContent only (no innerHTML), has no template tags and is marked noindex

Testing

  • 17 new embed tests; 76 tracker tests pass in total
  • Checked in a browser with a mocked API: the embed card, the "not available" and "incomplete link" states, and the embed box on the detail page (including after a save and after switching to private)
  • Not tested on a live deployment yet, so the real iframe on another origin still needs a check
  • Pre-commit: poetry and Django hooks can't run on my machine; the other Python hooks were not run on worker.py because black rewrites unrelated lines in that file

AI assistance

Claude (Claude Sonnet 5.5) helped draft and test this; I reviewed the changes and ran the tests.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e6ece26 and 187ca7f.

Files selected for processing: 9

  • learn/README.md
  • learn/migrations/0016_progress_trackers.sql
  • learn/public/tracker-embed.html
  • learn/public/trackers.html
  • learn/schema.sql
  • learn/src/worker.py
  • learn/tests/test_trackers.py
  • learn/tests/test_trackers_embed.py
  • learn/tests/test_trackers_page.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added the files-changed: 9 PR changes 9 files label Nov 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👀 Peer Review Required

Hi @ayesha1145! This pull request does not yet have a peer review.

Before this PR can be merged, please request a review from one of your peers:

  • Go to the PR page and click "Reviewers" on the right sidebar.
  • Select a team member or contributor to review your changes.
  • Once they approve, this reminder will be automatically removed.

Thank you for contributing! 🎉

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 9 PR changes 9 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant