Skip to content

Commit

Permalink
Merge pull request #413 from BlueBubblesApp/development
Browse files Browse the repository at this point in the history
v1.2.3
  • Loading branch information
zlshames authored Aug 28, 2022
2 parents 78cf998 + 1b97229 commit 4b2ca0e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bluebubbles-server",
"version": "1.2.2",
"version": "1.2.3",
"description": "BlueBubbles Server is the app that powers the BlueBubbles app ecosystem",
"private": true,
"workspaces": [
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bluebubbles/server",
"version": "1.2.2",
"version": "1.2.3",
"main": "./dist/main.js",
"license": "Apache-2.0",
"author": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ export class ChatInterface {
}

const chat = chats[0];
chat.messages = [sentMessage];
if (sentMessage) {
chat.messages = [sentMessage];
}

return chat;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ export class OutgoingMessageListener extends ChangeListener {

// Reject the corresponding promise.
// This will emit a message send error
const success = Server().messageManager.reject("message-send-error", entry);
Server().log(
`Errored Msg -> ${cacheName} -> ${(entry.text ?? "").substring(0, 25)} -> ${success}`,
const success = await Server().messageManager.reject("message-send-error", entry);
Server().log(`Errored Msg -> ${cacheName} -> ${entry.contentString()} -> ${success} (Code: ${entry.error})`,
"debug"
);

Expand Down
24 changes: 20 additions & 4 deletions packages/server/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,24 @@ class BlueBubblesServer extends EventEmitter {
region: string | null;

get hasDiskAccess(): boolean {
const status = getAuthStatus("full-disk-access");
return status === "authorized";
// As long as we've tried to initialize the DB, we know if we do/do not have access.
const dbInit: boolean | null = this.iMessageRepo?.db?.isInitialized;
if (dbInit != null) return dbInit;

// If we've never initialized the DB, and just want to detect if we have access,
// we can check the permissions using node-mac-permissions. However, default to true,
// if the macOS version is under Mojave.
let status = true;
if (isMinMojave) {
const authStatus = getAuthStatus("full-disk-access");
if (authStatus === 'authorized') {
status = true;
} else {
this.log(`FullDiskAccess Permission Status: ${authStatus}`, 'debug');
}
}

return status;
}

get hasAccessibilityAccess(): boolean {
Expand Down Expand Up @@ -658,7 +674,7 @@ class BlueBubblesServer extends EventEmitter {
}

// Log if we dont have accessibility access
if (this.iMessageRepo?.db) {
if (this.hasDiskAccess) {
this.log("Full-disk access permissions are enabled");
} else {
this.log("Full-disk access permissions are required!", "error");
Expand Down Expand Up @@ -965,7 +981,7 @@ class BlueBubblesServer extends EventEmitter {
* we will emit a message to the socket, as well as the FCM server
*/
private startChatListeners() {
if (!this.iMessageRepo?.db) {
if (!this.hasDiskAccess) {
AlertsInterface.create(
"info",
"Restart the app once 'Full Disk Access' and 'Accessibility' permissions are enabled"
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bluebubbles/ui",
"version": "1.2.2",
"version": "1.2.3",
"homepage": "./",
"license": "Apache-2.0",
"scripts": {
Expand Down

0 comments on commit 4b2ca0e

Please sign in to comment.