-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to create a gist #118
Comments
Thanks for reporting this! Maybe the API for creating an anonymous gist changed. I'll try to take a look at this over the weekend. |
So Github removed the option to post anonymous gists. One possible alternative is to use a different service, such as lpaste. |
It's not entirely certain what the future of lpaste is - https://www.reddit.com/r/haskell/comments/862k28/looking_for_new_maintainer_of_lpastenet/ Would it be ok to use GitHub OAuth and then create the gist as the editing user? |
The following is a result of the PureScript hack session: If we decide to go down the oauth route to store gists on behalf of users we'll have to:
The flow of code from trypurescript (FE, BE - front-end, back-end) would look like: User has a previous session The session info is in the secure cookie
User does not have a previous session
Notes:
|
We should have a control that sets the visibility ( |
I've seen the thread before and I'm pretty certain someone is going to pick lpaste up. Also I think it's by far the simplest solution to the problem (a simple UI for sharing a trypurs gist from trypurs). |
Would either of these options work:
Unfortunately, both of the above are vulnerable to spam. |
I think option 1 is likely to be against GitHub's Terms of Service, or at least liable to get the account we use banned; from their point of view, I'd expect that it's basically the same as anonymous gists. I'm not keen on option 2 either, and yeah, that's because of spam. |
What are your thoughts on storing code as a compressed string in the URL? The typescript web editor does this with lz-string (code link). const hash = `code/${LZString.compressToEncodedURIComponent(State.inputModel.getValue())}`;
// later
let userCode = LZString.decompressFromEncodedURIComponent(code) This simplifies things in a few ways:
The downside is that these links are a lot longer than a gist. You don't want these pasted into Slack not as linked text. Unfortunately Slack made the insane decision to have Here's an example URL. Here's what happens if the URL is pasted raw. |
Here's an editor prototype with both gist and url-compressed code saving and sharing. https://milesfrain.github.io/gist-prototype/?gist=66a6389000ac663e8ba6d97381bfe4d0 This eliminates the need for local storage, and the confusion that happens when folks try to share an edited gist that points to their local session. This new version guarantees that the URL you copy contains an accurate snapshot of your current editor view. Here's an example of a current TryPureScript link that looks different to me as is does for you: Let me know if this is the strategy we want to go with for TryPureScript. |
@milesfrain I think that sounds like a neat approach! |
This is really cool! I'm on board with this approach. It's a best-of-both-worlds in that if you don't want to bother with a gist or you don't want to authenticate anything then you can use the longer link, and if you want a shorter link for aesthetics or because you want a gist then you can. |
I'm happy to consider this approach - I definitely agree that having the same URL have different behaviour based on what happens to be in the user's local storage is not ideal. I'm a little hesitant about having compressed code in the URL, as I'm sure we will see some of those huge URLs floating around, although that's probably an acceptable price to make stuff on Try PS easily shareable. |
Fortunately the typical size of a TryPureScript module is pretty small and the URL isn’t that long. |
FWIW this is the approach that play.rust-lang.org takes and it seems to be okay. |
I agree this is a neat approach, is there still interest in implementing this? As noted, TS Playground uses |
I'm personally fine with that. I think it's a nice feature. |
When attempting to share, I receive an alert with the message:
This is caused by a failed
POST
:The response payload:
The text was updated successfully, but these errors were encountered: