### Clone and Install BlueBubbles Server for Development Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/README.md This snippet provides the essential Bash commands to set up the BlueBubbles server for development. It covers cloning the repository, navigating into the project directory, installing all necessary Node.js dependencies using npm, and finally starting the development server. ```Bash git clone git@github.com:BlueBubblesApp/BlueBubbles-Server.git cd BlueBubbles-Server npm install npm run start ``` -------------------------------- ### Clone BlueBubbles-Server Repository Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/CONTRIBUTING.md Instructions for cloning your forked BlueBubbles-Server repository from GitHub using either HTTPS or SSH protocols. ```Git CLI git clone https://github.com/BlueBubblesApp/BlueBubbles-Server.git ``` ```Git CLI git clone git@github.com:BlueBubblesApp/BlueBubbles-Server.git ``` -------------------------------- ### Fetch Latest Changes from Remotes Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/CONTRIBUTING.md Commands to fetch all branches and code from both your origin (forked) and the upstream (main) BlueBubbles-Server repositories, ensuring you have the most current project state. ```Git CLI git fetch ``` ```Git CLI git fetch upstream ``` -------------------------------- ### Stage Changes for Git Commit Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/CONTRIBUTING.md Commands to stage specific files or all modified changes in your working directory, preparing them to be included in the next commit. ```Git CLI git add ``` ```Git CLI git add -A ``` -------------------------------- ### Commit and Push Git Changes Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/CONTRIBUTING.md Commands to finalize your staged changes with a descriptive commit message and then push those committed changes to your forked repository on GitHub. ```Git CLI git commit -m "" ``` ```Git CLI git push origin ``` -------------------------------- ### Create a New Git Branch for Features Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/CONTRIBUTING.md Command to create and immediately switch to a new local branch for your feature development, following a recommended naming convention. ```Git CLI git checkout -b / ``` -------------------------------- ### Pull Latest Changes or Checkout Specific Branch Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/CONTRIBUTING.md Commands to synchronize your local master branch with the upstream master or to switch to a specific branch from the upstream repository to begin work. ```Git CLI git pull upstream master ``` ```Git CLI git checkout upstream ``` -------------------------------- ### Set Upstream Remote for BlueBubbles-Server Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/CONTRIBUTING.md Command to add the main BlueBubbles-Server repository as an 'upstream' remote, which is essential for pulling official changes and keeping your fork up-to-date. ```Git CLI git remote add upstream git@github.com:BlueBubblesApp/BlueBubbles-Server.git ``` -------------------------------- ### BlueBubbles Server Attachment Response Data Structure Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/README.md Defines the structure for attachment objects returned by the BlueBubbles server, including GUID, associated messages, binary data, MIME type, and transfer state. ```typescript export type AttachmentResponse = { guid: string; messages: string[]; data: Uint8Array; uti: string; mimeType: string; transferState: number; totalBytes: number; isOutgoing: boolean; transferName: string; isSticker: boolean; hideAttachment: boolean; }; ``` -------------------------------- ### BlueBubbles Server Directory Map and Component Descriptions Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/README.md This section outlines the core directory structure and provides descriptions for key backend components of the BlueBubbles Server. It details the purpose and responsibilities of various modules, including the main server entry point, type definitions, iMessage database interaction layers, filesystem utilities, and communication services. ```APIDOC Backend Code: /bluebubbles-server/src/ BlueBubbles Server: /bluebubbles-server/src/server/index.ts Description: Main entry point, manages ngrok connection, config database, socket.io, and inter-process communications (IPC) from the renderer (UI). BlueBubbles Types: /bluebubbles-server/src/server/types.ts Description: Holds server types, defining required/optional fields and keys for requests/responses. iMessage Library: /bluebubbles-server/src/server/api/imessage Description: Contains classes and code for communicating with the iMessage Chat database, utilizing TypeORM for object-oriented database access. iMessage Database Models: /bluebubbles-server/src/server/api/imessage/entity Description: Defines entities (database models) for the iMessage Chat database, specifying columns, types, and properties associated with each table. iMessage Database Transformers: /bluebubbles-server/src/server/api/imessage/transformers Description: Converts values automatically when fetching from or inserting into the database, particularly useful for iMessage date conversions (seconds since 2001 vs. EPOCH) and other type mappings (integers to booleans, reaction IDs to strings). iMessage Database Listeners: /bluebubbles-server/src/server/api/imessage/listeners Description: Classes (inheriting JS EventEmitter) that poll the database for new information (e.g., new messages) and emit events to registered listeners. Filesystem Lib: /bluebubbles-server/src/fileSystem Description: Provides utilities for interacting with the macOS filesystem, primarily for reading and writing files within the application's directory. Filesystem Scripts: /bluebubbles-server/src/fileSystem/scripts.ts Description: Stores Apple Scripts executed for specific actions, such as sending messages or creating chats. Server Helpers: /bluebubbles-server/src/helpers Description: Contains helper functions for executing actions initiated by the client or sending results back to the client. Socket Server: /bluebubbles-server/src/services/socket Description: The socket server responsible for handling all incoming requests from connected clients, enabling them to request bulk information like chats or messages. FCM Server: /bluebubbles-server/src/services/fcm Description: Manages all communication with Google Firebase, including device registration with FCM and sending notifications. ``` -------------------------------- ### Configure Web Crawler Access with Robots.txt Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/packages/ui/public/robots.txt This robots.txt file grants full access to all web crawlers by specifying 'Disallow:' with no paths. It uses the 'User-agent: *' directive to apply the rule to all bots, indicating that no content is disallowed for any user-agent. ```Robots.txt User-agent: * Disallow: ``` -------------------------------- ### Verify Daemon Signature using MD5 Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/packages/server/appResources/macos/daemons/ngrok/README.md Executes the `md5` command on a specified daemon executable path to verify its integrity against a pre-calculated MD5 hash. This command outputs the MD5 hash of the file, which can then be compared to the string found in the corresponding `.md5` file. ```Shell md5 /path/to/daemon/executable ``` -------------------------------- ### Verify MD5 Signature of Daemon Executable Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/packages/server/appResources/macos/daemons/cloudflare/README.md This command calculates the MD5 hash of a specified daemon executable. The resulting hash can be compared against a corresponding .md5 file to verify the integrity and authenticity of the daemon. ```Shell md5 /path/to/daemon/executable ``` -------------------------------- ### Verify macOS Bundle MD5 Hash Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/packages/server/appResources/private-api/README.md This command calculates the MD5 hash of the `BlueBubblesHelper.dylib` file within a macOS bundle. This hash can then be compared against the MD5 hash stored in the corresponding `Helper.md5` file to verify the bundle's integrity. Replace `/path/to/private/api/folder` with the actual parent directory of `BlueBubblesHelper.bundle`. ```Shell md5 /path/to/private/api/folder/BlueBubblesHelper.dylib ``` -------------------------------- ### Compute SHA256 Hashes for zrok Executables Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/packages/server/appResources/macos/daemons/zrok/README.md This snippet demonstrates how to compute the SHA256 hashes for the `zrok` executables (x86 and arm64 architectures) included in this project. These hashes are then compared against those of the official `zrok` release executables to ensure integrity and authenticity. ```sh sha256sum x86/zrok sha256sum arm64/zrok ``` -------------------------------- ### BlueBubbles Server Socket Handlers Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/README.md List of available socket.io event handlers on the BlueBubbles server, detailing their purpose for client-server communication and the actions they perform. ```APIDOC Add FCM Device: add-fcm-device Get All Chats (with last message timestamp): get-chats Get Messages from a Chat: get-chat-messages Get Attachment by GUID: get-attachment Get Attachment by Chunk: get-attachment-chunk Get Last Chat Message: get-last-chat-message Send Message: send-message Start a Chat: start-chat ``` -------------------------------- ### Downgrade node-mac-permissions for macOS 10.x Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/README.md This command provides a specific workaround for users running macOS 10.x who encounter build or runtime issues. It manually downgrades the 'node-mac-permissions' dependency to version 2.2.0 within the 'packages/server' directory to resolve compatibility problems on older macOS versions. ```Bash cd packages/server npm install node-mac-permissions@2.2.0 ``` -------------------------------- ### BlueBubbles Server Response Container Format Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/README.md Defines the standard JSON structure for all responses returned by the BlueBubbles server, including status, message, error, and optional data, ensuring consistent client-server communication. ```typescript const ResponseFormat = { status: ValidStatuses; message: ResponseMessages | string; error?: Error; data?: ResponseData; }; ``` -------------------------------- ### BlueBubbles Server Handle Response Data Structure Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/README.md Defines the structure for handle (contact) objects returned by the BlueBubbles server, including associated messages, chats, address, and uncanonicalized ID. ```typescript type HandleResponse = { messages?: MessageResponse[]; chats?: ChatResponse[]; address: string; country: string; uncanonicalizedId: string }; ``` -------------------------------- ### BlueBubbles Server Chat Response Data Structure Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/README.md Defines the structure for chat objects returned by the BlueBubbles server, including participants, associated messages, chat style, identifier, and display name. ```typescript type ChatResponse = { guid: string; participants?: HandleResponse[]; messages?: MessageResponse[]; style: number; chatIdentifier: string; isArchived: boolean; displayName: string; groupId: string; }; ``` -------------------------------- ### BlueBubbles Server Valid Response Statuses Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/README.md Enumerates the HTTP status codes used by the BlueBubbles server to indicate the outcome of an API request, providing clear feedback on success or various error conditions. ```typescript type ValidStatuses = 200 | 201 | 400 | 401 | 403 | 404 | 500; ``` -------------------------------- ### BlueBubbles Server Message Response Data Structure Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/README.md Defines the structure for message objects returned by the BlueBubbles server, including message content, sender, associated chats, attachments, and various timestamps and flags. ```typescript type MessageResponse = { guid: string; text: string; handle?: HandleResponse | null; chats?: ChatResponse[]; attachments?: AttachmentResponse[]; subject: string; country: string; error: boolean; dateCreated: number; dateRead: number | null; dateDelivered: number | null; isFromMe: boolean; isDelayed: boolean; isAutoReply: boolean; isSystemMessage: boolean; isServiceMessage: boolean; isForward: boolean; isArchived: boolean; cacheRoomnames: string | null; isAudioMessage: boolean; datePlayed: number | null; itemType: number; groupTitle: string | null; isExpired: boolean; associatedMessageGuid: string | null; associatedMessageType: number | null; expressiveSendStyleId: string | null; timeExpressiveSendStyleId: number | null; }; ``` -------------------------------- ### BlueBubbles Server Response Messages Enum Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/README.md Defines standard messages used in BlueBubbles server responses to provide human-readable feedback on request outcomes, such as success, bad request, or server errors. ```typescript enum ResponseMessages { SUCCESS = 'Success', BAD_REQUEST = 'Bad Request', SERVER_ERROR = 'Server Error', UNAUTHORIZED = 'Unauthorized', FORBIDDEN = 'Forbidden', NO_DATA = 'No Data' }; ``` -------------------------------- ### BlueBubbles Server Response Data Union Type Source: https://github.com/bluebubblesapp/bluebubbles-server/blob/master/README.md Specifies the union type for the `data` field within BlueBubbles server responses, encompassing various data structures like messages, handles, chats, and attachments, or a Uint8Array for binary data. ```typescript type ResponseData = MessageResponse | HandleResponse | ChatResponse | AttachmentResponse | (MessageResponse | HandleResponse | ChatResponse | AttachmentResponse)[] | Uint8Array | null; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.