hplush / slowreader

Web app to combine feeds from social networks and RSS and to help read more meaningful and deep content
https://dev.slowreader.app
GNU Affero General Public License v3.0
161 stars 37 forks source link

Add subprotocol check to the client #245

Open ai opened 2 months ago

ai commented 2 months ago

User may use old client. We need to handle this case and instead of server error (because of old protocol) show the proper message to update client.

To do it we use “Subprotocol”, client-server API version. We use it in Logux. Logux clients send their version in all actions. Logux Server has a range of supported versions.

We need to add the same logic to HTTP API:

  1. Add X-Subprotocol header to fetchJSON() helper
  2. See Logux Server code to find our how to check supported range.
  3. Add this check to jsonApi() and respond a proper error message on it.
  4. Add a Update client route to the core/ router. You may need boolean store and add logic to compute in the router.
  5. Add a Update client to the web client with simple design. See How create a page.
  6. Add code to the core to set that boolean store to true in case of Logux error or fetchJSON error, which ask to update the client.