New: ContinousSavingPlugin, a new native saver

133 views
Skip to first unread message

Yakov

unread,
Feb 4, 2024, 3:09:27 AM2/4/24
to TiddlyWikiClassic
Hi everyone,

today I'd like to share the first release of ContinousSavingPlugin, which makes saving and loading closer to the good old days :)

Unlike download saving, it allows to save like this:
  1. on the first saving attempt, it asks to pick the file (the TW itself);
  2. it then asks to confirm the write file access;
  3. then it saves, and during the session (until the tab or the browser is reloaded) it saves without further further interactions.
It also allows to do loading and saving of other files, so you can presumably use it with things like SnapshotPlugin or TiddlerInFilePlugin, but I haven't tested this yet (it may require updating some of such plugins as it uses an asynchronous loading and saving).

There are some limitations and things to know, though:
  • it works only with TW 2.10.0 or above;
  • it forces async loading and saving;
  • currently, it only works in desktop Chromium-based and Edge browsers: the technology is still experimental, and I've included the link to the up-to-date browsers support docs into the Browsers slice;
  • the current core doesn't allow to make the saver more humble (I will probably improve this later): if you use it in a browser that supports it, saveMain will use the new saver, even if your dedicated saver works more smoothly (so you can't use it to save only other files, like snapshots, yet). It also can be problematic to use with SharedTiddlersPlugin (picking each included file), but loading only falls back to the new loader if other methods fail;
  • generally, it requires a confirmation per file, so saving a backup will require a pick per backup.
Let me know what you think. I'm considering including this functionality into the core later.

Best regards,
Yakov.

Jon

unread,
Feb 5, 2024, 3:07:10 PM2/5/24
to TiddlyWikiClassic
Thank you, Yakov, this is a big step forward.

This is especially valuable IMHO because it's the first mechanism we've had in a VERY long time to support the original TW concept of a truly one-file solution, where I could send a TW to someone and the recipient could simply open it in the browser and use it without having to install something (e.g., Timimi or the old TiddlyFox, etc.).

In my hands, it works on the current version of Chrome for Windows exactly as you describe, asking for the file once per session. After the minor annoyance of picking the file once, saving and autosaving are smooth. This makes it pretty comfortable to use a TW like in the "good old days." I've for some reason never been able to get Timimi to work with Chrome on my work computer, so now I have new flexibility to use TWs in Chrome.

I'm assuming that the pick-file-and-confirm mechanism is imposed by the browser framework. I'd say the one thing that's annoying about that is that a re-load resets everything and you have to pick and confirm again. So, works great for using a TW but not as great for developing when you have to frequently re-load to test changes to a plugin.

I hope you can make this work for Firefox at some point!

Thanks,
Jon

Yakov

unread,
Feb 6, 2024, 5:10:18 AM2/6/24
to TiddlyWikiClassic
Hi Jon,

Timimi never worked for TWC in Chrome (only TWC in FF and TW5 in FF/Chrome), I've implemented support of TWC for Chrome and it was even merged, but Rizwan has told me in an email that Chrome Store has refused the update as it considered not tight enough in terms of security. I can create an instruction on how to install that using the dev mode in Chrome extensions, but there are some other issues about Timimi/Timimi in Chrome ("contamination", "false positive reports"), so it still requires some work. May be I'll introduce event-based saving into TW at some point (which will "secure enough" for the Chrome Store, I think), which is now one step closer thanks to async saving support. But yeah, the whole Timimi business is somewhat complicated.

As for the Firefox support, unfortunately, it's up to the browser developers (the used showOpenFilePicker API is not even a part of the standard, it's an experimental feature introduced by Google), and it seems that one shouldn't rely on them: this comment (09.2022) indicates that Firefox won't probably do that and it's not clear if Safari will (see the references inside). That is despite the fact that some popular tools (like draw.io) also use this API.

But Firefox users are probably more used to extensions, so Timimi may be an acceptable solution. Hm, we should probably update the download saving flow to make it somehow suggest the other savers (like GettingStarted does now). Or add this to the core.

> not as great for developing when you have to frequently re-load to test changes to a plugin

That's actually solvable from another end: we can have dev environment that doesn't require reloading (but that also requires writing plugins in a more specific fashion, to avoid double-decoration and infinite loops). Okido has already shared his toolbox that allows avoid reloading; I'm using my own CookTiddlerPlugin which I haven't released yet (if you're interested, I can pre-release it with some docs drafts).

Best regards,
Yakov.

понедельник, 5 февраля 2024 г. в 23:07:10 UTC+3, Jon:

sam paul

unread,
Oct 7, 2024, 8:47:04 AM10/7/24
to TiddlyWikiClassic
Hello Yakov. 

Will saving the TiddlyWiki from the browser lead to it being contaminated by the browser extension you installed? I am worried about this so I always use the tiddlydesktop.(However, this app seems to consume too much RAM. That's another topic.)

Best

Yakov

unread,
Oct 14, 2024, 5:51:13 AM10/14/24
to TiddlyWikiClassic
Hello Sam,

what can contaminate TW on saving is a saver that doesn't support loadOriginal and yet makes TW does its original updating (you can read some details here), but CSP supports loadOriginal and more, so this won't be a problem with CSP.

Best regards,
Yakov.

понедельник, 7 октября 2024 г. в 15:47:04 UTC+3, samp...@gmail.com:

sam paul

unread,
Nov 5, 2024, 11:47:12 AM11/5/24
to TiddlyWikiClassic
Still confused about it. When I use the default save function in TWC (latest) on firefox tls (ubuntu 24 tls), the selenium ide browser extension will inject a line 'moz
-extension xxxx' to the downloaded html. Will this happen when using CSP plugin?

sam paul

unread,
Nov 13, 2024, 8:27:31 AM11/13/24
to TiddlyWikiClassic
Hello Yakov. It works great for me. Is this plugin able to save the backup and rss file to the same directory of the html file just like tiddlywiki desktop does?

Best wishes.

Yakov

unread,
Nov 14, 2024, 2:15:33 AM11/14/24
to TiddlyWikiClassic
Hello Sam,

that's a great question. I believe no, the current core should be updated to make them work with CSP (and other async saving implementations).

For now, I've prepared a workaround for you: try this as a separate plugin, it should make saving backups and RSS work with CSP (I think these changes should be added to the core, but we need to test them a bit). Note, however, that the general CSP limitation applies here: for each new file per session, you'll need to pick the path manually, meaning 1 per RSS (some.xml) and 1 per backup (you may want to set different backup filenames during one session, although I don't think that's a frequent scenario).

The plugin below is installed as usual (copy-paste, tag systemConfig, reload) and only amends saveRss and saveBackup to make them try async saving (which CSP implements).

Best regards,
Yakov.

//{{{
saveRss = function(localPath) {
var rssPath = localPath.substr(0, localPath.lastIndexOf(".")) + ".xml";
tw.io.saveFile(rssPath, generateRss(), function(result, details) {
if(result)
displayMessage(config.messages.rssSaved, "file://" + rssPath);
else
alert(config.messages.rssFailed);
});
}

saveBackup = function(localPath, original) {
var backupPath = getBackupPath(localPath);
var reportResult = function(success) {
if(backupSuccess)
displayMessage(config.messages.backupSaved, "file://" + backupPath);
else
alert(config.messages.backupFailed);
};

if(copyFile(backupPath, localPath)) {
reportResult(true);
return;
}
tw.io.saveFile(backupPath, original, reportResult);
}
//}}}

среда, 13 ноября 2024 г. в 16:27:31 UTC+3, samp...@gmail.com:

Yakov

unread,
Nov 14, 2024, 3:15:59 AM11/14/24
to TiddlyWikiClassic
PS
> When I use the default save function in TWC (latest) on firefox tls (ubuntu 24 tls), the selenium ide browser extension will inject a line 'moz
-extension xxxx' to the downloaded html. Will this happen when using CSP plugin?

I believe no (I only expect problems like that with savers that don't support loading of the TW file, known as "loading original", and CSP does support that)

четверг, 14 ноября 2024 г. в 10:15:33 UTC+3, Yakov:
Reply all
Reply to author
Forward
0 new messages