removed all free tier restrictions

This commit is contained in:
2026-01-29 15:20:42 +00:00
parent 232e00a2b0
commit 2aa13e34bf
21 changed files with 413 additions and 639 deletions

View File

@@ -1,7 +1,7 @@
import { randomUUID } from "node:crypto";
import sharp from "sharp";
import type { AuthedRequest } from "../../auth/middleware";
import { getSubscriptionByUserId } from "../../db/queries";
// import { getSubscriptionByUserId } from "../../db/queries";
import { s3Client, s3Endpoint, s3PublicUrl } from "../../s3";
const MAX_FILE_SIZE = 5 * 1024 * 1024;
@@ -42,21 +42,21 @@ export default async function uploadAvatar(req: AuthedRequest) {
const inputBuffer = Buffer.from(await file.arrayBuffer());
// check if user is pro
const subscription = await getSubscriptionByUserId(req.userId);
const isPro = subscription?.status === "active";
// const subscription = await getSubscriptionByUserId(req.userId);
// const isPro = subscription?.status === "active";
// block animated avatars for free users
if (!isPro && file.type === "image/gif") {
const animated = await isAnimatedGIF(inputBuffer);
if (animated) {
return new Response(
JSON.stringify({
error: "Animated avatars are only available on Pro. Upgrade to upload animated avatars.",
}),
{ status: 403, headers: { "Content-Type": "application/json" } },
);
}
}
// if (!isPro && file.type === "image/gif") {
// const animated = await isAnimatedGIF(inputBuffer);
// if (animated) {
// return new Response(
// JSON.stringify({
// error: "Animated avatars are only available on Pro. Upgrade to upload animated avatars.",
// }),
// { status: 403, headers: { "Content-Type": "application/json" } },
// );
// }
// }
const isGIF = file.type === "image/gif";
const outputExtension = isGIF ? "gif" : "png";