-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #712 from BlueBubblesApp/development
v1.9.8
- Loading branch information
Showing
47 changed files
with
1,052 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
CREATE TABLE attachment ( | ||
ROWID INTEGER PRIMARY KEY AUTOINCREMENT, | ||
guid TEXT UNIQUE NOT NULL, | ||
created_date INTEGER DEFAULT 0, | ||
start_date INTEGER DEFAULT 0, | ||
filename TEXT, | ||
uti TEXT, | ||
mime_type TEXT, | ||
transfer_state INTEGER DEFAULT 0, | ||
is_outgoing INTEGER DEFAULT 0, | ||
user_info BLOB, | ||
transfer_name TEXT, | ||
total_bytes INTEGER DEFAULT 0, | ||
is_sticker INTEGER DEFAULT 0, | ||
sticker_user_info BLOB, | ||
attribution_info BLOB, | ||
hide_attachment INTEGER DEFAULT 0, | ||
ck_sync_state INTEGER DEFAULT 0, | ||
ck_server_change_token_blob BLOB, | ||
ck_record_id TEXT, | ||
original_guid TEXT UNIQUE NOT NULL, | ||
sr_ck_sync_state INTEGER DEFAULT 0, | ||
sr_ck_server_change_token_blob BLOB, | ||
sr_ck_record_id TEXT, | ||
is_commsafety_sensitive INTEGER DEFAULT 0, | ||
emoji_image_content_identifier TEXT DEFAULT NULL, | ||
emoji_image_short_description TEXT DEFAULT NULL | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
CREATE TABLE chat ( | ||
ROWID INTEGER PRIMARY KEY AUTOINCREMENT, | ||
guid TEXT UNIQUE NOT NULL, | ||
style INTEGER, | ||
state INTEGER, | ||
account_id TEXT, | ||
properties BLOB, | ||
chat_identifier TEXT, | ||
service_name TEXT, | ||
room_name TEXT, | ||
account_login TEXT, | ||
is_archived INTEGER DEFAULT 0, | ||
last_addressed_handle TEXT, | ||
display_name TEXT, | ||
group_id TEXT, | ||
is_filtered INTEGER, | ||
successful_query INTEGER, | ||
engram_id TEXT, | ||
server_change_token TEXT, | ||
ck_sync_state INTEGER DEFAULT 0, | ||
original_group_id TEXT, | ||
last_read_message_timestamp INTEGER DEFAULT 0, | ||
sr_server_change_token TEXT, | ||
sr_ck_sync_state INTEGER DEFAULT 0, | ||
cloudkit_record_id TEXT, | ||
sr_cloudkit_record_id TEXT, | ||
last_addressed_sim_id TEXT, | ||
is_blackholed INTEGER DEFAULT 0, | ||
syndication_date INTEGER DEFAULT 0, | ||
syndication_type INTEGER DEFAULT 0, | ||
is_recovered INTEGER DEFAULT 0, | ||
is_deleting_incoming_messages INTEGER DEFAULT 0 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CREATE TABLE deleted_messages ( | ||
ROWID INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, | ||
guid TEXT NOT NULL | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE TABLE handle ( | ||
ROWID INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, | ||
id TEXT NOT NULL, | ||
country TEXT, | ||
service TEXT NOT NULL, | ||
uncanonicalized_id TEXT, | ||
person_centric_id TEXT, | ||
UNIQUE (id, service) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
CREATE TABLE message ( | ||
ROWID INTEGER PRIMARY KEY AUTOINCREMENT, | ||
guid TEXT UNIQUE NOT NULL, | ||
text TEXT, | ||
replace INTEGER DEFAULT 0, | ||
service_center TEXT, | ||
handle_id INTEGER DEFAULT 0, | ||
subject TEXT, | ||
country TEXT, | ||
attributedBody BLOB, | ||
version INTEGER DEFAULT 0, | ||
type INTEGER DEFAULT 0, | ||
service TEXT, | ||
account TEXT, | ||
account_guid TEXT, | ||
error INTEGER DEFAULT 0, | ||
date INTEGER, | ||
date_read INTEGER, | ||
date_delivered INTEGER, | ||
is_delivered INTEGER DEFAULT 0, | ||
is_finished INTEGER DEFAULT 0, | ||
is_emote INTEGER DEFAULT 0, | ||
is_from_me INTEGER DEFAULT 0, | ||
is_empty INTEGER DEFAULT 0, | ||
is_delayed INTEGER DEFAULT 0, | ||
is_auto_reply INTEGER DEFAULT 0, | ||
is_prepared INTEGER DEFAULT 0, | ||
is_read INTEGER DEFAULT 0, | ||
is_system_message INTEGER DEFAULT 0, | ||
is_sent INTEGER DEFAULT 0, | ||
has_dd_results INTEGER DEFAULT 0, | ||
is_service_message INTEGER DEFAULT 0, | ||
is_forward INTEGER DEFAULT 0, | ||
was_downgraded INTEGER DEFAULT 0, | ||
is_archive INTEGER DEFAULT 0, | ||
cache_has_attachments INTEGER DEFAULT 0, | ||
cache_roomnames TEXT, | ||
was_data_detected INTEGER DEFAULT 0, | ||
was_deduplicated INTEGER DEFAULT 0, | ||
is_audio_message INTEGER DEFAULT 0, | ||
is_played INTEGER DEFAULT 0, | ||
date_played INTEGER, | ||
item_type INTEGER DEFAULT 0, | ||
other_handle INTEGER DEFAULT 0, | ||
group_title TEXT, | ||
group_action_type INTEGER DEFAULT 0, | ||
share_status INTEGER DEFAULT 0, | ||
share_direction INTEGER DEFAULT 0, | ||
is_expirable INTEGER DEFAULT 0, | ||
expire_state INTEGER DEFAULT 0, | ||
message_action_type INTEGER DEFAULT 0, | ||
message_source INTEGER DEFAULT 0, | ||
associated_message_guid TEXT, | ||
associated_message_type INTEGER DEFAULT 0, | ||
balloon_bundle_id TEXT, | ||
payload_data BLOB, | ||
expressive_send_style_id TEXT, | ||
associated_message_range_location INTEGER DEFAULT 0, | ||
associated_message_range_length INTEGER DEFAULT 0, | ||
time_expressive_send_played INTEGER, | ||
message_summary_info BLOB, | ||
ck_sync_state INTEGER DEFAULT 0, | ||
ck_record_id TEXT, | ||
ck_record_change_tag TEXT, | ||
destination_caller_id TEXT, | ||
sr_ck_sync_state INTEGER DEFAULT 0, | ||
sr_ck_record_id TEXT, | ||
sr_ck_record_change_tag TEXT, | ||
is_corrupt INTEGER DEFAULT 0, | ||
reply_to_guid TEXT, | ||
sort_id INTEGER, | ||
is_spam INTEGER DEFAULT 0, | ||
has_unseen_mention INTEGER DEFAULT 0, | ||
thread_originator_guid TEXT, | ||
thread_originator_part TEXT, | ||
syndication_ranges TEXT DEFAULT NULL, | ||
was_delivered_quietly INTEGER DEFAULT 0, | ||
did_notify_recipient INTEGER DEFAULT 0, | ||
synced_syndication_ranges TEXT DEFAULT NULL, | ||
date_retracted INTEGER DEFAULT 0, | ||
date_edited INTEGER DEFAULT 0, | ||
was_detonated INTEGER DEFAULT 0, | ||
part_count INTEGER, | ||
is_stewie INTEGER DEFAULT 0, | ||
is_sos INTEGER DEFAULT 0, | ||
is_critical INTEGER DEFAULT 0, | ||
bia_reference_id TEXT DEFAULT NULL, | ||
is_kt_verified INTEGER DEFAULT 0, | ||
fallback_hash TEXT DEFAULT NULL, | ||
associated_message_emoji TEXT DEFAULT NULL, | ||
is_pending_satellite_send INTEGER DEFAULT 0, | ||
needs_relay INTEGER DEFAULT 0, | ||
schedule_type INTEGER DEFAULT 0, | ||
schedule_state INTEGER DEFAULT 0, | ||
sent_or_received_off_grid INTEGER DEFAULT 0 | ||
) |
10 changes: 10 additions & 0 deletions
10
macos/database/samples/sequoia/message_processing_task.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CREATE TABLE recoverable_message_part ( | ||
chat_id INTEGER REFERENCES chat (ROWID) ON DELETE CASCADE, | ||
message_id INTEGER REFERENCES message (ROWID) ON DELETE CASCADE, | ||
part_index INTEGER, | ||
delete_date INTEGER, | ||
part_text BLOB NOT NULL, | ||
ck_sync_state INTEGER DEFAULT 0, | ||
PRIMARY KEY (chat_id, message_id, part_index), | ||
CHECK (delete_date != 0) | ||
) |
10 changes: 10 additions & 0 deletions
10
macos/database/samples/sequoia/recoverable_message_part.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CREATE TABLE recoverable_message_part ( | ||
chat_id INTEGER REFERENCES chat (ROWID) ON DELETE CASCADE, | ||
message_id INTEGER REFERENCES message (ROWID) ON DELETE CASCADE, | ||
part_index INTEGER, | ||
delete_date INTEGER, | ||
part_text BLOB NOT NULL, | ||
ck_sync_state INTEGER DEFAULT 0, | ||
PRIMARY KEY (chat_id, message_id, part_index), | ||
CHECK (delete_date != 0) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+2.48 KB
(100%)
packages/server/appResources/macos/daemons/cloudflare/arm64/cloudflared
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
packages/server/appResources/macos/daemons/cloudflare/arm64/cloudflared.md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
bb5b2df38ee82a42ec156ceb0b3744fa | ||
7673f85211adbead7799915ae223f064 |
Binary file modified
BIN
+352 Bytes
(100%)
packages/server/appResources/private-api/macos11/BlueBubblesHelper.dylib
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/server/src/server/api/http/api/v1/routers/webhookRouter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { RouterContext } from "koa-router"; | ||
import { Next } from "koa"; | ||
|
||
import { Server } from "@server"; | ||
import { isEmpty } from "@server/helpers/utils"; | ||
|
||
import { Success } from "../responses/success"; | ||
import { NotFound } from "../responses/errors"; | ||
|
||
export class WebhookRouter { | ||
static async get(ctx: RouterContext, _: Next) { | ||
const url = ctx?.request?.query?.url as string; | ||
const id = (ctx?.request?.query?.id) ? Number.parseInt(ctx?.request?.query?.id as string) : null; | ||
const webhooks = await Server().repo.getWebhooks({ url, id }); | ||
|
||
// Convert the events to a list (from json array) | ||
for (const webhook of webhooks) { | ||
webhook.events = JSON.parse(webhook.events); | ||
} | ||
|
||
return new Success(ctx, { message: "Successfully fetched webhooks!", data: webhooks }).send(); | ||
} | ||
|
||
static async create(ctx: RouterContext, _: Next) { | ||
const { url, events } = ctx.request.body; | ||
const webhook = await Server().repo.addWebhook(url, events); | ||
|
||
// Convert the events to a list (from json array) | ||
webhook.events = JSON.parse(webhook.events); | ||
|
||
return new Success(ctx, { data: webhook, message: "Successfully created webhook!" }).send(); | ||
} | ||
|
||
static async delete(ctx: RouterContext, _: Next): Promise<void> { | ||
const { id } = ctx.params; | ||
|
||
// Find it | ||
const webhooks = await Server().repo.getWebhooks({ id: Number.parseInt(id as string) }); | ||
if (isEmpty(webhooks)) throw new NotFound({ error: "Webhook does not exist!" }); | ||
|
||
// Delete it | ||
await Server().repo.deleteWebhook({ id: Number.parseInt(id as string) }); | ||
|
||
// Send success | ||
return new Success(ctx, { message: "Successfully deleted webhook!" }).send(); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
packages/server/src/server/api/http/api/v1/validators/webhookValidator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { RouterContext } from "koa-router"; | ||
import { Next } from "koa"; | ||
|
||
import { ValidateInput } from "./index"; | ||
import { BadRequest } from "../responses/errors"; | ||
import { webhookEventOptions } from "@server/api/http/constants"; | ||
|
||
export class WebhookValidator { | ||
|
||
static webhookValues = webhookEventOptions.map(e => e.value); | ||
|
||
static getWebhookRules = { | ||
name: "string", | ||
id: "number", | ||
}; | ||
|
||
static async validateGetWebhooks(ctx: RouterContext, next: Next) { | ||
ValidateInput(ctx?.request?.query, WebhookValidator.getWebhookRules); | ||
await next(); | ||
} | ||
|
||
static createRules = { | ||
url: "required|string", | ||
events: "required|array" | ||
}; | ||
|
||
static async validateCreateWebhook(ctx: RouterContext, next: Next) { | ||
ValidateInput(ctx?.request?.body, WebhookValidator.createRules); | ||
|
||
const { url, events } = ctx.request.body; | ||
if (url.length === 0) { | ||
throw new BadRequest({ error: "Webhook URL is required!" }); | ||
} else if (!url.startsWith('http')) { | ||
throw new BadRequest({ error: "Webhook URL must include an HTTP scheme!" }); | ||
} | ||
|
||
// Ensure that the events are valid | ||
const validatedEvents = []; | ||
for (const event of events) { | ||
if (typeof event !== "string") { | ||
throw new BadRequest({ error: "Webhook events must be strings!" }); | ||
} | ||
|
||
// Find the webhook value in the webhook events | ||
const webhookEvent = webhookEventOptions.find(e => e.value === event); | ||
if (!webhookEvent) { | ||
throw new BadRequest({ error: `Invalid webhook event: ${event}! Webhook must be one of: ${WebhookValidator.webhookValues}` }); | ||
} | ||
|
||
// Update the event to the label | ||
validatedEvents.push(webhookEvent); | ||
} | ||
|
||
// Update the events | ||
ctx.request.body.events = validatedEvents; | ||
|
||
await next(); | ||
} | ||
} |
Oops, something went wrong.