Commit Graph

423 Commits

Author SHA1 Message Date
Zane Helton ff692c19b7 Await guild creation to fix a race condition
`Promise.all(...)` runs these simultaneously, yet role depends on the
guild to be created first. This can lead to a race condition. I've
awaited role creation too because the call to `Member.addToGuild(...)`
relies on the role to be created.
2025-06-29 13:27:14 +10:00
Zane Helton 4772731a17 Fix PATCH Template route implementation
The previous PATCH implementation was creating a new template rather
than editing the existing template. This resulted in all requests
failing because it was missing more than one required field.

Resolves: #1281
2025-06-29 13:25:22 +10:00
Zane Helton 4f75919651 Add OP to message.mentions when replied to
The `message.message_reference` stores:

1. `message_id`
2. `channel_id`
3. `guild_id`

We use the `message_id` and `channel_id` to `.findOne(...)` Message, and
find the author. If the author is the same as OP, we skip (so replying
to yourself doesn't add you to the mentions array) otherwise, it adds
the author_id to the mentions array.

Resolves: #1247
2025-06-29 09:14:58 +10:00
Zane Helton e8d3f655a3 Preserve reactions when a message is edited
Resolves #1241
2025-06-29 08:44:47 +10:00
Zane Helton 81d4313631 Properly filter existing embed links
In a previous PR, I was checking if the `.url` property existed, the
correct fix is to remove any embed that isn't a rich embed
type (non-link).

See also: #1296
2025-06-29 08:39:42 +10:00
Zane Helton 184433b078 Start fresh when updating embeds for links
In a previous commit I was attempting to be clever by only
replacing/removing embeds if necessary. This not only made the logic
more confusing but introduced a bug that would allow for orphaned
embeds when updating the search params of a URL.

This commit will remove all embeds that have a `.url` property and start
fresh. This simplifies the code and eliminates the aforementioned bug.
2025-06-28 18:30:52 +10:00
Zane Helton f9cfb46e73 Fix various issues with embeds on message updates
The `postHandleMessage` function is parsing links and adding them to the
EmbedCache table if necessary. In the previous implementation, message
updates would push to the embeds unconditionally.

This commit parses links from the message and:

1. Normalizes the URLs
  - Useful for deduplicating similar URLs
2. Remove embeds with matching normalized URLs
  - Leaves all embeds except for ones with a `.url` property matching
  the updated message
  - This allows embeds to be re-ordered if the URL is moved
3. If no normalized URLs are found, remove all embeds
4. Take the deduplicated + normalized URLs and add an embed to the message and
insert into the EmbedCache table (if necessary)

This enables:

1. Embeds to be re-ordered by re-ordering links
2. Embeds to be removed by removing links

and fixes:

1. Duplicate embeds being attached to a message when edited
2025-06-28 18:30:52 +10:00
Zane Helton c0f9c22e67 Add validation to date_of_birth registration field
Resolves: #1020
2025-06-28 17:08:00 +10:00
dank074 526a8da8f5 add webrtc support (#1284)
Co-authored-by: MaddyUnderStars <46743919+MaddyUnderStars@users.noreply.github.com>
2025-06-22 12:41:13 +10:00
MathMan05 f03c6209a4 send the real index 2025-05-28 08:46:35 +02:00
MathMan05 e219c1a33a code relies on things done in a certain order
This makes sure that the code gets done in the order that is expected
2025-05-28 08:46:35 +02:00
MathMan05 4f6211ce50 remove missed log 2025-05-28 08:46:35 +02:00
MathMan05 04ddfadbb6 sort array to make algorithm happy 2025-05-28 08:46:35 +02:00
MathMan05 91361ea9c6 fix another stupid bug 2025-05-28 08:46:35 +02:00
MathMan05 1550ccd099 don't set possition if sent 2025-05-28 08:46:35 +02:00
MathMan05 246b493d76 remove logs 2025-05-28 08:46:35 +02:00
MathMan05 5488874476 delete the null eater 2025-05-28 08:46:35 +02:00
MathMan05 af70a7f21b channel is nullable fixes 2025-05-28 08:46:35 +02:00
MathMan05 a4c50ae922 forgot to test on rebuild 2025-05-28 08:46:35 +02:00
MathMan05 a9bff7554a fix moving channels 2025-05-28 08:46:35 +02:00
Puyodead1 080b2c7d38 Implement signed cdn urls 2025-05-03 12:30:22 +02:00
dank074 bb84bc83e5 add author to query in pins API 2025-04-09 18:42:56 -05:00
Emma [it/its]@Rory& 126a881f31 Prettier 2025-04-09 16:38:03 +02:00
Emma [it/its]@Rory& ebc063df97 Fix dependencies 2025-04-09 16:38:03 +02:00
MathMan05 d267b08ab5 stupid fix 2025-04-03 12:53:03 -05:00
MathMan05 99cc009670 fix password reset bug
Not sure if this'll work, but made a pull so y'all could see the issue
2025-04-03 12:52:11 -05:00
root d8b1a8484c Validate Name for webhooks enforced more 2025-03-25 16:02:47 -07:00
root cabc49a1ba Added can_recover_account value to /api/policies/instance/config 2025-03-25 11:26:36 -07:00
root 541af2045d Added better user configuration and removed extra logging 2025-03-25 11:15:14 -07:00
Munchy 7320aa4529 Merge branch 'spacebarchat:master' into master 2025-03-24 10:35:27 -04:00
root d0948c0e49 Updated error message for empty webhook update body 2025-03-24 07:29:56 -07:00
root 859edb9a27 Added Name Validation utility function 2025-03-24 07:26:26 -07:00
MathMan05 664b71f463 acatually fix the embed issue
This one added the line in the right spot, sorry about the previous one lol
2025-03-23 23:29:19 -05:00
root b03888fd62 Merge branch 'master' of https://github.com/spacebarchat/server into update_webhooks 2025-03-23 16:33:24 -07:00
root 336b2df1d7 Fixed errors in authorization for webhooks with tokens 2025-03-23 16:28:25 -07:00
Puyodead1 05520665dc Merge pull request #1205 from DEVTomatoCake/feat/dont-send-x-powered-by
Stop sending X-Powered-By & use API CORS + BodyParser middlewares in CDN
2025-03-23 14:20:32 -04:00
MathMan05 90287748ce Update index.ts 2025-03-23 13:13:03 -05:00
MathMan05 109bf0da7c fix minor bug 2025-03-22 23:03:33 -05:00
root dda930d501 Added in date wrap on generate-registration-tokens.ts 2025-03-19 09:36:13 -07:00
Puyodead1 8c7fabfe40 implement hubs routes 2025-01-07 21:12:43 -05:00
dank074 f5d6394c38 run prettier 2024-11-19 14:19:40 -06:00
Cyber 9384138dd4 Merge branch 'master' into fix/user-profile-colors 2024-11-14 07:58:16 +01:00
dank074 f499507698 turn off eslint rules causing issues 2024-11-13 19:05:54 -06:00
CyberL1 a11f3c0409 fix: return user profile theme colors as numbers 2024-11-12 13:48:52 +01:00
Emma [it/its]@Rory& 40b356ecdf Add express trustedProxy support 2024-10-30 16:28:57 +01:00
MathMan05 6a0d0f4185 Fix the broken delete API 2024-10-29 17:42:52 -05:00
Emma [it/its]@Rory& 2feb90475e Fix module resolution when $CWD != . 2024-10-28 00:32:18 +01:00
Emma [it/its]@Rory& 168758924c Update some patches, switch to node-fetch-commonjs, more updates 2024-10-28 00:32:15 +01:00
Cyber 246e80c095 fix: self nick change response 2024-09-03 14:13:52 +02:00
TomatoCake ff1ed0d744 Fix uploading of emojis 2024-09-02 19:39:32 +02:00