Skip to content

Commit

Permalink
Merge pull request #664 from BlueBubblesApp/development
Browse files Browse the repository at this point in the history
v1.9.8 Continued
  • Loading branch information
zlshames authored Jul 9, 2024
2 parents 8621aa5 + 1720a20 commit 13e36c8
Show file tree
Hide file tree
Showing 14 changed files with 464 additions and 306 deletions.
172 changes: 6 additions & 166 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ node_modules/
!dist/
dist/*
!dist/dev-app-update.yml
release/
releases/
.vscode
.DS_Store
**/*.log
Expand Down
3 changes: 1 addition & 2 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@
"typeorm": "^0.3.20",
"uuid": "^9.0.1",
"validatorjs": "^3.22.1",
"vcf": "^2.1.1",
"zx": "^4.3.0"
"vcf": "^2.1.1"
}
}
9 changes: 9 additions & 0 deletions packages/server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ app.on("window-all-closed", () => {
*/
app.on("before-quit", event => handleExit(event));

process.on("SIGTERM", async () => {
log.debug("Received SIGTERM, exiting...");
await handleExit(null, { exit: false });
});
process.on("SIGINT", async () => {
log.debug("Received SIGINT, exiting...");
await handleExit(null, { exit: false });
});

/**
* All code below this point has to do with the command-line functionality.
* This is when you run the app via terminal, we want to give users the ability
Expand Down
14 changes: 10 additions & 4 deletions packages/server/src/server/api/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import koaCors from "koa-cors";
import * as https from "https";
import * as http from "http";
import * as fs from "fs";
import * as zx from "zx";

// Internal libraries
import { Server } from "@server";
Expand All @@ -26,6 +25,7 @@ import { HELLO_WORLD } from "@server/events";
import { ScheduledService } from "../../lib/ScheduledService";
import { Loggable } from "../../lib/logging/Loggable";
import { ProxyServices } from "@server/databases/server/constants";
import { ProcessSpawner } from "@server/lib/ProcessSpawner";

/**
* This service class handles all routing for incoming socket
Expand Down Expand Up @@ -152,9 +152,15 @@ export class HttpService extends Loggable {
async checkIfPortInUse(port: number) {
try {
// Check if there are any listening services
zx.$.verbose = false;
const output = await zx.$`lsof -nP -iTCP -sTCP:LISTEN | grep ${port}`;
if (output.toString().includes(`:${port} (LISTEN)`)) return true;
const output = await ProcessSpawner.executeCommand('lsof', [
'-nP',
'-iTCP',
'-sTCP:LISTEN',
'|',
'grep',
`${port}`
], {}, "PortChecker");
if (output.includes(`:${port} (LISTEN)`)) return true;
} catch {
// Don't show an error, I believe this throws a "false error".
// For instance, if the proxy service doesn't start, and the command returns
Expand Down
Loading

0 comments on commit 13e36c8

Please sign in to comment.