summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-07-06 18:32:08 +0200
committerRory& <root@rory.gay>2026-07-08 01:20:38 +0200
commit0042d3c5c952383bc159653f505b9d366a0ae658 (patch)
tree2f9397ee584df072ee002951d528741eca4d7680
parentRename some more schemas (diff)
downloadserver-ts-0042d3c5c952383bc159653f505b9d366a0ae658.tar.xz
Some cleanup with gifs
-rw-r--r--assets/openapi.json180
-rw-r--r--assets/schemas.json176
-rw-r--r--extra/admin-api/Tests/Spacebar.Tests/Tests/GifTests.cs17
-rw-r--r--package.json1
-rw-r--r--src/api/Server.ts2
-rw-r--r--src/api/routes/gifs/search.ts7
-rw-r--r--src/api/routes/gifs/trending-gifs.ts32
-rw-r--r--src/api/routes/gifs/trending.ts8
-rw-r--r--src/integrations/gifs/GifProviderManager.ts (renamed from src/util/util/integrations/gifProviders/GifProviderManager.ts)0
-rw-r--r--src/integrations/gifs/IGifProvider.ts (renamed from src/util/util/integrations/gifProviders/IGifProvider.ts)0
-rw-r--r--src/integrations/gifs/index.ts20
-rw-r--r--src/integrations/gifs/providers/TenorGifProvider.ts (renamed from src/util/util/integrations/gifProviders/providers/TenorGifProvider.ts)61
-rw-r--r--src/schemas/api/index.ts1
-rw-r--r--src/schemas/api/integrations/Gifs.ts (renamed from src/schemas/responses/Tenor.ts)43
-rw-r--r--src/schemas/api/integrations/index.ts19
-rw-r--r--src/schemas/responses/index.ts1
-rw-r--r--src/util/util/Gifs.ts25
-rw-r--r--src/util/util/index.ts1
-rw-r--r--tsconfig.json2
19 files changed, 320 insertions, 276 deletions
diff --git a/assets/openapi.json b/assets/openapi.json

index 41c3649d..ba11b111 100644 --- a/assets/openapi.json +++ b/assets/openapi.json
@@ -2606,72 +2606,6 @@ "$ref": "#/components/schemas/Team" } }, - "GifResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "title": { - "type": "string" - }, - "url": { - "type": "string" - }, - "src": { - "type": "string" - }, - "gif_src": { - "type": "string" - }, - "width": { - "type": "integer" - }, - "height": { - "type": "integer" - }, - "preview": { - "type": "string" - } - }, - "required": [ - "gif_src", - "height", - "id", - "preview", - "src", - "title", - "url", - "width" - ] - }, - "TrendingGifsResponse": { - "type": "object", - "properties": { - "categories": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GifTrendingCategory" - } - }, - "gifs": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GifResponse" - } - } - }, - "required": [ - "categories", - "gifs" - ] - }, - "GifsResponse": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GifResponse" - } - }, "TokenResponse": { "type": "object", "properties": { @@ -3772,6 +3706,72 @@ "type" ] }, + "GifResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "url": { + "type": "string" + }, + "src": { + "type": "string" + }, + "gif_src": { + "type": "string" + }, + "width": { + "type": "integer" + }, + "height": { + "type": "integer" + }, + "preview": { + "type": "string" + } + }, + "required": [ + "gif_src", + "height", + "id", + "preview", + "src", + "title", + "url", + "width" + ] + }, + "TrendingGifsResponse": { + "type": "object", + "properties": { + "categories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GifTrendingCategory" + } + }, + "gifs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GifResponse" + } + } + }, + "required": [ + "categories", + "gifs" + ] + }, + "GifsResponse": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GifResponse" + } + }, "CreateReportSchema": { "type": "object", "properties": { @@ -13700,21 +13700,6 @@ } ] }, - "GifTrendingCategory": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "src": { - "type": "string" - } - }, - "required": [ - "name", - "src" - ] - }, "BackupCode": { "type": "object", "properties": { @@ -14199,6 +14184,21 @@ } } }, + "GifTrendingCategory": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "src": { + "type": "string" + } + }, + "required": [ + "name", + "src" + ] + }, "DmChannelDTO": { "type": "object", "properties": { @@ -23593,7 +23593,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TenorGifsResponse" + "$ref": "#/components/schemas/GifsResponse" } } } @@ -23615,6 +23615,22 @@ "type": "string" }, "description": "Locale" + }, + { + "name": "limit", + "in": "query", + "schema": { + "type": "number" + }, + "description": "Maximum number of GIFs to return" + }, + { + "name": "provider", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Provider to use" } ], "tags": [ diff --git a/assets/schemas.json b/assets/schemas.json
index 2e4e9035..57dd9d6a 100644 --- a/assets/schemas.json +++ b/assets/schemas.json
@@ -2779,77 +2779,6 @@ }, "$schema": "http://json-schema.org/draft-07/schema#" }, - "GifResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "title": { - "type": "string" - }, - "url": { - "type": "string" - }, - "src": { - "type": "string" - }, - "gif_src": { - "type": "string" - }, - "width": { - "type": "integer" - }, - "height": { - "type": "integer" - }, - "preview": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "gif_src", - "height", - "id", - "preview", - "src", - "title", - "url", - "width" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, - "TrendingGifsResponse": { - "type": "object", - "properties": { - "categories": { - "type": "array", - "items": { - "$ref": "#/definitions/GifTrendingCategory" - } - }, - "gifs": { - "type": "array", - "items": { - "$ref": "#/definitions/GifResponse" - } - } - }, - "additionalProperties": false, - "required": [ - "categories", - "gifs" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, - "GifsResponse": { - "type": "array", - "items": { - "$ref": "#/definitions/GifResponse" - }, - "$schema": "http://json-schema.org/draft-07/schema#" - }, "TokenResponse": { "type": "object", "properties": { @@ -4011,6 +3940,77 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, + "GifResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "url": { + "type": "string" + }, + "src": { + "type": "string" + }, + "gif_src": { + "type": "string" + }, + "width": { + "type": "integer" + }, + "height": { + "type": "integer" + }, + "preview": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "gif_src", + "height", + "id", + "preview", + "src", + "title", + "url", + "width" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "TrendingGifsResponse": { + "type": "object", + "properties": { + "categories": { + "type": "array", + "items": { + "$ref": "#/definitions/GifTrendingCategory" + } + }, + "gifs": { + "type": "array", + "items": { + "$ref": "#/definitions/GifResponse" + } + } + }, + "additionalProperties": false, + "required": [ + "categories", + "gifs" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "GifsResponse": { + "type": "array", + "items": { + "$ref": "#/definitions/GifResponse" + }, + "$schema": "http://json-schema.org/draft-07/schema#" + }, "CreateReportSchema": { "type": "object", "properties": { @@ -14637,23 +14637,6 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, - "GifTrendingCategory": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "src": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "name", - "src" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, "BackupCode": { "type": "object", "properties": { @@ -15188,6 +15171,23 @@ "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, + "GifTrendingCategory": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "src": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "src" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, "DmChannelDTO": { "type": "object", "properties": { diff --git a/extra/admin-api/Tests/Spacebar.Tests/Tests/GifTests.cs b/extra/admin-api/Tests/Spacebar.Tests/Tests/GifTests.cs
index e122a030..f4badbea 100644 --- a/extra/admin-api/Tests/Spacebar.Tests/Tests/GifTests.cs +++ b/extra/admin-api/Tests/Spacebar.Tests/Tests/GifTests.cs
@@ -77,4 +77,21 @@ public class GifTests(ITestOutputHelper testOutputHelper, TestFixture fixture) : Assert.NotEqual(0, gif.Height); }); } + + [Theory, MemberData(nameof(GifProviders))] + public async Task GetTrendingGifs(string provider) { + var resp = await Assert.HttpSuccess(await Client.ApiHttpClient.GetAsync($"gifs/trending-gifs?provider={provider}", TestContext.Current.CancellationToken)); + var respContent = await resp.Content.ReadFromJsonAsync<List<GifItem>>(cancellationToken: TestContext.Current.CancellationToken); + + Assert.True(respContent!.Count > 0, "respContent.Count > 0"); + Assert.All(respContent, gif => { + Assert.StringNotNullOrWhitespace(gif.Id); + Assert.StringNotNullOrWhitespace(gif.GifSource); + Assert.StringNotNullOrWhitespace(gif.Preview); + Assert.StringNotNullOrWhitespace(gif.Source); + Assert.StringNotNullOrWhitespace(gif.Url); + Assert.NotEqual(0, gif.Width); + Assert.NotEqual(0, gif.Height); + }); + } } \ No newline at end of file diff --git a/package.json b/package.json
index 8adbaf4e..8610aa66 100644 --- a/package.json +++ b/package.json
@@ -129,6 +129,7 @@ "@spacebar/database": "dist/database", "@spacebar/extensions": "dist/extensions", "@spacebar/gateway": "dist/gateway", + "@spacebar/integrations": "dist/integrations", "@spacebar/util": "dist/util", "@spacebar/webrtc": "dist/webrtc", "@spacebar/schemas": "dist/schemas", diff --git a/src/api/Server.ts b/src/api/Server.ts
index 74718dad..7fa5476d 100644 --- a/src/api/Server.ts +++ b/src/api/Server.ts
@@ -29,7 +29,7 @@ import { BcryptWorkerPool } from "../util/util/workers/bcrypt/BcryptWorkerPool"; import { Authentication, CORS, ImageProxy, BodyParser, ErrorHandler, initRateLimits, initTranslation } from "./middlewares"; import { initInstance } from "./util/handlers/Instance"; import { route, addPendingPoll } from "./util"; -import { GifProviderManager } from "@spacebar/util/util/integrations/gifProviders/GifProviderManager"; +import { GifProviderManager } from "@spacebar/integrations/gifs"; const ASSETS_FOLDER = path.join(__dirname, "..", "..", "assets"); const PUBLIC_ASSETS_FOLDER = path.join(ASSETS_FOLDER, "public"); diff --git a/src/api/routes/gifs/search.ts b/src/api/routes/gifs/search.ts
index ca951779..12eabaaf 100644 --- a/src/api/routes/gifs/search.ts +++ b/src/api/routes/gifs/search.ts
@@ -19,7 +19,7 @@ import { Request, Response, Router } from "express"; import { route } from "@spacebar/api/util/handlers/route"; import { GifMediaTypes } from "@spacebar/schemas"; -import { GifProviderManager } from "@spacebar/util/util/integrations/gifProviders/GifProviderManager"; +import { GifProviderManager } from "@spacebar/integrations/gifs"; const router = Router({ mergeParams: true }); @@ -53,11 +53,8 @@ router.get( }, }), async (req: Request, res: Response) => { - const { provider } = req.query; - - const impl = GifProviderManager.getProvider((provider as string) ?? "tenor"); + const impl = GifProviderManager.getProvider((req.query.provider as string) ?? "tenor"); const result = await impl.search(req.query as typeof impl.search.arguments); - res.json(result).status(200); }, ); diff --git a/src/api/routes/gifs/trending-gifs.ts b/src/api/routes/gifs/trending-gifs.ts
index a79dfc54..cb7e77eb 100644 --- a/src/api/routes/gifs/trending-gifs.ts +++ b/src/api/routes/gifs/trending-gifs.ts
@@ -1,6 +1,6 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. - Copyright (C) 2023 Spacebar and Spacebar Contributors + Copyright (C) 2026 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 @@ -17,9 +17,9 @@ */ import { route } from "@spacebar/api/util/handlers/route"; -import { getGifApiKey, parseGifResult } from "@spacebar/util"; import { Request, Response, Router } from "express"; -import { TenorGif, GifMediaTypes } from "@spacebar/schemas"; +import { GifMediaTypes } from "@spacebar/schemas"; +import { GifProviderManager } from "@spacebar/integrations/gifs"; const router = Router({ mergeParams: true }); @@ -36,27 +36,25 @@ router.get( type: "string", description: "Locale", }, + limit: { + type: "number", + description: "Maximum number of GIFs to return", + }, + provider: { + type: "string", + description: "Provider to use", + }, }, responses: { 200: { - body: "TenorGifsResponse", + body: "GifsResponse", }, }, }), async (req: Request, res: Response) => { - // TODO: Custom providers - const { media_format, locale } = req.query; - - const apiKey = getGifApiKey(); - - const response = await fetch(`https://g.tenor.com/v1/trending?media_format=${media_format}&locale=${locale}&key=${apiKey}`, { - method: "get", - headers: { "Content-Type": "application/json" }, - }); - - const { results } = (await response.json()) as { results: TenorGif[] }; - - res.json(results.map(parseGifResult)).status(200); + const provider = GifProviderManager.getProvider((req.query.provider as string) ?? "tenor"); + const results = await provider.getTrendingGifs(req.query as typeof provider.getTrendingGifs.arguments); + res.json(results).status(200); }, ); diff --git a/src/api/routes/gifs/trending.ts b/src/api/routes/gifs/trending.ts
index 4938bcb2..338de679 100644 --- a/src/api/routes/gifs/trending.ts +++ b/src/api/routes/gifs/trending.ts
@@ -1,6 +1,6 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. - Copyright (C) 2023 Spacebar and Spacebar Contributors + Copyright (C) 2026 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 @@ -17,11 +17,9 @@ */ import { route } from "@spacebar/api/util/handlers/route"; -import { getGifApiKey, parseGifResult } from "@spacebar/util"; import { Request, Response, Router } from "express"; -import { TenorCategoriesResults, TrendingGifsResponse, TenorTrendingResults } from "@spacebar/schemas"; -import { GifProviderManager } from "@spacebar/util/util/integrations/gifProviders/GifProviderManager"; -import trendingGifs from "@spacebar/api/routes/gifs/trending-gifs"; +import { TrendingGifsResponse } from "@spacebar/schemas"; +import { GifProviderManager } from "@spacebar/integrations/gifs"; const router = Router({ mergeParams: true }); diff --git a/src/util/util/integrations/gifProviders/GifProviderManager.ts b/src/integrations/gifs/GifProviderManager.ts
index 8bbfccf5..8bbfccf5 100644 --- a/src/util/util/integrations/gifProviders/GifProviderManager.ts +++ b/src/integrations/gifs/GifProviderManager.ts
diff --git a/src/util/util/integrations/gifProviders/IGifProvider.ts b/src/integrations/gifs/IGifProvider.ts
index 024f33f5..024f33f5 100644 --- a/src/util/util/integrations/gifProviders/IGifProvider.ts +++ b/src/integrations/gifs/IGifProvider.ts
diff --git a/src/integrations/gifs/index.ts b/src/integrations/gifs/index.ts new file mode 100644
index 00000000..287e17e4 --- /dev/null +++ b/src/integrations/gifs/index.ts
@@ -0,0 +1,20 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2026 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/>. +*/ + +export * from "./GifProviderManager"; +export * from "./IGifProvider"; diff --git a/src/util/util/integrations/gifProviders/providers/TenorGifProvider.ts b/src/integrations/gifs/providers/TenorGifProvider.ts
index e771feec..91b365ab 100644 --- a/src/util/util/integrations/gifProviders/providers/TenorGifProvider.ts +++ b/src/integrations/gifs/providers/TenorGifProvider.ts
@@ -17,9 +17,10 @@ */ import type { IGifProvider } from "../IGifProvider"; -import { TenorGif, GifsResponse, TenorCategoriesResults, GifTrendingCategory } from "@spacebar/schemas"; -import { Config, getGifApiKey, parseGifResult } from "@spacebar/util"; +import { GifsResponse, GifTrendingCategory, GifMediaTypes } from "@spacebar/schemas"; +import { Config } from "@spacebar/util"; +// Tenor V1 API... Not yet shut down as of writing, but is going soon... export default class TenorGifProvider implements IGifProvider { id = "tenor"; available = true; @@ -41,8 +42,8 @@ export default class TenorGifProvider implements IGifProvider { headers: { "Content-Type": "application/json" }, }); - const { results } = (await response.json()) as { results: TenorGif[] }; - return results.map(this.convertGifResult); + const responseData = (await response.json()) as TenorSearchResults; + return responseData.results.map(this.convertGifResult); } async getTrendingCategories(query: { media_format: string; locale: string }): Promise<GifTrendingCategory[]> { @@ -51,9 +52,8 @@ export default class TenorGifProvider implements IGifProvider { headers: { "Content-Type": "application/json" }, }); - const { tags } = (await response.json()) as TenorCategoriesResults; - - return tags.map((x) => ({ + const responseData = (await response.json()) as TenorCategoriesResults; + return responseData.tags.map((x) => ({ name: x.searchterm, src: x.image, })) satisfies GifTrendingCategory[]; @@ -65,8 +65,8 @@ export default class TenorGifProvider implements IGifProvider { headers: { "Content-Type": "application/json" }, }); - const { results } = (await response.json()) as { results: TenorGif[] }; - return results.map(this.convertGifResult); + const responseData = (await response.json()) as TenorTrendingResults; + return responseData.results.map(this.convertGifResult); } private convertGifResult(result: TenorGif) { @@ -82,3 +82,46 @@ export default class TenorGifProvider implements IGifProvider { }; } } + +// API response types + +type TenorGif = { + created: number; + hasaudio: boolean; + id: string; + media: { [type in keyof typeof GifMediaTypes]: TenorMedia }[]; + tags: string[]; + title: string; + itemurl: string; + hascaption: boolean; + url: string; +}; + +type TenorMedia = { + preview: string; + url: string; + dims: number[]; + size: number; +}; + +type TenorCategory = { + searchterm: string; + path: string; + image: string; + name: string; +}; + +type TenorCategoriesResults = { + tags: TenorCategory[]; +}; + +type TenorTrendingResults = { + next: string; + results: TenorGif[]; + locale: string; +}; + +type TenorSearchResults = { + next: string; + results: TenorGif[]; +}; diff --git a/src/schemas/api/index.ts b/src/schemas/api/index.ts
index 25458c95..42888e43 100644 --- a/src/schemas/api/index.ts +++ b/src/schemas/api/index.ts
@@ -20,6 +20,7 @@ export * from "./bots"; export * from "./channels"; export * from "./developers"; export * from "./guilds"; +export * from "./integrations"; export * from "./messages"; export * from "./reports"; export * from "./users"; diff --git a/src/schemas/responses/Tenor.ts b/src/schemas/api/integrations/Gifs.ts
index b338ed41..69ade823 100644 --- a/src/schemas/responses/Tenor.ts +++ b/src/schemas/api/integrations/Gifs.ts
@@ -1,6 +1,6 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. - Copyright (C) 2023 Spacebar and Spacebar Contributors + Copyright (C) 2026 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 @@ -30,47 +30,6 @@ export enum GifMediaTypes { nanowebm, } -export type TenorMedia = { - preview: string; - url: string; - dims: number[]; - size: number; -}; - -export type TenorGif = { - created: number; - hasaudio: boolean; - id: string; - media: { [type in keyof typeof GifMediaTypes]: TenorMedia }[]; - tags: string[]; - title: string; - itemurl: string; - hascaption: boolean; - url: string; -}; - -export type TenorCategory = { - searchterm: string; - path: string; - image: string; - name: string; -}; - -export type TenorCategoriesResults = { - tags: TenorCategory[]; -}; - -export type TenorTrendingResults = { - next: string; - results: TenorGif[]; - locale: string; -}; - -export type TenorSearchResults = { - next: string; - results: TenorGif[]; -}; - export interface GifResponse { id: string; title: string; diff --git a/src/schemas/api/integrations/index.ts b/src/schemas/api/integrations/index.ts new file mode 100644
index 00000000..ab738395 --- /dev/null +++ b/src/schemas/api/integrations/index.ts
@@ -0,0 +1,19 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2026 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/>. +*/ + +export * from "./Gifs"; diff --git a/src/schemas/responses/index.ts b/src/schemas/responses/index.ts
index c430cb17..95fce7bd 100644 --- a/src/schemas/responses/index.ts +++ b/src/schemas/responses/index.ts
@@ -54,7 +54,6 @@ export * from "./PreloadMessagesResponseSchema"; export * from "./RefreshUrlsResponse"; export * from "./SettingsProtoUpdateResponse"; export * from "./TeamListResponse"; -export * from "./Tenor"; export * from "./TokenResponse"; export * from "./TypedResponses"; export * from "./UpdatesResponse"; diff --git a/src/util/util/Gifs.ts b/src/util/util/Gifs.ts deleted file mode 100644
index 22b85168..00000000 --- a/src/util/util/Gifs.ts +++ /dev/null
@@ -1,25 +0,0 @@ -import { HTTPError } from "lambert-server/HTTPError"; -import { Config } from "./Config"; -import { TenorGif } from "@spacebar/schemas"; - -// @deprecated -export function parseGifResult(result: TenorGif) { - return { - id: result.id, - title: result.title, - url: result.itemurl, - src: result.media[0].mp4.url, - gif_src: result.media[0].gif.url, - width: result.media[0].mp4.dims[0], - height: result.media[0].mp4.dims[1], - preview: result.media[0].mp4.preview, - }; -} - -export function getGifApiKey() { - const { enabled, provider, apiKey } = Config.get().gif; - if (!enabled) throw new HTTPError(`Gifs are disabled`); - if (provider !== "tenor" || !apiKey) throw new HTTPError(`${provider} gif provider not supported`); - - return apiKey; -} diff --git a/src/util/util/index.ts b/src/util/util/index.ts
index fb7c209c..c2122755 100644 --- a/src/util/util/index.ts +++ b/src/util/util/index.ts
@@ -41,7 +41,6 @@ export * from "./Token"; export * from "./TraverseDirectory"; export * from "./WebAuthn"; export * from "./ChannelFlags"; -export * from "./Gifs"; export * from "./Application"; export * from "./NameValidation"; export * from "./Version"; diff --git a/tsconfig.json b/tsconfig.json
index 6f96802f..be2dd2c1 100644 --- a/tsconfig.json +++ b/tsconfig.json
@@ -48,6 +48,8 @@ "@spacebar/webrtc*": ["./src/webrtc*"], "@spacebar/schemas": ["./src/schemas"], // Required for stable tsc, typescript-go doesn't need this "@spacebar/schemas*": ["./src/schemas*"], + "@spacebar/integrations": ["./src/integrations"], // Required for stable tsc, typescript-go doesn't need this + "@spacebar/integrations*": ["./src/integrations*"], "lambert-server": ["./src/util/util/lambert-server"], // Required for stable tsc, typescript-go doesn't need this "lambert-server*": ["./src/util/util/lambert-server*"], } /* Specify a set of entries that re-map imports to additional lookup locations. */,