davidedc / livecodelab

a web based livecoding environment
http://livecodelab.net/
MIT License
327 stars 63 forks source link

Sharing Sketches #212

Open noio opened 10 years ago

noio commented 10 years ago

Sharing

Allow users to share sketches by just dumping them to Gist or similar. Allow other users to import these sketches into their own sketch: import gist/123456. The imported sketch could consist of fully fleshed out visuals, or it could just define functions (#211) (like grid) with macros, so the user now has access to these extras.

Other thoughs:

rumblesan commented 10 years ago

so sharing sketches between users is something that we've talked about before but it would likely need a server and we've tried to steer clear of that up until now.

There are probably ways of doing it without but it would require some thought etc. The idea of having you able to save sketches to a github gist (or any other text based storage medium) is a good one though.

At this point, given that we're already going down the route of having some server side functionality available, I do think it's worth looking at this again. Making sure that it gracefully degrades if the server isn't available shouldn't be too tricky.

I've only just noticed the macro/functions issue you posted and i've not read it yet so don't know yet where the other stuff is going. Will have a look now

noio commented 10 years ago

Actually, I think it's possible to posts gists purely from the client (Gist API). LCL could have a "save" button that posts the gist and presents the user with a link lcl.net/?bookmark=gist/123456 (or an error if there is no internet connection: "Could not save"). When navigating to the link it loads that text/code into LCL. The source could even be an arbitrary URL, to allow github raw links and other 'text based storage media'.

There is a definite risk of XSS (which will be reduced once LCL has its own parser). However, the user is not logged in, so there is no sensitive data. Worst that can happen is that a malicious user script screws up the LCL environment, which can be solved by a simple F5.

rumblesan commented 10 years ago

If it's possible to save the gist entirely in the client side then that would do away with the need for the server, though there'd still be the question of authentication etc (which can almost certainly still be done client side, but I just think it makes things into a much bigger task)

Ultimately, I'm totally behind the idea, I just want to refine the implementation, and as someone that much prefers backend coding, thats the way I lean hehe

Richard-Mineall commented 9 years ago

Sharing sketches could just be a simple save and load feature, you could save your own sketches and choose to make them public which we could send to reddit or here to github, as all you need to do is copy and paste the code that you have written as a text file, people could download them as a file that can be opened directly by livecodelab, then open them at any time they want to using the load feature that I was talking about.

davidedc commented 9 years ago

I'd say let's keep it simple as first step: click share button - the code is saved in the URL and the URL is minified. That's it. Wanna share it? Share it. Wanna save it? Bookmark it. That's how Mr Doob does it here: http://mrdoob.com/#/146/html_editor

Richard-Mineall commented 9 years ago

yes, but where do the codes that are shared go? To a server most likely, but we want to do something else, so I'm saying that sharing it would post it to reddit and it would show up in a "shared" tab in livecodelab, what I'm saying basically is that we use an existing share website (with the ability to show symbols and indents) as a place to put the code without having to use a server.

davidedc commented 9 years ago

yeah yeah I'm cool with "fully fledged" server-heavy sharing - I made myself already a fully working system here https://github.com/davidedc/sketchPatch , which also saves thumbnails, has comments, manages permissions, "forks" sketches, tags, shows by author, etc.

I'm just saying what the first step is to make the simplest URL-encoded sharing.

Waiting on big releases doesn't make too much sense, I suggest we ship well-made and robust small stuff first, and then we iterate...

Joshfindit commented 3 years ago

How about just overloading the URL?

It would be cumbersome for larger sketches, but it could also mean that “run” links could be added to the screenshots on the site without having to have any server-side code.

Even the safest limit is 2000 characters which is a decent amount of code.

As well, code that’s added in-editor could simply be echoed to the url meaning users could copy/paste exactly as they expect.