tomboy.osx icon indicating copy to clipboard operation
tomboy.osx copied to clipboard

Correctly generate sync server API url

Open cweiske opened this issue 10 years ago • 5 comments

tomboy.osx uses the given sync server URL, adds api/1.0 and sends a request to that location:

tomboy-library/Tomboy-library/Tomboy/Sync/WebSync/OAuth/OAuthConnection.cs
91:         apiRoot = rest_client.Get<ApiResponse> (rootUrl+ "api/1.0/");

All other clients at least add a slash between the root URL and api, so that URLs like http://example.org/sync get an API URL of http://example.org/sync/api/1.0/. Some other clients do not work when giving the root url without slash.

Currently I would have to give users two instructions in grauphel: One URL that works with tomboy.osx, and one that works with all other clients.

Please make the API URL generation a bit smarter by adding a / after rootUrl if it does not end with one.

So that the user can input an URL with or without a slash, and tomboy.osx automatically does the right thing:

  • http://example.org/sync -> http://example.org/sync/api/1.0/
  • http://example.org/sync/ -> http://example.org/sync/api/1.0/

cweiske avatar Nov 14 '14 06:11 cweiske

There are two places that build the URL, and both are doing it differently:

  • Tomboy-library/Tomboy/Sync/WebSync/WebSyncServer.cs:
    • rootApiUrl = serverUrl + "/api/1.0"
  • Tomboy-library/Tomboy/Sync/WebSync/OAuth/OAuthConnection.cs:
    • apiRoot = rest_client.Get<ApiResponse> (rootUrl+ "api/1.0/");

cweiske avatar Nov 24 '14 22:11 cweiske

I think the best way would be to add a slash at the end of the serverUrl if it does not have one, and then always only add api/1.0 without a leading slash.

cweiske avatar Nov 24 '14 22:11 cweiske

that shouldn't be too hard.​

trepidity avatar Nov 25 '14 04:11 trepidity

@trepidity - You made the changes for this and pushed out a packaged file. Can you push the changes to the repository? Thanks

rashoodkhan avatar Dec 10 '14 06:12 rashoodkhan

Hi, is this issue resolved? Sync to grauphel does not work for me too. Probably the root is this issue. Tomboy.osx running on mac os 10.11.1.

zsoltbarat avatar Oct 26 '15 10:10 zsoltbarat