mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-23 06:45:27 +02:00
Compare commits
6 Commits
fix/cmdi-q
...
fix/collap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b102fac56 | ||
|
|
b2ade17487 | ||
|
|
ffe62bca0e | ||
|
|
d3f522b7a6 | ||
|
|
4aee66b2d1 | ||
|
|
d02f34f9d4 |
@@ -648,7 +648,7 @@ function SidebarLogo() {
|
|||||||
</SidebarMenuButton>
|
</SidebarMenuButton>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent
|
<DropdownMenuContent
|
||||||
className="rounded-lg max-h-[min(70vh,28rem)] flex flex-col"
|
className="w-64 rounded-lg max-h-[min(70vh,28rem)] flex flex-col"
|
||||||
align="start"
|
align="start"
|
||||||
side={isMobile ? "bottom" : "right"}
|
side={isMobile ? "bottom" : "right"}
|
||||||
sideOffset={4}
|
sideOffset={4}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
findRegistryById,
|
findRegistryById,
|
||||||
IS_CLOUD,
|
IS_CLOUD,
|
||||||
removeRegistry,
|
removeRegistry,
|
||||||
|
safeDockerLoginCommand,
|
||||||
updateRegistry,
|
updateRegistry,
|
||||||
} from "@dokploy/server";
|
} from "@dokploy/server";
|
||||||
import { db } from "@dokploy/server/db";
|
import { db } from "@dokploy/server/db";
|
||||||
@@ -122,7 +123,11 @@ export const registryRouter = createTRPCRouter({
|
|||||||
if (input.serverId && input.serverId !== "none") {
|
if (input.serverId && input.serverId !== "none") {
|
||||||
await execAsyncRemote(
|
await execAsyncRemote(
|
||||||
input.serverId,
|
input.serverId,
|
||||||
`echo ${input.password} | docker ${args.join(" ")}`,
|
safeDockerLoginCommand(
|
||||||
|
input.registryUrl,
|
||||||
|
input.username,
|
||||||
|
input.password,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
await execFileAsync("docker", args, {
|
await execFileAsync("docker", args, {
|
||||||
@@ -182,7 +187,11 @@ export const registryRouter = createTRPCRouter({
|
|||||||
if (input.serverId && input.serverId !== "none") {
|
if (input.serverId && input.serverId !== "none") {
|
||||||
await execAsyncRemote(
|
await execAsyncRemote(
|
||||||
input.serverId,
|
input.serverId,
|
||||||
`echo ${registryData.password} | docker ${args.join(" ")}`,
|
safeDockerLoginCommand(
|
||||||
|
registryData.registryUrl,
|
||||||
|
registryData.username,
|
||||||
|
registryData.password,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
await execFileAsync("docker", args, {
|
await execFileAsync("docker", args, {
|
||||||
|
|||||||
@@ -413,6 +413,14 @@ export const serverRouter = createTRPCRouter({
|
|||||||
.input(apiRemoveServer)
|
.input(apiRemoveServer)
|
||||||
.mutation(async ({ input, ctx }) => {
|
.mutation(async ({ input, ctx }) => {
|
||||||
try {
|
try {
|
||||||
|
const currentServer = await findServerById(input.serverId);
|
||||||
|
if (currentServer.organizationId !== ctx.session.activeOrganizationId) {
|
||||||
|
throw new TRPCError({
|
||||||
|
code: "UNAUTHORIZED",
|
||||||
|
message: "You are not authorized to delete this server",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const activeServers = await haveActiveServices(input.serverId);
|
const activeServers = await haveActiveServices(input.serverId);
|
||||||
|
|
||||||
if (activeServers) {
|
if (activeServers) {
|
||||||
@@ -421,7 +429,6 @@ export const serverRouter = createTRPCRouter({
|
|||||||
message: "Server has active services, please delete them first",
|
message: "Server has active services, please delete them first",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const currentServer = await findServerById(input.serverId);
|
|
||||||
await audit(ctx, {
|
await audit(ctx, {
|
||||||
action: "delete",
|
action: "delete",
|
||||||
resourceType: "server",
|
resourceType: "server",
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export const apiCreateCertificate = createInsertSchema(certificates, {
|
|||||||
privateKey: z.string().min(1),
|
privateKey: z.string().min(1),
|
||||||
autoRenew: z.boolean().optional(),
|
autoRenew: z.boolean().optional(),
|
||||||
serverId: z.string().optional(),
|
serverId: z.string().optional(),
|
||||||
}).omit({ certificatePath: true });
|
});
|
||||||
|
|
||||||
export const apiFindCertificate = z.object({
|
export const apiFindCertificate = z.object({
|
||||||
certificateId: z.string().min(1),
|
certificateId: z.string().min(1),
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export const schedulesRelations = relations(schedules, ({ one, many }) => ({
|
|||||||
|
|
||||||
export const createScheduleSchema = createInsertSchema(schedules, {
|
export const createScheduleSchema = createInsertSchema(schedules, {
|
||||||
scheduleType: z.enum(["application", "compose", "server", "dokploy-server"]),
|
scheduleType: z.enum(["application", "compose", "server", "dokploy-server"]),
|
||||||
}).omit({ appName: true });
|
});
|
||||||
|
|
||||||
export const updateScheduleSchema = createScheduleSchema.extend({
|
export const updateScheduleSchema = createScheduleSchema.extend({
|
||||||
scheduleId: z.string().min(1),
|
scheduleId: z.string().min(1),
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { quote } from "shell-quote";
|
|
||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
import { IS_CLOUD, paths } from "../constants";
|
import { IS_CLOUD, paths } from "../constants";
|
||||||
import { db } from "../db";
|
import { db } from "../db";
|
||||||
@@ -143,7 +142,7 @@ export const deleteSchedule = async (scheduleId: string) => {
|
|||||||
const { SCHEDULES_PATH } = paths(!!serverId);
|
const { SCHEDULES_PATH } = paths(!!serverId);
|
||||||
|
|
||||||
const fullPath = path.join(SCHEDULES_PATH, schedule?.appName || "");
|
const fullPath = path.join(SCHEDULES_PATH, schedule?.appName || "");
|
||||||
const command = `rm -rf ${quote([fullPath])}`;
|
const command = `rm -rf ${fullPath}`;
|
||||||
if (serverId) {
|
if (serverId) {
|
||||||
await execAsyncRemote(serverId, command);
|
await execAsyncRemote(serverId, command);
|
||||||
} else {
|
} else {
|
||||||
@@ -199,13 +198,12 @@ const handleScript = async (schedule: Schedule) => {
|
|||||||
${schedule?.script || ""}`;
|
${schedule?.script || ""}`;
|
||||||
|
|
||||||
const encodedContent = encodeBase64(scriptWithPid);
|
const encodedContent = encodeBase64(scriptWithPid);
|
||||||
const scriptPath = `${fullPath}/script.sh`;
|
|
||||||
const script = `
|
const script = `
|
||||||
mkdir -p ${quote([fullPath])}
|
mkdir -p ${fullPath}
|
||||||
rm -f ${quote([scriptPath])}
|
rm -f ${fullPath}/script.sh
|
||||||
touch ${quote([scriptPath])}
|
touch ${fullPath}/script.sh
|
||||||
chmod +x ${quote([scriptPath])}
|
chmod +x ${fullPath}/script.sh
|
||||||
echo "${encodedContent}" | base64 -d > ${quote([scriptPath])}
|
echo "${encodedContent}" | base64 -d > ${fullPath}/script.sh
|
||||||
`;
|
`;
|
||||||
|
|
||||||
if (schedule?.scheduleType === "dokploy-server") {
|
if (schedule?.scheduleType === "dokploy-server") {
|
||||||
|
|||||||
Reference in New Issue
Block a user