mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: add validation to prevent run on cloud
This commit is contained in:
@@ -31,6 +31,12 @@ export const adminRouter = createTRPCRouter({
|
|||||||
update: adminProcedure
|
update: adminProcedure
|
||||||
.input(apiUpdateAdmin)
|
.input(apiUpdateAdmin)
|
||||||
.mutation(async ({ input, ctx }) => {
|
.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);
|
const { authId } = await findAdminById(ctx.user.adminId);
|
||||||
return updateAdmin(authId, input);
|
return updateAdmin(authId, input);
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -183,6 +183,9 @@ export const serverRouter = createTRPCRouter({
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
publicIp: protectedProcedure.query(async ({ ctx }) => {
|
publicIp: protectedProcedure.query(async ({ ctx }) => {
|
||||||
|
if (IS_CLOUD) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
const ip = await getPublicIpWithFallback();
|
const ip = await getPublicIpWithFallback();
|
||||||
return ip;
|
return ip;
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user