-
Notifications
You must be signed in to change notification settings - Fork 11
Add snippet sharing support. #11
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
Add snippet sharing support. #11
Conversation
}() | ||
}) | ||
}) | ||
// TODO: Should be sending as binary blob or is text okay? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text is not okay, it causes last newlines to be lost/added, etc. We want byte-for-byte precise data transfer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm not completely sure if it causes issues, it might've been due to something else.
Any suggestions on what else should be done for this to be merged? I think it might be helpful to move the XHR request code into helper functions, since it's pretty verbose. |
) | ||
|
||
type Line map[string]string | ||
|
||
var output []Line | ||
|
||
//const snippetStoreHost = "localhost:8080" | ||
const snippetStoreHost = "gotools.org:26204" // TODO: Decide on where the snippet-store server will be hosted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend hosting it at a subdomain; makes it easier to move the service to a different server without having to update the JS file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still need a custom port, so, snippets.gotools.org:26204
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example; although I'm not sure why you need the custom port, a frontend proxy could do the right thing per-domain (proxy gotools.org:80 to your current thing, proxy snippets.gotools.org:80 to the snippet service)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I can do that. snippets.gotools.org
then.
Unless someone else wants to host it, or create a Heroku account as Richard suggested and deploy it there instead.
Imho, if it works, merge it and improve it in later revisions. |
Use "snippets.gotools.org" as the current snippet store host. Change error language from "cannot do something" to "failed to do something". I think this is more clear and suggests that it's a (potentially temporary) system failure, rather than the user doing something wrong.
It did get quite a bit larger due to use of dom and xhr packages (which are somewhat overkill for this tiny project if we wanted to really optimize its size, but I think worth it in general and shows better example code).
I tend to agree, and I think it's basically ready now. It definitely works in my testing. I think it can be merged, but I'll wait for some feedback/review for now. |
As Richard said,
This is up to us. If @dominikh and @ajhager can review and +1 this, let's go ahead and get this feature out. Let's keep in mind one thing from the README:
I want to make sure we don't compromise the current great experience of the GopherJS Playground. From my local testing (a link where you can try/test it is in #6 (comment)), I do not see any more issues that need to be solved, which is why this PR has LGTM from me. If you spot any usability or other issues, let me know! |
LGTM! Great job on this @shurcooL 🎯 |
Thanks! @dominikh says it looks okay to him too, so I'll merge (i.e., deploy) this change tomorrow morning! Yay, snippets. |
Merging now. Please let me know if you spot any issues. |
Well, this immediately makes one issue obvious, that I overlooked prior. See #14. |
Closes #6.
This PR is a very rough start, the code needs to be cleaned up, reviewed and improved. This is my first time using AngularJS, so I may be doing things in a suboptimal way. I've already marked the things I know are poor/incorrect with TODOs.
This is to get the process started.
Known remaining tasks:
share-url
text box.