mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-17 02:46:22 +02:00
✨ Self-Hosting Update (#842)
This commit is contained in:
parent
3e616d1e41
commit
7a5f9ae474
51 changed files with 945 additions and 781 deletions
|
@ -19,7 +19,8 @@ export const middleware = t.middleware;
|
|||
|
||||
export const possiblyPublicProcedure = t.procedure.use(
|
||||
middleware(async ({ ctx, next }) => {
|
||||
if (process.env.AUTH_REQUIRED === "true" && ctx.user.isGuest) {
|
||||
// On self-hosted instances, these procedures require login
|
||||
if (ctx.isSelfHosted && ctx.user.isGuest) {
|
||||
throw new TRPCError({
|
||||
code: "UNAUTHORIZED",
|
||||
message: "Login is required",
|
||||
|
@ -38,6 +39,11 @@ export const proProcedure = t.procedure.use(
|
|||
});
|
||||
}
|
||||
|
||||
if (ctx.isSelfHosted) {
|
||||
// Self-hosted instances don't have paid subscriptions
|
||||
return next();
|
||||
}
|
||||
|
||||
const { active: isPro } = await getSubscriptionStatus(ctx.user.id);
|
||||
|
||||
if (!isPro) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue