Skip to content

Commit

Permalink
Merge pull request #490 from BlueBubblesApp/development
Browse files Browse the repository at this point in the history
v1.5.5
  • Loading branch information
zlshames authored Feb 21, 2023
2 parents 24cd6f0 + 50228b2 commit e8ac4f9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 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.4",
"version": "1.5.5",
"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.5.4",
"version": "1.5.5",
"main": "./dist/main.js",
"license": "Apache-2.0",
"author": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { RouterContext } from "koa-router";
import { Next } from "koa";
import type { File } from "formidable";
import { Server } from "@server";
import { isEmpty } from "@server/helpers/utils";
import { isEmpty, isMinCatalina } from "@server/helpers/utils";
import { MessageInterface } from "@server/api/v1/interfaces/messageInterface";

import { ValidateInput } from "./index";
Expand Down Expand Up @@ -124,31 +124,23 @@ export class MessageValidator {

static async validateAttachment(ctx: RouterContext, next: Next) {
const { files } = ctx.request;
const {
tempGuid,
method,
isAudioMessage,
effectId,
subject,
selectedMessageGuid
} = ValidateInput(ctx.request?.body, MessageValidator.sendAttachmentRules);

let saniMethod = method;
if (isAudioMessage || effectId || subject || selectedMessageGuid || ctx.request.body.attributedBody) {
const { tempGuid, method, isAudioMessage, effectId, subject, selectedMessageGuid } = ValidateInput(
ctx.request?.body,
MessageValidator.sendAttachmentRules
);
let saniMethod = method ?? "apple-script";
if (effectId || subject || selectedMessageGuid || ctx.request.body.attributedBody) {
saniMethod = "private-api";
}

// Default the method to AppleScript
saniMethod = saniMethod ?? "apple-script";

// If we are sending via apple-script, we require a tempGuid
if (saniMethod === "apple-script" && isEmpty(tempGuid)) {
throw new BadRequest({ error: `A 'tempGuid' is required when sending via AppleScript` });
}

// Inject the method (we have to force it to thing it's anything)
(ctx.request.body as any).method = saniMethod;
(ctx.request.body as any).isAudioMessage = isAudioMessage === 'true' ? true : false;
(ctx.request.body as any).isAudioMessage = isAudioMessage === "true" ? true : false;

// Make sure the message isn't already in the queue
if (Server().httpService.sendCache.find(tempGuid)) {
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.5.4",
"version": "1.5.5",
"homepage": "./",
"license": "Apache-2.0",
"scripts": {
Expand Down

0 comments on commit e8ac4f9

Please sign in to comment.