{"action":"created","issue":{"url":"https://api.github.com/repos/amber-smalltalk/amber/issues/1168","labels_url":"https://api.github.com/repos/amber-smalltalk/amber/issues/1168/labels{/name}","comments_url":"https://api.github.com/repos/amber-smalltalk/amber/issues/1168/comments","events_url":"https://api.github.com/repos/amber-smalltalk/amber/issues/1168/events","html_url":"https://github.com/amber-smalltalk/amber/issues/1168","id":65684928,"number":1168,"title":"Add local file-saving feature to use Amber for locally hosted rapid prototypes and experiments","user":{"login":"Basilmir","id":7197019,"avatar_url":"https://avatars.githubusercontent.com/u/7197019?v=3","gravatar_id":"","url":"https://api.github.com/users/Basilmir","html_url":"https://github.com/Basilmir","followers_url":"https://api.github.com/users/Basilmir/followers","following_url":"https://api.github.com/users/Basilmir/following{/other_user}","gists_url":"https://api.github.com/users/Basilmir/gists{/gist_id}","starred_url":"https://api.github.com/users/Basilmir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Basilmir/subscriptions","organizations_url":"https://api.github.com/users/Basilmir/orgs","repos_url":"https://api.github.com/users/Basilmir/repos","events_url":"https://api.github.com/users/Basilmir/events{/privacy}","received_events_url":"https://api.github.com/users/Basilmir/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/amber-smalltalk/amber/labels/needs%20review","name":"needs review","color":"eb6420"},{"url":"https://api.github.com/repos/amber-smalltalk/amber/labels/won't%20fix","name":"won't fix","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-01T13:31:50Z","updated_at":"2015-04-01T13:43:04Z","closed_at":null,"body":"*Initial thoughts*\r\nI would like to discuss an interesting use case for Amber. \r\n\r\nFor a long time I've been using this single page entirely Javascript wiki app called TiddlyWiki5. It can be installed on a NodeJS server and act as a collaboration platform. Source code here https://github.com/Jermolene/TiddlyWiki5 with instructions on how to install here http://tiddlywiki.com/#Installing%20TiddlyWiki%20on%20Node.js\r\n\r\nAmber is \"basically\" an entirely Javascript app too. It can alse be installed on a NodeJS backend and also and act as a development hub to that particular app. Source code here http://tiddlywiki.com/#Installing%20TiddlyWiki%20on%20Node.js with instructions on how to install here http://docs.amber-lang.net/faq.html\r\n\r\nBut here is where the 'similarities' end. Unbeknownst to most is the fact that TiddlyWiki, being a Javascript app, also has a 'local' or 'single-file' mode where the entire app is stored in a .html file on your local storage. This 'single-file' mode is remarcably similar to what a .image file is to Pharo or Squeak Smalltalk.\r\n\r\nHow it works:\r\nEnter the single-file, self modifying Javascript app TiddlyWiki. It is a single .html file http://tiddlywiki.com/empty.html (right click to download an empty wiki). You double click this .html file to open it locally. Click the \"+\" sign on the right to add a \"Tiddler\" note and the Checkmark sign in the note to save it. If you close the page, all edits are lost.\r\n\r\nQ: How do you save the modified Tiddlywiki, Javascript in the Web Browser is forbidden to access local resources?\r\nA: Easy, you just click File - Save As from your Favorite Web Browser. A new .html file is created with your saved content which you can save over the old one.\r\n\r\nImagine if Amber were like this, and it essentially is that way today. Amber is client-side in its essence, and mainly used to develop single page designs. From what I see NodeJS is partly used as a persistence mechanism (along with other things) when running a \"hosted\" Amber website so one can commit code written in a \"remote\" Web Browser.\r\n\r\n**How would this work?**\r\n\r\nAfter careful consideration on the mailing list, we've concluded that it's best to implement this feature in a similar fashion *but* preserving the current Amber structure and Version Control System. Essentially leaving the project structure unchanged but instead adding this capability to the IDE itself.\r\n\r\nAmber development take place on the Client in a Web Browser. Normally the IDE functions independently of the server, with the exception of the Commit Package command which initiates a POST/PUT uploading the .st source files and the .js compiled version of the source.\r\n\r\nMethod 1 (Herby V.):\r\n**This is where this project comes into play** Apparently finding a place where \"ajax:\" is called to do a HTTP PUT and make it use \"saveFile:\" if the protocol is file:// (the app was opened locally) \r\n\r\nPossible complications:\r\nThere might be complications as this uses require.to URL IIRC and we don't know what it returns for file://\r\n\r\nMethod X (Mir S. -  this is more like a scenario description, I'm not a programmer and I can only see the end result, not the implementation)\r\nBut wait there's more, here is where it becomes really interesting. Tiddlywiki goes even further:\r\n\r\nQ: Yes, yes but wouldn't it be nice if it could save itself automagically every time I edit a method, or every time I commit a package?\r\nA: Not so easy... But it's already been done. \r\nBelieve it or not they even have Automatic Saving. but for that you need Firefox with the TiddlyFox https://addons.mozilla.org/ro/firefox/addon/tiddlyfox/ extension installed.\r\nNow when you open your local file with Firefox (+TiddlyFox) you are asked if you want to enable local file saving for this file (it asks for every new file and remembers the ones you already added)\r\nDone. Now Click the “+” sign to add a new Tiddler, edit it, click the checkmark to save it and now the top right corner lights up with a notification. Wiki saved.\r\n\r\n* this is how TiddlyFox the extensions sets up an environment to save the file https://github.com/TiddlyWiki/TiddlyFox/blob/6cf9c9ee6e128a681548529316b3d31a8362fe0d/content/overlay.js#L84\r\n\r\nTo be continued, I will try to summarize all my information with references where possible.\r\nTried to add this issue to add a bounty on https://www.bountysource.com/teams/amber-smalltalk/issues\r\nthinking they were linked somehow, but apparently they aren't. I probably need to be added to the team."},"comment":{"url":"https://api.github.com/repos/amber-smalltalk/amber/issues/comments/88485359","html_url":"https://github.com/amber-smalltalk/amber/issues/1168#issuecomment-88485359","issue_url":"https://api.github.com/repos/amber-smalltalk/amber/issues/1168","id":88485359,"user":{"login":"herby","id":222129,"avatar_url":"https://avatars.githubusercontent.com/u/222129?v=3","gravatar_id":"","url":"https://api.github.com/users/herby","html_url":"https://github.com/herby","followers_url":"https://api.github.com/users/herby/followers","following_url":"https://api.github.com/users/herby/following{/other_user}","gists_url":"https://api.github.com/users/herby/gists{/gist_id}","starred_url":"https://api.github.com/users/herby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/herby/subscriptions","organizations_url":"https://api.github.com/users/herby/orgs","repos_url":"https://api.github.com/users/herby/repos","events_url":"https://api.github.com/users/herby/events{/privacy}","received_events_url":"https://api.github.com/users/herby/received_events","type":"User","site_admin":false},"created_at":"2015-04-01T13:43:03Z","updated_at":"2015-04-01T13:43:03Z","body":"Marking \"won't fix\" as this is not an issue but as you @Basilmir said yourself, a discussion.\r\nOne there will be a clear outcome (like modify transport to do saveFile when file:// is a protocol), put it to issue on its own.\r\n\r\nJust a personal though: too long. no one will read it. remove all the tiddlywiki stuff."}}