syncthing / syncthing-macos

Official frugal and native macOS Syncthing application bundle
https://syncthing.net
MIT License
2.76k stars 148 forks source link

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

Open ctismer opened 10 months ago

ctismer commented 10 months ago

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 commented 10 months ago

Maybe this helps? https://github.com/syncthing/syncthing-macos/issues/206

ctismer commented 10 months ago

Unfortunately not.

xor-gate commented 10 months ago

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 https://github.com/syncthing/syncthing-macos/issues/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 commented 10 months ago

@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 commented 10 months ago

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!

ctismer commented 10 months ago

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 commented 10 months ago

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 commented 8 months ago

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!!