rust-lang / rust-lang/rust-playground
Save gist to user account when sharing
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 267
- Avg merge
- 3h 2m
- Merged PRs (30d)
- 6
Description
Because we can't edit gists created by the Playground, I like to copy the content into my own account and add a comment linking back to the Playground e.g., https://gist.github.com/heaths/9ca334d400763698e0d4c895d495190a. This allows us to make some changes after some discussions and makes it easy to share so colleagues can modify the code in the Playground, try things out, look at different output, etc.
As a simplification of #609 the Playground could [prompt the user for authenticating(https://docs.github.com/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app) with the gist scope and call the gist creation API to create a private gist. The user token wouldn't need to be persisted, thus requiring a backend database, HttpOnly cookies, or the sort. Just keep it and the refresh token in memory.
Additionally, a comment could be added back to the Playground e.g., https://gist.github.com/heaths/9ca334d400763698e0d4c895d495190a?permalink_comment_id=5263599#gistcomment-5263599 (just the first bullet as a single line comment).
By keeping the refresh token in memory, the Playground could also support updates. If the gist already exists it could be updated, using the refresh token as needed. Similarly, if someone navigates to the Playground with an existing gist ID, the update API could be attempted. If it's not their gist the call would fail so there's no need to check authorization ahead of time.
An OAuth App would need to be created for the Playground.
For the UI, I was thinking of a drop-down button like some of the other existing ones. The default would be the existing behavior so no one is surprised, but in a drop-down you could have something like "Save to account".
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Playground's existing sharing control and gist flow, then review GitHub's user authentication and gist creation/update APIs linked in the issue. Done means a dropdown preserves the current sharing behavior while allowing an authenticated user to save a private gist, optionally add the Playground comment, and update an existing gist when authorized.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, rust
- Domain
- api, authentication, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100