On Wednesday, September 2, 2020 at 12:54:23 PM UTC-7, Jan wrote:
>
> this is what I know I should always do. But I am human and want a 
> machine-solution against forgetting to do this...
>

In theory, you could modify the store.php script so that when sending the 
current TW contents to store.php, you also send the document.lastModified 
value.  Then, store.php could compare that value against the date of the 
hosted version of the file to ensure that the date on the server is not 
more recent than the date sent from the currently loaded document.  If it 
is more recent, it could reject the save and return an error.  Then, to 
resolve the problem, you would export the changed tiddlers from the TW in 
the browser (saving the export file locally), and then reload from the 
server, and then import the changes to merge them.  Then save to the server 
again.

I say "in theory" because I don't have access to the version of store.php 
that you are using, and I also don't have a server on which to test the 
changes.

Some possible issues:
* the document.lastModified value is only valid if you loaded the document 
via http or https protocol.  If you are working from a local file copy, 
that value will be the current date/time, regardless of when the file was 
actually saved.
* WebKit returns the time string in UTC; Gecko and Internet Explorer return 
a time in the local timezone.  Thus, you might have to install the "Browser 
Sniff" plugin (from the TW Official Plugin Library) in order to detect 
which browser is in use, and then do some conversion to match the time in 
use on the server (which might also be either UTC or local time)

see https://developer.mozilla.org/en-US/docs/Web/API/Document/lastModified

-e

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/de9eb3b1-b8d4-49e9-840c-966c17bc03feo%40googlegroups.com.

Reply via email to