From 8c7fabfe40ed8e163616e5eeaf54541d8e7d4a12 Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Tue, 7 Jan 2025 21:12:43 -0500 Subject: [PATCH] implement hubs routes --- assets/openapi.json | Bin 614307 -> 627310 bytes assets/schemas.json | Bin 23947401 -> 25277849 bytes package-lock.json | Bin 402933 -> 403320 bytes package.json | 1 + .../channels/#channel_id/directory-entries.ts | 41 +++++++ .../guilds/automations/email-domain-lookup.ts | 105 ++++++++++++++++++ src/api/routes/hub-waitlist.ts | 52 +++++++++ src/util/schemas/EmailDomainLookupSchema.ts | 24 ++++ .../EmailDomainLookupVerifyCodeSchema.ts | 23 ++++ src/util/schemas/HubWaitlistSignupSchema.ts | 22 ++++ src/util/schemas/index.ts | 5 +- .../responses/EmailDomainLookupResponse.ts | 27 +++++ .../EmailDomainLookupVerifyCodeResponse.ts | 24 ++++ .../responses/HubDirectoryEntriesResponse.ts | 31 ++++++ .../responses/HubWaitlistSignupResponse.ts | 24 ++++ src/util/schemas/responses/index.ts | 6 +- 16 files changed, 383 insertions(+), 2 deletions(-) create mode 100644 src/api/routes/channels/#channel_id/directory-entries.ts create mode 100644 src/api/routes/guilds/automations/email-domain-lookup.ts create mode 100644 src/api/routes/hub-waitlist.ts create mode 100644 src/util/schemas/EmailDomainLookupSchema.ts create mode 100644 src/util/schemas/EmailDomainLookupVerifyCodeSchema.ts create mode 100644 src/util/schemas/HubWaitlistSignupSchema.ts create mode 100644 src/util/schemas/responses/EmailDomainLookupResponse.ts create mode 100644 src/util/schemas/responses/EmailDomainLookupVerifyCodeResponse.ts create mode 100644 src/util/schemas/responses/HubDirectoryEntriesResponse.ts create mode 100644 src/util/schemas/responses/HubWaitlistSignupResponse.ts diff --git a/assets/openapi.json b/assets/openapi.json index 35b75a7706d5a9123c3130699e57d52b55338598..b78f33e563f7a5d568b9252ea7a942fad598e95e 100644 GIT binary patch delta 2209 zcmbtVYiv_x7|wS&r>Aag9UZ%}?rf9IpxrvzMRd%nn~X_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YBLuEqn%W(1w{M&lDipm&Zy6XJp?q{i zs99~j_O2q7R5468nWLlM2xn%`f`8g5j-bCeKhkV2$IzcE*ix=RWEbkK5Wg(m!jGL7 zHd_llVNIW%VGyAT#n^1SF-x!C?n`3Ptz_y-gsa)p@cGa(Taj=;^bX^=bLGxbxL zxL;b#6DcMOg7{w3Fr=GInFFhBCcfGxwSEOIS;|Vk`en5%el6$)$8O;mICj!YbFbeA auL5smh>Sb)g^h?OZj&Yv-+M;782%H3WhpHH delta 756 zcmb`ETS(J!6vz3U-*5lR8gteZvq{TTWau_8i5J4*(`b}Ni5FU~24*DW1vN@av9x-~ z!H;&jPzLs3NjVfc(nA|PmP9W;R7MM*GQ7Qd!A9as5cJU7;d?lIIG^v*)11+0cI2BT zn~WAJ9Dpn7Q)7BntGuJDCmFvO=8x}x{!r1!Aw?F+28u%BWkIB~l&vi1Vd=eP;Xn?6Ja>XT1(NS^MG}I6g z)DSV0G=}F?m2O&;!99a6<&{f4Vx`y{O#uo7m35$~U%kvQ{y@#e#|~8+GW%3A`?SD& O+&G|{=!Q-I(e(?5haQFi diff --git a/assets/schemas.json b/assets/schemas.json index 39045b4066f26d024ae69230dd2ae78b71f907bc..f9c26b6615e2c15d7672e87ee2cd5fcccef9c416 100644 GIT binary patch delta 51150 zcmeI5dsx(E7RR3#m>GU@n?dd{Fmf>rM~4!@3x`FXccr>U?Mtg$QQ&-#mp&|=1 z8)TUfvtFJC8t>43pgZ*DDyZ9)8UbCY84+r-nq$iP{a^vC40{!Y)$23%+R4Zl-I|TZ^+69myAHz?YR8M0x z;bV9;*sTj0axgq2(EAQ}M4&B8WoVsZuZZ?nfcDEt-cVh;G7(~~HjFXE$h2a>LkYx( z>OMIhXJbe^=41X0wxtno_KUqC=8y*@91HS;^gx+66sOqv!>8UdKhV4)^Ec@1m7vMZ zvV*$hAYaQz#t$1*;BwjR9?M^}RpwrGvZXxj3oZyY)jE+e4K2(}_a zK8B@lYtErF=3~hAJB$_R8F@S-?dS;k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Y{pH> zOUqT{3*?NA@;+oga>n^<-ANhl-kYeSV9%4OepTl4b9IhZ27y}1W$ z#^OAvZHftWyzDO!8e;ssp!{)eNbjW<+7l#(-b*hqmj(wrs#E&C&PQ4^r~1Ro1MAtF z2fdEyV2CBj297(qKcLHMD=kT+#J#wIMrY7fL@04IzQ;2dKF z^!#_3G#L2X|Bj%u3Ula+zf( X&p9sNzMY8~h*^M`b^CTEHaleiREJdK delta 50 zcmexyPU7oni4BrWo2{6bnWtA=VC8R4Wo=JoW!#?1%9Q`NU6zFzh*^M`b-OGJTeLC& D&B+fq diff --git a/package.json b/package.json index c2f3536d..aeb54ea8 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "cheerio": "^1.0.0", "cookie-parser": "^1.4.7", "dotenv": "^16.4.5", + "email-providers": "^2.7.0", "exif-be-gone": "^1.5.1", "fast-zlib": "^2.0.1", "fido2-lib": "^3.5.3", diff --git a/src/api/routes/channels/#channel_id/directory-entries.ts b/src/api/routes/channels/#channel_id/directory-entries.ts new file mode 100644 index 00000000..da1ff90e --- /dev/null +++ b/src/api/routes/channels/#channel_id/directory-entries.ts @@ -0,0 +1,41 @@ +/* + 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 . +*/ + +import { route } from "@spacebar/api"; +import { HubDirectoryEntriesResponse } from "@spacebar/util"; +import { Request, Response, Router } from "express"; +const router = Router(); + +router.get( + "/", + route({ + responses: { + 200: { + body: "HubDirectoryEntriesResponse", + }, + 400: { + body: "APIErrorResponse", + }, + }, + }), + async (req: Request, res: Response) => { + res.json([] as HubDirectoryEntriesResponse); + }, +); + +export default router; diff --git a/src/api/routes/guilds/automations/email-domain-lookup.ts b/src/api/routes/guilds/automations/email-domain-lookup.ts new file mode 100644 index 00000000..ebb76d7a --- /dev/null +++ b/src/api/routes/guilds/automations/email-domain-lookup.ts @@ -0,0 +1,105 @@ +/* + 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 . +*/ + +import { route } from "@spacebar/api"; +import { + EmailDomainLookupResponse, + EmailDomainLookupSchema, + EmailDomainLookupVerifyCodeSchema, + FieldErrors, +} from "@spacebar/util"; +import emailProviders from "email-providers/all.json"; +import { Request, Response, Router } from "express"; +import { HTTPError } from "lambert-server"; + +const router = Router(); + +router.post( + "/", + route({ + requestBody: "EmailDomainLookupSchema", + responses: { + 200: { + body: "EmailDomainLookupResponse", + }, + 400: { + body: "APIErrorResponse", + }, + }, + }), + async (req: Request, res: Response) => { + const { email } = req.body as EmailDomainLookupSchema; + + const [_, tld] = email.split("@"); + + if (emailProviders.includes(tld.toLowerCase())) { + throw FieldErrors({ + name: { + message: + "That looks like a personal email address. Please use your official student email.", + code: "EMAIL_IS_UNOFFICIAL", + }, + }); + } + + return res.json({ + guilds_info: [], + has_matching_guild: false, + } as EmailDomainLookupResponse); + }, +); + +router.post( + "/verify-code", + route({ + requestBody: "EmailDomainLookupVerifyCodeSchema", + responses: { + // 200: { + // body: "EmailDomainLookupVerifyCodeResponse", + // }, + 400: { + body: "APIErrorResponse", + }, + 501: {}, + }, + }), + async (req: Request, res: Response) => { + const { email } = req.body as EmailDomainLookupVerifyCodeSchema; + + const [_, tld] = email.split("@"); + + if (emailProviders.includes(tld.toLowerCase())) { + throw FieldErrors({ + name: { + message: + "That looks like a personal email address. Please use your official student email.", + code: "EMAIL_IS_UNOFFICIAL", + }, + }); + } + + throw new HTTPError("Not implemented", 501); + + // return res.json({ + // guild: null, + // joined: false, + // } as EmailDomainLookupVerifyCodeResponse); + }, +); + +export default router; diff --git a/src/api/routes/hub-waitlist.ts b/src/api/routes/hub-waitlist.ts new file mode 100644 index 00000000..a6501e0e --- /dev/null +++ b/src/api/routes/hub-waitlist.ts @@ -0,0 +1,52 @@ +/* + 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 . +*/ + +import { route } from "@spacebar/api"; +import { + HubWaitlistSignupResponse, + HubWaitlistSignupSchema, +} from "@spacebar/util"; +import { Request, Response, Router } from "express"; +const router = Router(); + +router.post( + "/signup", + route({ + requestBody: "HubWaitlistSignupSchema", + responses: { + 200: { + body: "HubWaitlistSignupResponse", + }, + 400: { + body: "APIErrorResponse", + }, + }, + }), + async (req: Request, res: Response) => { + const { email, school } = req.body as HubWaitlistSignupSchema; + + res.json({ + email, + email_domain: email.split("@")[1], + school, + user_id: req.user_id, + } as HubWaitlistSignupResponse); + }, +); + +export default router; diff --git a/src/util/schemas/EmailDomainLookupSchema.ts b/src/util/schemas/EmailDomainLookupSchema.ts new file mode 100644 index 00000000..43680aa4 --- /dev/null +++ b/src/util/schemas/EmailDomainLookupSchema.ts @@ -0,0 +1,24 @@ +/* + 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 . +*/ + +export interface EmailDomainLookupSchema { + allow_multiple_guilds: boolean; + email: string; + use_verification_code: boolean; + guild_id?: string; +} diff --git a/src/util/schemas/EmailDomainLookupVerifyCodeSchema.ts b/src/util/schemas/EmailDomainLookupVerifyCodeSchema.ts new file mode 100644 index 00000000..9fe0bd46 --- /dev/null +++ b/src/util/schemas/EmailDomainLookupVerifyCodeSchema.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 . +*/ + +export interface EmailDomainLookupVerifyCodeSchema { + email: string; + guild_id: string; + code: string; +} diff --git a/src/util/schemas/HubWaitlistSignupSchema.ts b/src/util/schemas/HubWaitlistSignupSchema.ts new file mode 100644 index 00000000..8114b3d8 --- /dev/null +++ b/src/util/schemas/HubWaitlistSignupSchema.ts @@ -0,0 +1,22 @@ +/* + 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 . +*/ + +export interface HubWaitlistSignupSchema { + email: string; + school: string; +} diff --git a/src/util/schemas/index.ts b/src/util/schemas/index.ts index 7d8abaa0..2972b1a5 100644 --- a/src/util/schemas/index.ts +++ b/src/util/schemas/index.ts @@ -34,6 +34,8 @@ export * from "./ConnectedAccountSchema"; export * from "./ConnectionCallbackSchema"; export * from "./ConnectionUpdateSchema"; export * from "./DmChannelCreateSchema"; +export * from "./EmailDomainLookupSchema"; +export * from "./EmailDomainLookupVerifyCodeSchema"; export * from "./EmojiCreateSchema"; export * from "./EmojiModifySchema"; export * from "./ForgotPasswordSchema"; @@ -42,6 +44,7 @@ export * from "./GuildCreateSchema"; export * from "./GuildTemplateCreateSchema"; export * from "./GuildUpdateSchema"; export * from "./GuildUpdateWelcomeScreenSchema"; +export * from "./HubWaitlistSignupSchema"; export * from "./IdentifySchema"; export * from "./InviteCreateSchema"; export * from "./LazyRequestSchema"; @@ -59,6 +62,7 @@ export * from "./RegisterSchema"; export * from "./RelationshipPostSchema"; export * from "./RelationshipPutSchema"; export * from "./RequestGuildMembersSchema"; +export * from "./responses"; export * from "./RoleModifySchema"; export * from "./RolePositionUpdateSchema"; export * from "./SelectProtocolSchema"; @@ -83,4 +87,3 @@ export * from "./WebAuthnSchema"; export * from "./WebhookCreateSchema"; export * from "./WebhookExecuteSchema"; export * from "./WidgetModifySchema"; -export * from "./responses"; diff --git a/src/util/schemas/responses/EmailDomainLookupResponse.ts b/src/util/schemas/responses/EmailDomainLookupResponse.ts new file mode 100644 index 00000000..dc7faa63 --- /dev/null +++ b/src/util/schemas/responses/EmailDomainLookupResponse.ts @@ -0,0 +1,27 @@ +/* + 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 . +*/ +export interface HubGuild { + icon: string; + id: string; + name: string; +} + +export interface EmailDomainLookupResponse { + guilds_info: HubGuild[]; + has_matching_guild: boolean; +} diff --git a/src/util/schemas/responses/EmailDomainLookupVerifyCodeResponse.ts b/src/util/schemas/responses/EmailDomainLookupVerifyCodeResponse.ts new file mode 100644 index 00000000..1fcfba34 --- /dev/null +++ b/src/util/schemas/responses/EmailDomainLookupVerifyCodeResponse.ts @@ -0,0 +1,24 @@ +/* + 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 . +*/ + +import { Guild } from "../../entities"; + +export interface EmailDomainLookupVerifyCodeResponse { + guild: Guild; + joined: boolean; +} diff --git a/src/util/schemas/responses/HubDirectoryEntriesResponse.ts b/src/util/schemas/responses/HubDirectoryEntriesResponse.ts new file mode 100644 index 00000000..9aaadfed --- /dev/null +++ b/src/util/schemas/responses/HubDirectoryEntriesResponse.ts @@ -0,0 +1,31 @@ +/* + 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 . +*/ + +import { Guild } from "../../entities"; + +export interface HubDirectoryEntry { + author_id: string; + created_at: string; + description: string; + directory_channel_id: string; + guild: Guild; + primary_category_id: number; + type: number; // TODO: not exactly sure what this is, channel type? +} + +export type HubDirectoryEntriesResponse = HubDirectoryEntry[]; diff --git a/src/util/schemas/responses/HubWaitlistSignupResponse.ts b/src/util/schemas/responses/HubWaitlistSignupResponse.ts new file mode 100644 index 00000000..bd11df22 --- /dev/null +++ b/src/util/schemas/responses/HubWaitlistSignupResponse.ts @@ -0,0 +1,24 @@ +/* + 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 . +*/ + +export interface HubWaitlistSignupResponse { + email: string; + email_domain: string; + school: string; + user_id: string; +} diff --git a/src/util/schemas/responses/index.ts b/src/util/schemas/responses/index.ts index 070a2e55..d65c7404 100644 --- a/src/util/schemas/responses/index.ts +++ b/src/util/schemas/responses/index.ts @@ -21,6 +21,8 @@ export * from "./APIErrorResponse"; export * from "./BackupCodesChallengeResponse"; export * from "./CaptchaRequiredResponse"; export * from "./DiscoverableGuildsResponse"; +export * from "./EmailDomainLookupResponse"; +export * from "./EmailDomainLookupVerifyCodeResponse"; export * from "./GatewayBotResponse"; export * from "./GatewayResponse"; export * from "./GenerateRegistrationTokensResponse"; @@ -34,6 +36,8 @@ export * from "./GuildVanityUrl"; export * from "./GuildVoiceRegionsResponse"; export * from "./GuildWidgetJsonResponse"; export * from "./GuildWidgetSettingsResponse"; +export * from "./HubDirectoryEntriesResponse"; +export * from "./HubWaitlistSignupResponse"; export * from "./InstanceDomainsResponse"; export * from "./InstancePingResponse"; export * from "./InstanceStatsResponse"; @@ -47,7 +51,7 @@ export * from "./TypedResponses"; export * from "./UpdatesResponse"; export * from "./UserNoteResponse"; export * from "./UserProfileResponse"; -export * from "./UserRelationsResponse"; export * from "./UserRelationshipsResponse"; +export * from "./UserRelationsResponse"; export * from "./WebAuthnCreateResponse"; export * from "./WebhookCreateResponse";