Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApiKey defaults not in sync with config.xml, autodetect and notify user #210

Open
ctismer opened this issue Jan 2, 2024 · 9 comments
Open

Comments

@ctismer
Copy link

ctismer commented Jan 2, 2024

Autostart Syncthing works great on my three other macOS machines.
Now I bought a new MBP M3, which uses macOS Sonoma, forcibly.

I always get the Syncthing icon with exclamation mark, and it says "Running (offline)"
and the API entry is colored red. Syncing works fine, it is just the amenity of the bundle
that is not working.

Assuming something unexpected was changed in Sonoma...

@deeplook
Copy link

deeplook commented Jan 2, 2024

Maybe this helps? #206

@ctismer
Copy link
Author

ctismer commented Jan 2, 2024

Unfortunately not.

@xor-gate
Copy link
Member

xor-gate commented Jan 2, 2024

This means the tray application is unable to communicate with the Syncthing process. I run Sonoma now myself on one machine and have no problems. There is at least one issue with the API key synchronisation between Syncthing and the Syncthing macOS tray application. See #183.

I have thought about issue #183. But it should repair itself when the API key has changed between the Syncthing macOS default variable store and the Syncthing configuration XML file. I think to manually fix it is as follows (for now):

  1. Stop Syncthing
  2. Open a Terminal
  3. Run cat ~/Library/Application\ Support/Syncthing/config.xml | grep api
  4. Copy the API key
  5. Run defaults write com.github.xor-gate.syncthing-macosx ApiKey "<copied API key>"
  6. Start Syncthing

@ctismer
Copy link
Author

ctismer commented Jan 2, 2024

@xor-gate Oh whow, you are really the guru! Thanks so much, how wonderful. 🎉 🎁

I run Sonoma now myself on one machine and have no problems.

Maybe you did it like I did it first: By cloning an older machine to Sonoma. This works.
But then I erased syncthing and installed it anew, and that gave the problem.

@xor-gate
Copy link
Member

xor-gate commented Jan 3, 2024

I'm considering all flows why this did go wrong at your side, but i'm out of ideas. But indeed I have created a backup of ~/Library/Application Support/Syncthing and copied it back on a fresh install. What Syncthing macOS does it read the config.xml when ApiKey default key-value is not present (first start). But afterwards it doesn't touch the ApiKey anymore. I think it would be good if Syncthing macOS detects a difference in ApiKey macOS defaults value and the XML file it can notify the user if an update is necessary. This is more intuitive than doing the steps I given you ;-). I will leave this issue open, it should be a quick fix.

Luckily it is working for you now without problems!

@xor-gate xor-gate changed the title Autostart on Sonoma not working ApiKey defaults not in sync with config.xml, autodetect and notify user Jan 3, 2024
@ctismer
Copy link
Author

ctismer commented Jan 3, 2024

Would be interesting to know why this happens. Sonoma is also for other reasons a PITA: My PySide builds do not work, and I have to play tricks to install Command Line Tools 14. I would love to downgrade, but Sonoma on the M3 MBP refuses that.

@xor-gate
Copy link
Member

I'm also cross referencing to the forum as it is related: https://forum.syncthing.net/t/macos-can-t-find-out-what-notification-is-or-what-caused-it

@aleksfadini
Copy link

This means the tray application is unable to communicate with the Syncthing process. I run Sonoma now myself on one machine and have no problems. There is at least one issue with the API key synchronisation between Syncthing and the Syncthing macOS tray application. See #183.

I have thought about issue #183. But it should repair itself when the API key has changed between the Syncthing macOS default variable store and the Syncthing configuration XML file. I think to manually fix it is as follows (for now):

  1. Stop Syncthing
  2. Open a Terminal
  3. Run cat ~/Library/Application\ Support/Syncthing/config.xml | grep api
  4. Copy the API key
  5. Run defaults write com.github.xor-gate.syncthing-macosx ApiKey "<copied API key>"
  6. Start Syncthing

I cloned an old machine to a new machine (in Sonoma) and was getting the error. Tried to delete local files, remove app, reinstalled, nothing worked. Following the steps above solved everything. Thank you!!

@FredMaher
Copy link

FredMaher commented Dec 4, 2024

I just had the same issue, but I'm afraid I don't have a nice documentable / reproducible solution.
I only have anicdotal experience.

After seeing several suggestions what seemed to fix it was copying the API KEY from the web UI (Actions>Settings>General), pasting it into the Syncthing app in the menu bar>preferences, hitting ENTER, quitting Syncthing, restarting the computer and launching Syncthing.
I don't have "start at login" selected, but I doubt that has anything to do with it.

Of note is the fact that when things are working the API KEY matches in the Menu Bar Prefs, the web UI and the config.xml file located at /Users/username/Library/Application Support/Syncthing/config.xml

Finally, one thing I may have done in my fury was click the Generate button in the Actions>Settings>General> at some point. So, maybe Generate new key>Copy it>Paste it into menu bar>preferences, hit enter, quit Syncthing (not stop, quit) & restart the computer.

Screenshot 2024-12-04 at 10 36 18 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants