diff --git a/assets/login.webp b/assets/login.webp deleted file mode 100644 index 9eb17e93..00000000 Binary files a/assets/login.webp and /dev/null differ diff --git a/assets/login_mobile.webp b/assets/login_mobile.webp deleted file mode 100644 index dde14ae8..00000000 Binary files a/assets/login_mobile.webp and /dev/null differ diff --git a/assets/main.webp b/assets/main.webp deleted file mode 100644 index 27586dc6..00000000 Binary files a/assets/main.webp and /dev/null differ diff --git a/assets/redirect.webp b/assets/redirect.webp deleted file mode 100644 index c6eaa186..00000000 Binary files a/assets/redirect.webp and /dev/null differ diff --git a/assets/redirect_mobile.webp b/assets/redirect_mobile.webp deleted file mode 100644 index e3811bb9..00000000 Binary files a/assets/redirect_mobile.webp and /dev/null differ diff --git a/assets/register.webp b/assets/register.webp deleted file mode 100644 index 4f5cfe74..00000000 Binary files a/assets/register.webp and /dev/null differ diff --git a/assets/register_mobile.webp b/assets/register_mobile.webp deleted file mode 100644 index ab5559e3..00000000 Binary files a/assets/register_mobile.webp and /dev/null differ diff --git a/assets/soapbox.webp b/assets/soapbox.webp deleted file mode 100644 index 935d0c65..00000000 Binary files a/assets/soapbox.webp and /dev/null differ diff --git a/database/datasource.ts b/database/datasource.ts deleted file mode 100644 index f6d5f8b3..00000000 --- a/database/datasource.ts +++ /dev/null @@ -1,10 +0,0 @@ -// import { Queue } from "bullmq"; - -/* const federationQueue = new Queue("federation", { - connection: { - host: config.redis.queue.host, - port: Number(config.redis.queue.port), - password: config.redis.queue.password || undefined, - db: config.redis.queue.database || undefined, - }, -}); */ diff --git a/database/entities/user.ts b/database/entities/user.ts index 3c8b67dc..a5a2045d 100644 --- a/database/entities/user.ts +++ b/database/entities/user.ts @@ -337,28 +337,6 @@ export const findManyUsers = async ( return output.map((user) => transformOutputToUserWithRelations(user)); }; -export const findFirstUser = async ( - query: Parameters[0], -): Promise => { - const output = await db.query.Users.findFirst({ - ...query, - with: { - ...userRelations, - ...query?.with, - }, - extras: { - ...userExtras, - ...query?.extras, - }, - }); - - if (!output) { - return null; - } - - return transformOutputToUserWithRelations(output); -}; - /** * Resolves a WebFinger identifier to a user. * @param identifier Either a UUID or a username diff --git a/packages/database-interface/user.ts b/packages/database-interface/user.ts index 0d3f4a0d..c8dbf6e8 100644 --- a/packages/database-interface/user.ts +++ b/packages/database-interface/user.ts @@ -24,7 +24,6 @@ import { objectToInboxRequest } from "~/database/entities/federation"; import { addInstanceIfNotExists } from "~/database/entities/instance"; import { type UserWithRelations, - findFirstUser, findManyUsers, } from "~/database/entities/user"; import { db } from "~/drizzle/db"; @@ -75,15 +74,15 @@ export class User extends BaseInterface { sql: SQL | undefined, orderBy: SQL | undefined = desc(Users.id), ) { - const found = await findFirstUser({ + const found = await findManyUsers({ where: sql, orderBy, }); - if (!found) { + if (!found[0]) { return null; } - return new User(found); + return new User(found[0]); } static async manyFromSql( diff --git a/packages/log-manager/index.ts b/packages/log-manager/index.ts index 601e3954..86e3e8a3 100644 --- a/packages/log-manager/index.ts +++ b/packages/log-manager/index.ts @@ -226,66 +226,6 @@ export class LogManager { } await this.log(LogLevel.Info, "Request", string); } - - /* - * Logs a request to the output - * @param req Request to log - * @param ip IP of the request - * @param logAllDetails Whether to log all details of the request - */ - /**async logRequest(req: Request, ip?: string, logAllDetails = false) { - let string = ip ? `${ip}: ` : ""; - - string += `${req.method} ${req.url}`; - - if (logAllDetails) { - string += "\n"; - string += " [Headers]\n"; - // Pretty print headers - for (const [key, value] of req.headers.entries()) { - string += ` ${key}: ${value}\n`; - } - - // Pretty print body - string += " [Body]\n"; - const contentType = req.headers.get("Content-Type"); - - if (contentType?.includes("application/json")) { - try { - const json = await req.clone().json(); - const stringified = JSON.stringify(json, null, 4) - .split("\n") - .map((line) => ` ${line}`) - .join("\n"); - - string += `${stringified}\n`; - } catch { - string += ` [Invalid JSON] (raw: ${await req - .clone() - .text()})\n`; - } - } else if ( - contentType && - (contentType.includes("application/x-www-form-urlencoded") || - contentType.includes("multipart/form-data")) - ) { - const formData = await req.clone().formData(); - for (const [key, value] of formData.entries()) { - if (value.toString().length < 300) { - string += ` ${key}: ${value.toString()}\n`; - } else { - string += ` ${key}: <${ - value.toString().length - } bytes>\n`; - } - } - } else { - const text = await req.text(); - string += ` ${text}\n`; - } - } - await this.log(LogLevel.Info, "Request", string); - } */ } /** diff --git a/server/api/api/_fe/config/index.ts b/server/api/api/_fe/config/index.ts deleted file mode 100644 index 1f0038bf..00000000 --- a/server/api/api/_fe/config/index.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { applyConfig } from "@/api"; -import { jsonResponse } from "@/response"; -import type { Hono } from "hono"; -import { config } from "~/packages/config-manager"; - -export const meta = applyConfig({ - allowedMethods: ["GET"], - ratelimits: { - max: 60, - duration: 120, - }, - route: "/api/_fe/config", - auth: { - required: false, - }, -}); - -export default (app: Hono) => - app.on(meta.allowedMethods, meta.route, (_context) => { - return jsonResponse({ - http: { - bind: config.http.bind, - bind_port: config.http.bind_port, - base_url: config.http.base_url, - url: config.http.bind.includes("http") - ? `${config.http.bind}:${config.http.bind_port}` - : `http://${config.http.bind}:${config.http.bind_port}`, - }, - }); - }); diff --git a/utils/redis.ts b/utils/redis.ts deleted file mode 100644 index 00bde668..00000000 --- a/utils/redis.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* import type { Prisma } from "@/prisma/client"; -import chalk from "chalk"; -import { config } from "config-manager"; -import Redis from "ioredis"; -import { createPrismaRedisCache } from "prisma-redis-middleware"; - -const cacheRedis = config.redis.cache.enabled - ? new Redis({ - host: config.redis.cache.host, - port: Number(config.redis.cache.port), - password: config.redis.cache.password, - db: Number(config.redis.cache.database), - }) - : null; - -cacheRedis?.on("error", (e) => { - console.log(e); -}); - -export { cacheRedis }; - -export const initializeRedisCache = async () => { - if (cacheRedis) { - // Test connection - try { - await cacheRedis.ping(); - } catch (e) { - console.error( - `${chalk.red("✗")} ${chalk.bold( - "Error while connecting to Redis", - )}`, - ); - throw e; - } - - console.log(`${chalk.green("✓")} ${chalk.bold("Connected to Redis")}`); - - const cacheMiddleware: Prisma.Middleware = createPrismaRedisCache({ - storage: { - type: "redis", - options: { - client: cacheRedis, - invalidation: { - referencesTTL: 300, - }, - }, - }, - cacheTime: 300, - onError: (e) => { - console.error(e); - }, - }); - - return cacheMiddleware; - } - - return null; -}; - */