Closed faithfulnessalamu closed 3 years ago
Nice tool! I gave it a try and pretty like it, but I'm not sure why this change is needed. Could you let me know what this endpoint gives us?
Also, I'm planning to support the built-in feature for putting the clipboard contents: https://github.com/nakabonne/pbgopy/issues/17
This PR exposes a new endpoint /lastupdated
which returns the timestamp at which the server's cache was last updated. This is required for any program that needs to tell if the server has had new data since the last time they checked. Without this endpoint, the program would have to download all the content from the server everytime just to check if the server has had new data.
The timestamp is saved on the server's cache just like the data and salt, it is updated anytime there's a put to the server.
Thank you, I completely got what the /lastupdated
endpoint does. Just curious about what use case actually needs this endpoint. Please let me know what case you use it in specifically 😃
Oh of course, pbgopy-clip needs to frequently check if there is new data on the server. If there's new data, it makes a GET request and puts it in the local clipboard. The timestamp is actually used for two different things in pbgopy-clip.
That makes sense. Okay, I don't mind merging this in that case.
Awesome, thanks!
This PR is useful to extensions such as pbgopy-clip. Currently, the only way to tell if the server has new data is to compare the content at a time byte by byte with content at another time. This PR exposes a 'lastUpdated' endpoint for programs that want to sync data using pbgopy. It fits into the codebase well enough and has tests passing, but if you need to see it in action, I merged this PR on my pbgopy-diverge branch.