Giter Site home page Giter Site logo

bluebubblesapp / bluebubbles-server Goto Github PK

View Code? Open in Web Editor NEW
509.0 12.0 42.0 326.75 MB

Server for forwarding iMessages to clients within the BlueBubbles App ecosystem

Home Page: https://bluebubbles.app

License: Apache License 2.0

JavaScript 0.69% TypeScript 99.17% CSS 0.01% HTML 0.14%
imessage nodejs electron typescript bluebubbles server macos

bluebubbles-server's People

Contributors

aksizov avatar bricktheworld avatar cynical89 avatar dependabot[bot] avatar elliotnash avatar foleydiver avatar jpfulton248 avatar keegan-lillo avatar maxwellfortney avatar mrsylerpowers avatar seanreg avatar sushipython avatar tnvu avatar zach-threatq avatar zlshames avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bluebubbles-server's Issues

Add BlueBubbles to MacOS toolbar with options

I want to add the BlueBubbles App to the MacOS toolbar (at the top right). We have icons located in the /icons folder that we can use for it. I want to basically allow the user to do a few things via the dropdown.

  1. Check the number of connected socket devices (i.e "Socket Connections: 2")
  2. Check the number of configured FCM devices (i.e. "Notification Connections: 1")
  3. Open the BlueBubbles App
  4. Restart the BlueBubbles App
  5. Close the BlueBubbles App
  6. Open BlueBubbles configuration page
  7. Display current ngrok address (if enabled)
  8. Display current caffeinate status

Restart server upon ngrok errors

Client Authenticated Successfully
7/24/2020, 1:43:54 PM [LOG] -> Client E1X7d7Nq78zCNU-LAADK disconnected!
7/24/2020, 1:57:18 PM [DEBUG] -> t=2020-07-24T13:57:18-0700 lvl=eror msg="session closed, starting reconnect loop" obj=csess id=431cd9d9a3b1 err="read EOF from remote peer"
7/24/2020, 1:57:18 PM [LOG] -> Ngrok status: closed
7/24/2020, 1:57:18 PM [DEBUG] -> t=2020-07-24T13:57:18-0700 lvl=info msg=start pg=/api/tunnels/112ccbd3-b596-416a-af05-ec7e40da6eea id=7bc0ee55e3140995
7/24/2020, 1:57:18 PM [DEBUG] -> t=2020-07-24T13:57:18-0700 lvl=eror msg="internal error" pg=/api/tunnels/112ccbd3-b596-416a-af05-ec7e40da6eea id=7bc0ee55e3140995 err="remote gone away"
7/24/2020, 1:57:18 PM [DEBUG] -> t=2020-07-24T13:57:18-0700 lvl=info msg=end pg=/api/tunnels/112ccbd3-b596-416a-af05-ec7e40da6eea id=7bc0ee55e3140995 status=500 dur=1.057224ms
7/24/2020, 1:57:18 PM [ERROR] -> Failed to restart ngrok! 500 - "{"error_code":107,"status_code":500,"msg":"internal error","details":{"err":"remote gone away"}}\n"
7/24/2020, 1:57:18 PM [DEBUG] -> t=2020-07-24T13:57:18-0700 lvl=info msg=start pg="/api/tunnels/112ccbd3-b596-416a-af05-ec7e40da6eea (http)" id=531de83760e7e3b2
t=2020-07-24T13:57:18-0700 lvl=eror msg="internal error" pg="/api/tunnels/112ccbd3-b596-416a-af05-ec7e40da6eea (http)" id=531de83760e7e3b2 err="remote gone away"
t=2020-07-24T13:57:18-0700 lvl=info msg=end pg="/api/tunnels/112ccbd3-b596-416a-af05-ec7e40da6eea (http)" id=531de83760e7e3b2 status=500 dur=202.594µs
7/24/2020, 1:57:19 PM [DEBUG] -> t=2020-07-24T13:57:19-0700 lvl=info msg="tunnel session started" obj=tunnels.session
t=2020-07-24T13:57:19-0700 lvl=info msg="client session established" obj=csess id=431cd9d9a3b1
7/24/2020, 1:57:19 PM [LOG] -> Ngrok status: connected

Add ability to enable/disable ngrok

A user may want to use their own port forwarding instead of ngrok. We should allow this as they may feel ngrok is a security concern.
Add a way to disable ngrok via the config page. This should be stored in the server's configuration database and should default to "enabled" ("1" in the DB)

Add MacOS permission helpers

https://www.npmjs.com/package/node-mac-permissions

This can be implemented in 1 of 2 areas:

  • On first boot
  • During the tutorial

The benefit of the first one is hopefully they'll allow permissions before we try to make any DB connections. The benefit of the second one, is it's more of a tutorial "workflow" that gives the user understanding of why we need the access

Sometimes alerts in the UI have no data

For some reason, alerts in the UI sometimes don't have any data (message, type, or date). I'm not entirely sure why this happens, and it's not easy to reproduce.
The main time I've seen this happen is upon initial setup of the app. Possibly when something fails to connect via the setup process due to network issues, full disk access issues, etc

Socket route for getting chats with new messages since a date

In order to move processing off of the clients, we can move processing to the server.

For instance, whenever the app is opened, instead of looping over all the chats and requesting new messages since "x" date, we instead ask the server one time, which chats need to be updated since "x" date. The server will return the chat GUIDs of the chats needing updates. Then the client can ask for messages for only those.

Another alternative would just be to have the client ask for all messages that we're created after x date. This would make the client only to make 1 request. This work would be done on the client side, not the server side.

Both of these solutions would greatly reduce battery and CPU usage on the clients

Revamp Navbar Header

Right now the navbar Header is plain blue with just a title. We should revamp it to look nicer. Maybe add an icon, change the color, add a gradiant?

Automated Builds

We should have a way to create automated builds of the server when there have been updates. This way we don't have to manually build the server and upload it each time we create an update. This automated build process can also probably be leveraged for #18 to help with automated updates.

Ability to manually restart the server

Add in a button to manually restart the server. Not the whole app, just the server's connections to things such as the databases, ngrok, FCM, the listeners, etc. Make sure to close the connections first. This can help with debuggjng.

Embed "caffeinate" into the server to prevent sleeping

Caffeinate is a "app" that is already installed on all MacOS devices. It allows you to keep your mac awake until the command is terminated (the command never returns, I don't think). Many of our users (or at least AirMessage users) use apps such as "Jolt" from the Mac AppStore (or similar) to keep their mac awake at all times. It would be awesome to look into embedding this into the app so the user won't need to download additional 3rd party apps.

Caffeinate Documentation: https://ss64.com/osx/caffeinate.html

In addition to just adding it, I want the user to be able to configure it:

  • By default, caffeinate should not be started
  • We should add a "caffeinate" (i.e. "Keep Mac Awake") checkbox in the configuration page, along with a "current status" text next to it.
  • Checking/Unchecking the box should auto-run or stop the caffeinate command (in real-time)
  • The above point means you'll need to create an IPC endpoint to handle starting the caffeinate process, and also ending it (i.e. "toggle-caffeinate")
  • We'd probably want to also create a boolean in the server code that "monitors" the status of caffeinate
  • The server should send a notification to the UI alerts when the status is changed

Automatic updating

The server should have a way of detecting that there is a new release, and allowing a user to update the app. Currently there is a system in place that detects if there is a new version and directs a user to the github releases page. Maybe we can automate this farther?

Ability to set a custom passphrase

By default, we generate a random guid for authentication via the socket. That GUID is usually transferred via the QR code. However, since not all clients will be able to use the QR code, we want to give users the ability to set their own passphrase and essentially overwrite that default guid.
That passphrase can then be used to connect and authenticate via other clients such as the desktop app
Create a config item in the UI to display the current passphrase (guid), and allow the user to change it

Add update service

Basically, create a service that can check for updates every 6 hours, 12 hours, or 24 hours. The "service" will check the releases page of github, or a specific file in the repo, containing the most recent version. Then ask to update. It will not auto-download or install

Add "High Priority" to fcm messages

Working code, need to add looping through the devices and sending to the devices individually

   async sendNotification(devices: string[], data: any): Promise<admin.messaging.MessagingDevicesResponse> {
        if (!this.refresh()) return null;

        // Build out the notification message
        console.log("data: " + JSON.stringify(data));
        const msg: admin.messaging.DataMessagePayload = { data };
        const options: admin.messaging.MessagingOptions = { priority: 'high' };
        const res = await this.app.messaging().sendToDevice(devices[0], msg, options);
        return res;
    }

Confirm MacOS permissions before starting DB connections/listeners

We weren't able to have a popup to auto allow the use of the iMessage DB, only redirect them to system preferences. We need to improve the workflow of the "1st time opening" the app. Here's what I want to do:

  1. When first opening the app, check for Full Disk Access permissions (using node-mac-permissions)
    • If we have permissions continue setup as normal
    • If we don't have permissions, do not do the setup for the iMessage/Contact DB connections/listeners
  2. When the app is opened, the user will go through a "tutorial". Currently, during that tutorial, it shows the user how to setup accessibility. We should do the following to improve workflow, in the following steps
  3. On the "Permissions" step in the tutorial, add a button called "Open System Preferences" that when clicked, will invoke an IPC (inter-process-communication) call/endpoint (i.e. "open-permissions") that will use the node-mac-permissions module to open system preferences
  4. Create an additional tutorial page to confirm the permissions
    • This page should have 3 buttons and 3 "status" icons/texts. These will allow you to check/confirm your permissions for (Contacts, Full Disk Access, and Accessibility)
    • Clicking each button will invoke an IPC call/endpoint (i.e. "check-permissions"), passing the permission name (string).
    • The IPC endpoint will return the result of whether the permission is allowed or denied.
    • The status icon/text will reflect that result
    • Upon loading the page (i.e. onComponentDidMount), we should check for the permissions of all the ones so we can display the current status of each.
  5. Lastly, once the tutorial is complete (or skipped), we need to add code to the IPC endpoint to run the iMessage/Contacts DB connection and listener

You can reset the tutorial flag in the DB. The config DB (in dev mode) is located here: ~/Library/Application\ Support/Electron/config.db

After adding the new tutorial page, you'll need to add it to the stepper config list: https://github.com/BlueBubblesApp/BlueBubbles-Server/blob/zach/dev/src/renderer/views/Tutorial/index.tsx#L16

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.