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:
parent
04235fb6c9
commit
2307346ae3
@ -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);
|
||||
}),
|
||||
|
@ -183,6 +183,9 @@ export const serverRouter = createTRPCRouter({
|
||||
}
|
||||
}),
|
||||
publicIp: protectedProcedure.query(async ({ ctx }) => {
|
||||
if (IS_CLOUD) {
|
||||
return "";
|
||||
}
|
||||
const ip = await getPublicIpWithFallback();
|
||||
return ip;
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user