-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Will Sandcastle gist creation break because of this? #6232
Comments
I believe the key is only there to allow us to create/retrieve more gists-per-day than would be allowed from their non-authenticated API. Unfortunately, it looks like the gists we create are actually anonymous. I found this out by creating a simple gist in Sandcastle and then going directly to the GitHub API for it which gets you to https://gist.github.com/27329c6ff6deb5a09ef406d3b56cf593 There are a few options here:
We should probably do something for March 1, since current functionality will break on the 19th. |
I use this all the time for the forum, and that's how about 50% of the community shares their code examples. |
OK, we should try to do something for March 1 then. Does anyone want to look into this? Perhaps first evaluate if this is reasonable:
Then, if needed:
|
You guys might consider persisting to S3. It's easy to rig up an EC2 instance so it automatically has access to a private S3 bucket. Then you can use code like this in a simple back-end service to save/load to/from S3: Is Sandcastle on cesiumjs.org still hosted in IIS these days, or has it moved to Node.js? |
We could build something into ion for this with S3/etc, but not for March 1. Could also punt a bit past March 1 if the other suggests do not pan out. |
In a pinch I could probably open a PR to make Sandcastle use our S3-based persistence service on https://map.terria.io. Long term you'll probably want to control it, though. |
Thanks, but I don't think we'll want the terria persistence. If you have time, feel free to implement or rule out (2) and (3) above, #6232 (comment) |
We have a bunch of issues that have code examples stored in sandcastle gists like #5371 |
@hpinkos The blog post says:
So it sounds like they will remain available. |
I'd rule out 2 right away. You'd need a server-side piece to protect your GitHub API key, anyway. If you're doing that, might as well use S3; it's not any harder. Plus we considered the authenticated gist approach for Terria, emailed GitHub to see if they were ok with gists being used in that way, and they told us flat-out no. I don't think a URL shortener will fly. We used to use the Google shortener, and it worked fine for awhile, until one day Google quietly put a limit on the URL length and broke everything. Not sure about pastebin or other services, but I suspect you'll run into similar problems: these kinds of services aren't meant to be a data store for you app, so at best you'd be getting away with it. The Terria share service is at least meant for a very similar purpose, and isn't going to randomly go away or start blocking you without warning, so IMO it's better than any of these options. But really I'd only recommend it as a stopgap before you can put a persistence service in Ion or whatever. If the alternative is turning off sharing entirely for awhile, definitely go with the Terria thing. :) |
Thanks @kring, will look into what is involved for ion. |
I was OK with it or potentially updating Sandcastle on the website in the middle of the month. If you two really want to remove it for now, OK. |
It's a feature people seem to use fairly often. I think we'll get a bunch of forum questions asking why it's broken if we leave the button there after the 19th. I'm okay leaving it alone until then, as long as it's easy to update the website mid-month. @ggetz will it be easy to just update Sandcastle on the website on March 19th? |
Yep! We just need to update the |
Since we're fast approaching doomsday here I started prototyping storing code in the URL directly, without a server. Using zlib compression and storing the compressed result base64-encoded in the URL fragment looks like this: This is the existing "3D Models" example (1884 bytes) compressed then encoded to a 1014 byte URL. Large but works. The largest existing example is CZML Path which is 85439 bytes and produces a 28942 byte URL. It does load correctly in Chrome at least. I believe that because I'm using the fragment instead of a query parameter, then URL length limits do not apply (the fragment is not sent to the server). Improvements would be to use base85 instead of 64, and using a better compression algorithm than zlib. |
Given the main reason for this feature is to post to the forum and GitHub issues, I very much prefer the url approach, even if it's a little verbose. @kring to answer your question, cesiumjs.org is hosted on S3 now (via CloudFront). I did look into using lambda or a small shim server to allow for storing of gists directly into S3, but I think it's extra infrastructure that we don't necessarily need. |
@shunter what library are you using for the compression? https://github.com/rotemdan/lzutf8.js looks promising and is pretty small (9kb minified). |
url approach is OK with me. If it gets out of control, we can re-evaluate in the future. I think most code snippets we share are pretty small - which is exactly what we want for bug reports. |
https://github.com/pieroxy/lz-string/ may also be a good choice. |
I tested several other compression algorithms and surprisingly zlib (via pako) provides the best compression of anything I tried (LZMA, bzip2, smaz, all of the algorithms from https://www.npmjs.com/package/compressjs) base85 / ascii85 didn't pan out because it turns out that 14 out of the total 95 printable ASCII characters are not permitted in a URL fragment - |
Thanks @shunter, I really appreciate you handling this. I'll review a PR as soon as you have it and we'll get this deployed ASAP. |
Anonymous gist creation will be removed - #6232 Instead of publishing gists, when we share we now encode the code into the URL fragment, in compressed Base64 encoded form. (see code comments for the exact format) Existing gists still load as before.
Anonymous gist creation will be removed - CesiumGS#6232 Instead of publishing gists, when we share we now encode the code into the URL fragment, in compressed Base64 encoded form. (see code comments for the exact format) Existing gists still load as before.
https://github.com/blog/2503-deprecation-notice-removing-anonymous-gist-creation
Or is Sandcastle not anonymous? I think we made a key at one point.
The text was updated successfully, but these errors were encountered: