summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2024-08-22 09:53:34 +1000
committerGitHub <noreply@github.com>2024-08-22 09:53:34 +1000
commitad2dda63c9969f18caa4cf78ce45ebf3fd5dc28c (patch)
tree4e01535ebb34c7c215293953ac58407e84332dae /src/util
parentre-add CDN TODO comment (diff)
parentMerge pull request #1193 from DEVTomatoCake/fix/forgot-password-security (diff)
downloadserver-ts-ad2dda63c9969f18caa4cf78ce45ebf3fd5dc28c.tar.xz
Merge branch 'master' into fix/widget.json-channel-ordering-deleted-channels
Diffstat (limited to 'src/util')
-rw-r--r--src/util/config/types/CdnConfiguration.ts8
-rw-r--r--src/util/entities/Member.ts6
-rw-r--r--src/util/entities/UserSettings.ts6
-rw-r--r--src/util/imports/Jimp.ts23
-rw-r--r--src/util/imports/index.ts1
-rw-r--r--src/util/util/Constants.ts2
6 files changed, 37 insertions, 9 deletions
diff --git a/src/util/config/types/CdnConfiguration.ts b/src/util/config/types/CdnConfiguration.ts

index 033190813..842cb87c4 100644 --- a/src/util/config/types/CdnConfiguration.ts +++ b/src/util/config/types/CdnConfiguration.ts
@@ -1,17 +1,17 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. Copyright (C) 2023 Spacebar and Spacebar Contributors - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ @@ -25,4 +25,6 @@ export class CdnConfiguration extends EndpointConfiguration { endpointPublic: string | null = null; endpointPrivate: string | null = null; + + proxyCacheHeaderSeconds: number = 60 * 60 * 24; } diff --git a/src/util/entities/Member.ts b/src/util/entities/Member.ts
index 3ef778ace..df97e4692 100644 --- a/src/util/entities/Member.ts +++ b/src/util/entities/Member.ts
@@ -290,7 +290,9 @@ export class Member extends BaseClassWithoutId { }, relations: ["user"], }); - member.nick = nickname; + + // @ts-expect-error Member nickname is nullable + member.nick = nickname || null; await Promise.all([ member.save(), @@ -300,7 +302,7 @@ export class Member extends BaseClassWithoutId { data: { guild_id, user: member.user, - nick: nickname, + nick: nickname || null, }, guild_id, } as GuildMemberUpdateEvent), diff --git a/src/util/entities/UserSettings.ts b/src/util/entities/UserSettings.ts
index d3efe79b2..6f09c9b3a 100644 --- a/src/util/entities/UserSettings.ts +++ b/src/util/entities/UserSettings.ts
@@ -1,17 +1,17 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. Copyright (C) 2023 Spacebar and Spacebar Contributors - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ diff --git a/src/util/imports/Jimp.ts b/src/util/imports/Jimp.ts new file mode 100644
index 000000000..c1389e031 --- /dev/null +++ b/src/util/imports/Jimp.ts
@@ -0,0 +1,23 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2023 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +export type JimpType = { + read: (data: Buffer) => Promise<any>; +}; diff --git a/src/util/imports/index.ts b/src/util/imports/index.ts
index 08b870bc1..4bc5a6c5f 100644 --- a/src/util/imports/index.ts +++ b/src/util/imports/index.ts
@@ -18,3 +18,4 @@ export * from "./OrmUtils"; export * from "./Erlpack"; +export * from "./Jimp"; diff --git a/src/util/util/Constants.ts b/src/util/util/Constants.ts
index a6caae003..34e925e59 100644 --- a/src/util/util/Constants.ts +++ b/src/util/util/Constants.ts
@@ -812,7 +812,7 @@ export const DiscordApiErrors = { "Cannot execute action on a DM channel", 50003, ), - EMBED_DISABLED: new ApiError("Guild widget disabled", 50004), + EMBED_DISABLED: new ApiError("Widget Disabled", 50004), CANNOT_EDIT_MESSAGE_BY_OTHER: new ApiError( "Cannot edit a message authored by another user", 50005,