add license system and ui

This commit is contained in:
miloschwartz
2025-04-27 13:03:00 -04:00
parent 80d76befc9
commit 4819f410e6
46 changed files with 2159 additions and 94 deletions

View File

@@ -7,6 +7,7 @@ import config from "@server/lib/config";
import db from "@server/db";
import { count } from "drizzle-orm";
import { users } from "@server/db/schemas";
import license from "@server/license/license";
export type IsSupporterKeyVisibleResponse = {
visible: boolean;
@@ -26,6 +27,12 @@ export async function isSupporterKeyVisible(
let visible = !hidden && key?.valid !== true;
const licenseStatus = await license.check();
if (licenseStatus.isLicenseValid) {
visible = false;
}
if (key?.tier === "Limited Supporter") {
const [numUsers] = await db.select({ count: count() }).from(users);