mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Added lookup for cloud account. Added SessionModal component.
This commit is contained in:
parent
caf04015bb
commit
f733690d38
7 changed files with 79 additions and 48 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { z } from 'zod';
|
||||
import redis from '@/lib/redis';
|
||||
import { canCreateTeamWebsite, canCreateWebsite } from '@/permissions';
|
||||
import { json, unauthorized } from '@/lib/response';
|
||||
import { uuid } from '@/lib/crypto';
|
||||
|
|
@ -50,11 +51,15 @@ export async function POST(request: Request) {
|
|||
|
||||
const { id, name, domain, shareId, teamId } = body;
|
||||
|
||||
if (process.env.CLOUD_MODE && !teamId && !auth.user.hasSubscription) {
|
||||
const count = await getWebsiteCount(auth.user.id);
|
||||
if (process.env.CLOUD_MODE && !teamId) {
|
||||
const account = await redis.client.get(`account:${auth.user.id}`);
|
||||
|
||||
if (count >= CLOUD_WEBSITE_LIMIT) {
|
||||
return unauthorized({ message: 'Website limit reached.' });
|
||||
if (!account?.hasSubscription) {
|
||||
const count = await getWebsiteCount(auth.user.id);
|
||||
|
||||
if (count >= CLOUD_WEBSITE_LIMIT) {
|
||||
return unauthorized({ message: 'Website limit reached.' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue