Skip to content

Commit

Permalink
Merge pull request #402 from BlueBubblesApp/development
Browse files Browse the repository at this point in the history
v1.2.0
  • Loading branch information
zlshames authored Aug 26, 2022
2 parents 1e610ed + 8bf75fd commit 3c2bb10
Show file tree
Hide file tree
Showing 81 changed files with 136,090 additions and 938 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ release/
.DS_Store
**/*.log
.env
.build
.swiftpm
.yarn
.yarnrc*
.yarnrc*
57,908 changes: 57,908 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bluebubbles-server",
"version": "1.1.3",
"version": "1.2.0",
"description": "BlueBubbles Server is the app that powers the BlueBubbles app ecosystem",
"private": true,
"workspaces": [
Expand All @@ -20,8 +20,8 @@
},
"homepage": "https://www.bluebubbles.app",
"devEngines": {
"node": "17.x",
"npm": ">=7.x",
"node": "18.x",
"npm": ">=8.x",
"yarn": ">=1.x"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/server/appResources/macos/daemons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ The `.md5` files within this directory contain a single string that is correlate

This is the official cloudflare daemon, downloaded from: https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-darwin-amd64.tgz

The dummy `cloufldared-config.yml` file is for the daemon to use as to not interfere with the default system configuration
The dummy `cloudflared-config.yml` file is for the daemon to use as to not interfere with the default system configuration
Empty file.
Binary file modified packages/server/appResources/macos/daemons/cloudflared
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
protocol: quic
no-autoupdate: true
2 changes: 1 addition & 1 deletion packages/server/appResources/macos/daemons/cloudflared.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8e92f21d0764b53cb95f94611a513868
103dce48075ee6127391f9e98ec81613
Binary file added packages/server/appResources/swiftHelper
Binary file not shown.
30,317 changes: 30,317 additions & 0 deletions packages/server/package-lock.json

Large diffs are not rendered by default.

83 changes: 13 additions & 70 deletions packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bluebubbles/server",
"version": "1.1.3",
"version": "1.2.0",
"main": "./dist/main.js",
"license": "Apache-2.0",
"author": {
Expand All @@ -9,11 +9,12 @@
},
"description": "BlueBubbles Server is the app that powers the BlueBubbles app ecosystem",
"scripts": {
"build": "export NODE_ENV=production && webpack --config ./scripts/webpack.main.prod.config.js",
"start": "export NODE_ENV=development && webpack --config ./scripts/webpack.main.config.js && electron ./dist/main.js",
"build-objc": "cd ./src/objcHelper && clang -mmacosx-version-min=10.11 -framework Foundation bluebubbles_objc_helper.m -o ../../appResources/bluebubblesObjcHelper && cd ../../",
"build": "export NODE_ENV=production && npm run build-objc && webpack --config ./scripts/webpack.main.prod.config.js",
"start": "export NODE_ENV=development && npm run build-objc && webpack --config ./scripts/webpack.main.config.js && electron ./dist/main.js",
"lint": "eslint --ext=jsx,js,tsx,ts src",
"dist": "npm run build && electron-builder build --mac --publish never",
"postinstall": "electron-builder install-app-deps"
"dist": "electron-rebuild -f -o better-sqlite3 && npm run build && electron-builder build --mac --publish never --config ./scripts/electron-builder-config.js",
"postinstall": "electron-rebuild install-app-deps"
},
"husky": {
"hooks": {
Expand All @@ -29,64 +30,6 @@
"eslint --ext=jsx,js,ts,tsx --fix src"
]
},
"build": {
"productName": "BlueBubbles",
"appId": "com.BlueBubbles.BlueBubbles-Server",
"directories": {
"output": "release",
"buildResources": "appResources"
},
"files": [
"dist/",
"node_modules/",
"appResources/",
"package.json"
],
"asar": true,
"asarUnpack": [
"**/node_modules/ngrok/bin/**"
],
"extraResources": [
"**/appResources/**"
],
"mac": {
"category": "public.app-category.social-networking",
"publish": [
{
"provider": "github",
"repo": "bluebubbles-server",
"owner": "BlueBubblesApp",
"private": false,
"channel": "latest",
"releaseType": "release"
}
],
"target": [
{
"target": "dmg"
},
{
"target": "zip"
}
],
"type": "distribution",
"icon": "../../icons/regular/icon-512.png",
"darkModeSupport": true,
"hardenedRuntime": true,
"entitlements": "./scripts/entitlements.mac.plist",
"entitlementsInherit": "./scripts/entitlements.mac.plist",
"extendInfo": {
"NSContactsUsageDescription": "BlueBubbles needs access to your Contacts",
"NSAppleEventsUsageDescription": "BlueBubbles needs access to run AppleScripts"
},
"gatekeeperAssess": false,
"minimumSystemVersion": "10.11.6"
},
"dmg": {
"sign": false
},
"afterSign": "./scripts/notarize.js"
},
"devDependencies": {
"@babel/core": "^7.16.12",
"@babel/plugin-proposal-class-properties": "^7.12.1",
Expand Down Expand Up @@ -116,9 +59,10 @@
"@typescript-eslint/parser": "^5.18.0",
"babel-loader": "^8.1.0",
"css-loader": "^3.5.2",
"electron": "17.4.5",
"electron": "17.4.11",
"electron-builder": "^22.9.1",
"electron-notarize": "^1.0.0",
"electron-rebuild": "^3.2.7",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
Expand All @@ -135,10 +79,8 @@
"webpack-node-externals": "^3.0.0"
},
"dependencies": {
"@firebase/app-compat": "^0.1.16",
"@firebase/app-types": "^0.7.0",
"@firebase/auth-interop-types": "^0.1.6",
"@firebase/util": "^1.5.1",
"@firebase/util": "^1.6.3",
"@peculiar/x509": "^1.6.1",
"axios": "^0.25.0",
"better-sqlite3": "^7.5.3",
Expand All @@ -148,9 +90,9 @@
"conditional-decorator": "^0.1.7",
"crypto-js": "^4.0.0",
"electron-log": "^4.4.7",
"electron-updater": "^4.3.5",
"electron-updater": "^4.5.2",
"find-process": "^1.4.4",
"firebase-admin": "^10.0.2",
"firebase-admin": "^11.0.1",
"google-libphonenumber": "^3.2.10",
"koa": "^2.13.1",
"koa-body": "^4.2.0",
Expand All @@ -163,7 +105,8 @@
"minimist": "^1.2.6",
"ngrok": "^4.3.1",
"node-forge": "^1.3.1",
"node-mac-contacts": "^1.4.0",
"node-mac-contacts": "^1.6.0",
"node-mac-permissions": "^2.2.1",
"numeral": "^2.0.6",
"plist": "^3.0.4",
"read-chunk": "^3.2.0",
Expand Down
63 changes: 63 additions & 0 deletions packages/server/scripts/electron-builder-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// NOTE: All paths are relative to the package.json that will be loading this configuration file.
// Making them relative to the scripts folder will break the commands
module.exports = {
"productName": "BlueBubbles",
"appId": "com.BlueBubbles.BlueBubbles-Server",
"npmRebuild": false,
"directories": {
"output": "release",
"buildResources": "appResources"
},
"files": [
"dist/",
"node_modules/",
"appResources/",
"package.json"
],
"asar": true,
"asarUnpack": [
"**/node_modules/ngrok/bin/**"
],
"extraResources": [
"**/appResources/**"
],
"mac": {
"category": "public.app-category.social-networking",
"publish": [
{
"provider": "github",
"repo": "bluebubbles-server",
"owner": "BlueBubblesApp",
"private": false,
"channel": "latest",
"releaseType": "release"
}
],
"target": [
{
"target": "default",
"arch": [
'x64',
// 'arm64'
]
}
],
"type": "distribution",
"icon": "../../icons/regular/icon-512.png",
"darkModeSupport": true,
"hardenedRuntime": true,
"entitlements": "./scripts/entitlements.mac.plist",
"entitlementsInherit": "./scripts/entitlements.mac.plist",
"extendInfo": {
"NSContactsUsageDescription": "BlueBubbles needs access to your Contacts",
"NSAppleEventsUsageDescription": "BlueBubbles needs access to run AppleScripts",
"NSSystemAdministrationUsageDescription": "BlueBubbles needs access to manage your system",
},
"gatekeeperAssess": false,
"minimumSystemVersion": "10.11.6"
},
"dmg": {
"sign": false
},
"afterSign": "./scripts/notarize.js"
};
28 changes: 19 additions & 9 deletions packages/server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ app.setPath('userData', app.getPath('userData').replace('@bluebubbles/server', '

let win: BrowserWindow;
let tray: Tray;
let isHandlingExit = false;

// Instantiate the server
Server(win);
Expand All @@ -20,7 +21,7 @@ Server(win);
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
console.error("BlueBubbles is already running! Quiting...");
app.quit();
app.exit(0);
} else {
app.on("second-instance", (_, __, ___) => {
if (win) {
Expand All @@ -36,15 +37,27 @@ if (!gotTheLock) {
}

process.on("uncaughtException", error => {
// These are typically errors from the Swift Helper
if (error?.message === 'write EPIPE') return;

// Print the exception
Server().log(`Uncaught Exception: ${error.message}`, "error");
if (error?.stack) Server().log(`Uncaught Exception StackTrace: ${error?.stack}`, 'debug');

});

const handleExit = async () => {
if (!Server() || Server().isStopping) return;
await Server().stopServices();
app.quit();
const handleExit = async (event: any = null) => {
if (event) event.preventDefault();
console.trace('handleExit');
if (isHandlingExit) return;
isHandlingExit = true;

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

app.exit(0);
};

const buildTray = () => {
Expand Down Expand Up @@ -199,12 +212,9 @@ app.on("window-all-closed", () => {
});

/**
* I'm not totally sure this will work because of the way electron is... but, I'm going to try.
* Basically, we want to gracefully exist whenever there is a Ctrl + C or other exit command
*/
app.on("before-quit", () => handleExit());
app.on("will-quit", () => handleExit());
process.on("SIGINT", () => handleExit());
app.on("before-quit", (event) => handleExit(event));

/**
* All code below this point has to do with the command-line functionality.
Expand Down
Loading

0 comments on commit 3c2bb10

Please sign in to comment.