mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
removed all free tier restrictions
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user