Clem-Fern / rtabby-web-api

Tabby Web API for Config Sync
GNU Affero General Public License v3.0
61 stars 4 forks source link

autoSync feature stops working after 1st config upload #19

Closed bc547 closed 8 months ago

bc547 commented 8 months ago

Hi,

I can't get automatic syncing of profiles and connections to work. Only after closing and restarting Tabby, the new config is downloaded and applied only once.

When I open the developer tools window in Tabby, I can see at startup a new config is downloaded and applied, followed by a config upload. This upload is done via a http PATCH request. (See https://github.com/Eugeny/tabby/blob/fc72b4d160f606d06c015f50f1829a9491ae3dd2/tabby-settings/src/services/configSync.service.ts#L101 )

However, rtabby-web-api does not return any data with PATCH request (0 content-length, See https://github.com/Clem-Fern/rtabby-web-api/blob/master/src/routes/config.rs#L99 ) but the Tabby code expects some JSON response with a valid modified_at field. Since there is no result, the variable this.lastRemoteChange becomes an invalid Date (See line 105 of the same file).

The autoSync feature (L185) uses the lastRemoteChange variable to see if a new config must be downloaded and applied. Since the lastRemoteChanged variable is not a valid date after a config upload, the comparison in L189 will never be 'true' and hence the autoSync feature stops working.

I believe a valid fix would be to return with a PATCH request the same result as would be returned with a http GET request to get the config?

Am I the only one with this problem? Or am I missing something?

Thanks in advance

Clem-Fern commented 8 months ago

Hey @bc547

Thank's for the report. I'll try to take a look asap and keep you update.

Clem-Fern commented 8 months ago

Hey @bc547,

This issue should be fixed in the latest release. Build in progress :)