Unique urls for saving/sharing would be really useful
Well, I guess it's possible with the query string but it's impractical
I think we can make a skateboard solution by adding copy/paste functionality. Thoughts? https://news.ycombinator.com/item?id=17653339
JSON would work, but it's still a hassle and unpractical for non-developers (likely there will be some, given the nature of the app). Unless you save them to a file with some extension that you can then open with the application.
Perhaps store it in mongo and generate a unique link. The only downside is that it is an extra step in the setup. And you wouldn't be able to host it as a docs anymore.
Here are the possibilities that come to mind:
- Copy/Paste JSON or YAML in a way similar to SVGOMG's feature
- Pass in canvas data directly through the URL
- Pass a URL to a json/yml file as a query string, and download via ajax (better for sharing, worse for security)
- Add a way to open a canvas from the page either by entering in a URL or file drag and drop
- Create a canvas hosting service (annoying for maintenance, and I have to store people's data)
- Works great, not convenient for sharing
- Super long URLs have limits
- May cause people to inadvertently expose their business model to the public
- Works great for desktop, not convenient for sharing or for mobile devices
- Not really an option because of the following reasons:
- People need 100% confidence that their business secrets are not being spied on by humans, machine learning algorithms, or advertising algorithms (opinion)
- The app isn't monetized so there's no business-case for maintaining a hosting platform (principle)
How about using pastebin/hastebin for this purpose?
One can simple click the share button and his data would be uploaded to hastebin and we just pass through the generated url.
We could then implement a endpoint like /view/<hastebin-hash>. The app would then check hastebins code of that hash and if it contains a special field (like BUSINESS_CANVAS_VERSION) we can be sure it's a valid canvas.
If there are errors in the paste we would just throw an exception telling him, it's invalid.
What do you think?
Okay so I've tried this approach and wondered why I can't upload anything to hastebin from within canvas-sketch. Seems like they don't support CORS yet.
So I've made a pull request for this problem. If it gets implemented we can continue using this approach and would have a free hosting for the business plans.
Refs: https://github.com/seejohnrun/haste-server/pull/353