Skip to content

Commit

Permalink
Merge pull request #470 from BlueBubblesApp/development
Browse files Browse the repository at this point in the history
v1.5.1
  • Loading branch information
zlshames authored Dec 28, 2022
2 parents 99fbf4b + 00657c3 commit 24b550e
Show file tree
Hide file tree
Showing 32 changed files with 413 additions and 295 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.5.0",
"version": "1.5.1",
"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/appResources/private-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ The `macosXbundle.md5` files within this directory contain a single string that

`find -s /path/to/private/api/folder/BlueBubblesHelper.bundle -type f -exec md5 {} \; | md5`

**GitHub Release Reference**: https://github.com/BlueBubblesApp/BlueBubbles-Server-Helper/releases/tag/0.0.8
**GitHub Release Reference**: https://github.com/BlueBubblesApp/BlueBubbles-Server-Helper/releases/tag/0.0.9

You can also check the current versions of these bundles by opening the `version.txt` file.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.8</string>
<string>0.0.9</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>10</string>
<string>11</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/server/appResources/private-api/macos10bundle.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2100218d61aae765150fcf8227d4565b
175343768ea164dc7ff92d37b4cd8cfc
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.8</string>
<string>0.0.9</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>10</string>
<string>11</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/server/appResources/private-api/macos11bundle.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9045bbf2da2d0a64f685cc796bb3fe35
393f7cf77c6a53cc9ef4a2782503a5b8
2 changes: 1 addition & 1 deletion packages/server/appResources/private-api/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.8
0.0.9
8 changes: 4 additions & 4 deletions packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bluebubbles/server",
"version": "1.5.0",
"version": "1.5.1",
"main": "./dist/main.js",
"license": "Apache-2.0",
"author": {
Expand Down Expand Up @@ -61,7 +61,7 @@
"electron": "17.4.11",
"electron-builder": "^22.9.1",
"electron-notarize": "^1.2.1",
"electron-rebuild": "^3.2.7",
"electron-rebuild": "^3.2.9",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
Expand All @@ -82,7 +82,7 @@
"@firebase/util": "^1.6.3",
"@peculiar/x509": "^1.6.1",
"axios": "^0.25.0",
"better-sqlite3": "^7.5.3",
"better-sqlite3": "^8.0.1",
"blurhash": "^1.1.3",
"byte-base64": "^1.1.0",
"compare-versions": "^3.6.0",
Expand All @@ -104,7 +104,7 @@
"minimist": "^1.2.6",
"ngrok": "^4.3.3",
"node-forge": "^1.3.1",
"node-mac-contacts": "^1.6.0",
"node-mac-contacts": "1.5.0",
"node-mac-permissions": "^2.2.1",
"node-typedstream": "^1.4.0",
"numeral": "^2.0.6",
Expand Down
27 changes: 14 additions & 13 deletions packages/server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { FileSystem } from "@server/fileSystem";
import { Server } from "@server";
import { isEmpty, safeTrim } from "@server/helpers/utils";

app.commandLine.appendSwitch('in-process-gpu');
app.commandLine.appendSwitch("in-process-gpu");

// Patch in original user data directory
app.setPath('userData', app.getPath('userData').replace('@bluebubbles/server', 'bluebubbles-server'));
app.setPath("userData", app.getPath("userData").replace("@bluebubbles/server", "bluebubbles-server"));

let win: BrowserWindow;
let tray: Tray;
Expand Down Expand Up @@ -41,22 +41,23 @@ if (!gotTheLock) {
process.on("uncaughtException", error => {
// Print the exception
Server().log(`Uncaught Exception: ${error.message}`, "error");
if (error?.stack) Server().log(`Uncaught Exception StackTrace: ${error?.stack}`, 'debug');

if (error?.stack) Server().log(`Uncaught Exception StackTrace: ${error?.stack}`, "debug");
});

const handleExit = async (event: any = null) => {
const handleExit = async (event: any = null, { exit = true } = {}) => {
if (event) event.preventDefault();
console.trace('handleExit');
console.trace("handleExit");
if (isHandlingExit) return;
isHandlingExit = true;

// Safely close the services
if (Server() && !Server().isStopping) {
await Server().stopServices();
}

app.exit(0);

if (exit) {
app.exit(0);
}
};

const buildTray = () => {
Expand Down Expand Up @@ -141,8 +142,8 @@ const createTray = () => {
tray.setContextMenu(buildTray());
});
} catch (ex: any) {
Server().log('Failed to load macOS tray entry!', 'error');
Server().log(ex?.message ?? String(ex), 'debug');
Server().log("Failed to load macOS tray entry!", "error");
Server().log(ex?.message ?? String(ex), "debug");
}
};

Expand Down Expand Up @@ -179,7 +180,7 @@ const createWindow = async () => {
// Make links open in the browser
win.webContents.setWindowOpenHandler((details: HandlerDetails) => {
shell.openExternal(details.url);
return { action: 'deny' };
return { action: "deny" };
});

// Hook onto when we load the UI
Expand All @@ -201,7 +202,7 @@ app.on("ready", () => {
});

app.on("activate", () => {
if (win === null) createWindow();
if (win == null) createWindow();
});

app.on("window-all-closed", () => {
Expand All @@ -213,7 +214,7 @@ app.on("window-all-closed", () => {
/**
* Basically, we want to gracefully exist whenever there is a Ctrl + C or other exit command
*/
app.on("before-quit", (event) => handleExit(event));
app.on("before-quit", event => handleExit(event));

/**
* All code below this point has to do with the command-line functionality.
Expand Down
72 changes: 53 additions & 19 deletions packages/server/src/server/api/v1/apple/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ export const hideMessages = () => {
* The AppleScript used to send a message with or without an attachment
*/
export const startMessages = () => {
return startApp('Messages');
return startApp("Messages");
};

/**
* The AppleScript used to send a message with or without an attachment
*/
export const startFindMyFrields = () => {
return startApp('FindMy');
return startApp("FindMy");
};

/**
Expand All @@ -116,14 +116,14 @@ export const showApp = (appName: string) => {
/**
* The AppleScript used to send a message with or without an attachment
*/
export const hideFindMyFriends = () => {
return hideApp('FindMy');
export const hideFindMyFriends = () => {
return hideApp("FindMy");
};

/**
* The AppleScript used to send a message with or without an attachment
*/
export const startApp = (appName: string) => {
export const startApp = (appName: string) => {
return `set appName to "${appName}"
if application appName is running then
return 0
Expand Down Expand Up @@ -252,7 +252,7 @@ export const sendAttachmentAccessibility = (attachmentPath: string, participants
delay 2
end try
${scriptCopy ?? ''}
${scriptCopy ?? ""}
tell application "System Events" to tell application process "Messages"
set frontmost to true
keystroke "n" using {command down}
Expand All @@ -265,7 +265,7 @@ export const sendAttachmentAccessibility = (attachmentPath: string, participants
delay 0.5
key code 51
delay 0.5
${scriptClip ?? ''}
${scriptClip ?? ""}
delay 0.5
keystroke "v" using {command down}
delay 3.0
Expand Down Expand Up @@ -873,27 +873,61 @@ export const checkForIncomingFacetime11 = () => {
if not (exists group 1 of UI element 1 of scroll area 1 of window 1 of application process "NotificationCenter") then
return ""
end if
set notificationGroup to group 1 of UI element 1 of scroll area 1 of window 1 of application process "NotificationCenter"
if (exists static text 1 of notificationGroup) and (value of static text 1 of notificationGroup = "FaceTime") then
set callerName to value of static text 2 of notificationGroup
return callerName
else
set notificationGroup to group 1 of UI element 1 of scroll area 1 of window 1 of application process "NotificationCenter"
try
if (exists static text 1 of notificationGroup) and (exists static text 2 of notificationGroup) and (value of static text 1 of notificationGroup starts with "FaceTime") then
return value of static text 2 of notificationGroup
else
return ""
end if
on error
return ""
end try
end tell`;
};

export const checkForIncomingFacetime13 = () => {
return `tell application "System Events"
if not (exists group 1 of UI element 1 of scroll area 1 of group 1 of window 1 of application process "NotificationCenter") then
return ""
end if
end tell`
set notificationGroup to group 1 of UI element 1 of scroll area 1 of group 1 of window 1 of application process "NotificationCenter"
try
if (exists static text 1 of notificationGroup) and (exists static text 2 of notificationGroup) then
set callType to value of static text 1 of notificationGroup
if not (callType starts with "FaceTime") then
return ""
end if
return value of static text 2 of notificationGroup
end if
on error
return ""
end try
return ""
end tell`;
};

export const checkForIncomingFacetime10 = () => {
return `tell application "System Events"
tell application process "NotificationCenter"
if not (exists static text 2 of window 1) then
return ""
else if (value of static text 1 of window 1 = "FaceTime") then
return value of static text 2 of window 1
else
if not (exists static text 1 of window 1) or not (exists static text 2 of window 1) then
return ""
end if
try
if (value of static text 1 of window 1 starts with "FaceTime") then
return value of static text 2 of window 1
else
return ""
end if
on error
return ""
end try
end tell
end tell`
end tell`;
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Server } from "@server";
import { getContactPermissionStatus } from "@server/utils/PermissionUtils";
import { ContactInterface } from "../interfaces/contactInterface";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ import { isNotEmpty } from "@server/helpers/utils";
import { Attachment } from "../entity/Attachment";
import { handledImageMimes } from "./constants";

export const getCacheName = (message: Message) => {
const delivered = message.dateDelivered ? message.dateDelivered.getTime() : 0;
const read = message.dateRead ? message.dateRead.getTime() : 0;
return `${message.guid}:${delivered}:${read}`;
};

export const convertAudio = async (
attachment: Attachment,
{ originalMimeType = null }: { originalMimeType?: string } = {}
Expand Down
Loading

0 comments on commit 24b550e

Please sign in to comment.