From 2307346ae35361e26f4adc51696e68781ece7426 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 17 Nov 2024 18:23:27 -0600 Subject: [PATCH] refactor: add validation to prevent run on cloud --- apps/dokploy/server/api/routers/admin.ts | 6 ++++++ apps/dokploy/server/api/routers/server.ts | 3 +++ 2 files changed, 9 insertions(+) diff --git a/apps/dokploy/server/api/routers/admin.ts b/apps/dokploy/server/api/routers/admin.ts index d910f2230..6029c7136 100644 --- a/apps/dokploy/server/api/routers/admin.ts +++ b/apps/dokploy/server/api/routers/admin.ts @@ -31,6 +31,12 @@ export const adminRouter = createTRPCRouter({ update: adminProcedure .input(apiUpdateAdmin) .mutation(async ({ input, ctx }) => { + if (ctx.user.rol === "user") { + throw new TRPCError({ + code: "UNAUTHORIZED", + message: "You are not allowed to update this admin", + }); + } const { authId } = await findAdminById(ctx.user.adminId); return updateAdmin(authId, input); }), diff --git a/apps/dokploy/server/api/routers/server.ts b/apps/dokploy/server/api/routers/server.ts index 97746131c..0d4ef87f3 100644 --- a/apps/dokploy/server/api/routers/server.ts +++ b/apps/dokploy/server/api/routers/server.ts @@ -183,6 +183,9 @@ export const serverRouter = createTRPCRouter({ } }), publicIp: protectedProcedure.query(async ({ ctx }) => { + if (IS_CLOUD) { + return ""; + } const ip = await getPublicIpWithFallback(); return ip; }),