-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Consider solutions to avoid losing data when using tiddlyhost on multiple devices #219
Comments
I think those make sense, but I'd also like to align then with my main use cases
I'd say there's enough value on a simple implementation of detecting changes + alert + manual refresh that it could be it's own pr / issue. Potentially rolling the lock and merges as separate issues. I'd love the merge idea btw, I've been using monkey GTD and I guess most of my cases will probably involve writing in laptop and reading/marking done on phone. |
I have the following work on WebDAV:
If I can find the time I might try to extract this into a more generic plugin, currently it relies on WebDAV for things like the modification date. |
What code is doing the "check every minute"? Something built into TW already, or some custom code? |
Here's some WIP that might improve the current situation:
It does depend on switching from the upload saver to the put saver. @saqimtiaz What do you think about that TW PR? |
Custom code. TW has a concept of syncers for which you can write adaptors - this is what the node.js version of TW uses. I had some code laying around from something else that did what I needed though so I never explored writing an adaptor for the syncer. |
#220 is deployed now to prod. Here's how you can try the new behavior:
|
It's still not a great experience, but perhaps better than overwriting some important changes by accident. For a next step, I'd like to investigate checking for new updates every minute or so, and either notifying the user and suggesting they hit reload, or syncing the updates automatically if it's possible. |
Once TW 5.2.3 is released, we might consider enabling the put saver for all 5.2.3 or newer sites by default. |
Checked, a few quirks but they're welcome so it makes me double sure nothing is lost. I think they're coming because I always tick the "autosave", and ticking it triggers a save even though I guess nothing is saved, but still assuming it will generate a new ETAG. I can't reliably reproduce this, but I feel it's related to opening the tab for 1st time, but won't happen after reload. Worked nice on both (2 tabs on laptop) and (2 tabs on laptop + 1 on phone).
|
I have only come to this Issue today. But I have a working proof on concept, but It will take time to finesse for publishing;
The above could be enhanced by including the username in the browser/device/username cookies (optional password Obscured but stored cookie and/or in wiki) but of course by definition most users will be using a different browser/device. I would like to set a timeout on inactivity that automatically checked the wiki back in and released it. However with a single user, its easy to release from one device when finished. Or say when moving from mobile to desktop or return you most likely have both available.
One advantage of tiddlyhost wikis is they exist at a url and unlike file wikis the cookies can be made unique to that url.
Move to local storage
|
I think there is no need for the server to be involved. There is the https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API which allows us to create a message that is broadcasted, whenever a new tab, window or even an iframe is opened from the same orgin. If a tab is opened with an eg: ID=wiki-1 it broadcasts this info. .. Every other tab which is already open and contains a wiki did already create a "broadcast listener". If it gets an info that a new tab is opened with it's own ID it, sends a message back, that this wiki ID is already open. -- The newly created window / tab can now display a message, that this wiki is already open. I'm using a very similar mechanism with my file-backups plugin. Since it's a browser addON the mechanism is slightly different, but the principle is the same. It works very well for me. This mechanism works with the same browser only. So if 2 different device are involved, that's not possible. |
The solution I'm imagining involves changes to TiddlyWiki to do the following:
I think the amount of code needed would be small, since TiddlyWiki already has functions to do the OPTIONS request and store the etag. So it's probably a small-ish patch to compare old and new values and trigger the alert. It should work across different devices, e.g. phone vs laptop, and it feels a lot simpler than inventing some kind of write permission lock workflow. |
Re "is there a way to upstream it to an existing tiddly", if you enable put saver (in the Tiddlyhost settings for your site) it should work, but you won't get the longer explanation text when the save is refused unless your TiddlyWiki is a 5.2.3-prerelease. Actually in 5.2.2 it says:
Versus this on the 5.2.3 and higher:
|
FYI the put saver mentioned above is now used by default for new sites. I think this issue is a little stale now. Todo: Extract out the viable sugestions from above and file them as separate issues. |
I think that's a good idea. |
I'm curious, how do I upgrade my existing site or clone it in a way that it
supports this feature?
…On Wed, 7 Dec 2022, 21:51 Mario Pietsch, ***@***.***> wrote:
I think this issue is a little stale now. Todo: Extract out the viable
sugestions from above and file them as separate issues.
I think that's a good idea.
—
Reply to this email directly, view it on GitHub
<#219 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABI4Y4OKWVUTUSR6ZRS4MCDWMBT3LANCNFSM5SNLMDMQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
|
Or even multiple tabs.
E.g. https://www.reddit.com/r/TiddlyWiki5/comments/tia329/tiddlyhost_from_multiple_devices/
Ideas:
The text was updated successfully, but these errors were encountered: