BlueBubblesApp / bluebubbles-server

Server for forwarding iMessages to clients within the BlueBubbles App ecosystem
https://bluebubbles.app
Apache License 2.0
540 stars 47 forks source link

Messages and FindMy Apps Popping Up and Down #683

Open JUSTINMKAUFMAN opened 1 month ago

JUSTINMKAUFMAN commented 1 month ago

I am running the server on a Mac Mini with SIP disabled (only using the private-api as far as I can tell) but when new messages come in, the Messages app spontaneously pops into focus and then sometimes the Find My app launches as well.

If the server is performing everything via private api, is there any way to avoid seeing windows flying around (and also, I don't need any of the Find My stuff; in fact that app doesn't do anything for me because I am using a managed Apple ID; is it possible to disconnect that part of the server)?

Thanks for the great work on this project!

mehapps commented 1 month ago

Nope the apps themselves need to be open. You can close the Find My app safely if you don't use any of those features but i asked a while ago and atm not possible to have it not open

JUSTINMKAUFMAN commented 1 month ago

Thanks for the reply. I know the apps need to be open - my question is why they need to keep minimizing and unminimizing on their own. They aren't being quit or anything, just bouncing in and out of the dock.

mehapps commented 1 month ago

If you click on them are they asking for anything?

JUSTINMKAUFMAN commented 1 month ago

Nope.

JUSTINMKAUFMAN commented 1 month ago

After some observation, I believe it is the Share Contact Info request (i.e. /api/v1/chat/{{chatGuid}}/share/contact) that is causing the behavior described above.

And sending a POST body with { "method": "private-api" } doesn't make a difference because (I'm assuming) this method is AppleScript only?

zlshames commented 1 month ago

Thanks for the reply. I know the apps need to be open - my question is why they need to keep minimizing and unminimizing on their own. They aren't being quit or anything, just bouncing in and out of the dock.

It's not possible to minimize an app on macOS programmatically... I know, it seems odd. But that's why they popup, but don't minimize. I can hide them, but that's about it. It's not minimizing it. I'm pretty sure I do hide them after 5 seconds of starting up.

Also, next server version will have a toggle to disable auto-opening FindMy on startup. That said, windows should not be popping up and flying around. They will open once on server startup, and then only re-open if they are closed. If you close them, the server will re-open them.

zlshames commented 1 month ago

After some observation, I believe it is the Share Contact Info request (i.e. /api/v1/chat/{{chatGuid}}/share/contact) that is causing the behavior described above.

And sending a POST body with { "method": "private-api" } doesn't make a difference because (I'm assuming) this method is AppleScript only?

Not sure how this is related at all to be honest. I think it's a red herring, and not actually causing what you're experiencing

JUSTINMKAUFMAN commented 1 month ago

It may be a red herring - I plan to go through the code this afternoon, but until I do all I can offer is what I see on the screen.

Here is a screen recording in which I capture the following:

  1. Send Text -> Works with no undesired window behavior on the server
  2. Share Contact Info -> Window pops up on the desktop for a few seconds and then becomes hidden again

Also, I would say I get a 500 error on the share contact info call roughly 50% of the time.

If you point me to the part of the codebase where the share contact info request is handled, I'm happy to debug further.

Thanks again for making a very cool project!

zlshames commented 1 month ago

Not sure why it happens, but here is the code: https://github.com/BlueBubblesApp/bluebubbles-server/blob/master/packages/server/src/server/api/interfaces/chatInterface.ts#L498-L510

It's mostly just invoking the share function in the private api here: https://github.com/BlueBubblesApp/bluebubbles-helper/blob/master/Messages/MacOS-11%2B/BlueBubblesHelper/BlueBubblesHelper.m#L671-L681

Neither code blocks seem to open anything

JUSTINMKAUFMAN commented 1 month ago

Thanks I'll check it out this afternoon!