Skip to content

Commit f3356cf

Browse files
authored
Merge pull request #3938 from Dokploy/canary
🚀 Release v0.28.5
2 parents 2362778 + 6e67864 commit f3356cf

File tree

32 files changed

+317
-183
lines changed

32 files changed

+317
-183
lines changed

apps/dokploy/components/dashboard/search-command.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
CommandList,
2424
CommandSeparator,
2525
} from "@/components/ui/command";
26-
import { authClient } from "@/lib/auth-client";
2726
import { api } from "@/utils/api";
2827
import { StatusTooltip } from "../shared/status-tooltip";
2928

@@ -56,7 +55,7 @@ export const SearchCommand = () => {
5655
const router = useRouter();
5756
const [open, setOpen] = React.useState(false);
5857
const [search, setSearch] = React.useState("");
59-
const { data: session } = authClient.useSession();
58+
const { data: session } = api.user.session.useQuery();
6059
const { data } = api.project.all.useQuery(undefined, {
6160
enabled: !!session,
6261
});

apps/dokploy/components/dashboard/settings/git/github/add-github-provider.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ import {
1212
} from "@/components/ui/dialog";
1313
import { Input } from "@/components/ui/input";
1414
import { Switch } from "@/components/ui/switch";
15-
import { authClient } from "@/lib/auth-client";
1615
import { api } from "@/utils/api";
1716

1817
export const AddGithubProvider = () => {
1918
const [isOpen, setIsOpen] = useState(false);
2019
const { data: activeOrganization } = api.organization.active.useQuery();
2120

22-
const { data: session } = authClient.useSession();
21+
const { data: session } = api.user.session.useQuery();
2322
const { data } = api.user.get.useQuery();
2423
const [manifest, setManifest] = useState("");
2524
const [isOrganization, setIsOrganization] = useState(false);
@@ -99,8 +98,8 @@ export const AddGithubProvider = () => {
9998
<form
10099
action={
101100
isOrganization
102-
? `https://github.com/organizations/${organizationName}/settings/apps/new?state=gh_init:${activeOrganization?.id}`
103-
: `https://github.com/settings/apps/new?state=gh_init:${activeOrganization?.id}`
101+
? `https://github.com/organizations/${organizationName}/settings/apps/new?state=gh_init:${activeOrganization?.id}:${session?.user?.id ?? ""}`
102+
: `https://github.com/settings/apps/new?state=gh_init:${activeOrganization?.id}:${session?.user?.id ?? ""}`
104103
}
105104
method="post"
106105
>

apps/dokploy/components/dashboard/settings/users/show-users.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const ShowUsers = () => {
3737
const { mutateAsync } = api.user.remove.useMutation();
3838

3939
const utils = api.useUtils();
40-
const { data: session } = authClient.useSession();
40+
const { data: session } = api.user.session.useQuery();
4141

4242
return (
4343
<div className="w-full">

apps/dokploy/components/layouts/side.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ function SidebarLogo() {
546546
const { state } = useSidebar();
547547
const { data: isCloud } = api.settings.isCloud.useQuery();
548548
const { data: user } = api.user.get.useQuery();
549-
const { data: session } = authClient.useSession();
549+
const { data: session } = api.user.session.useQuery();
550550
const {
551551
data: organizations,
552552
refetch,

apps/dokploy/components/shared/code-editor.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import { yaml } from "@codemirror/lang-yaml";
99
import { StreamLanguage } from "@codemirror/language";
1010
import { properties } from "@codemirror/legacy-modes/mode/properties";
1111
import { shell } from "@codemirror/legacy-modes/mode/shell";
12-
import { EditorView } from "@codemirror/view";
12+
import { search, searchKeymap } from "@codemirror/search";
13+
import { EditorView, keymap } from "@codemirror/view";
1314
import { githubDark, githubLight } from "@uiw/codemirror-theme-github";
1415
import CodeMirror, { type ReactCodeMirrorProps } from "@uiw/react-codemirror";
1516
import { useTheme } from "next-themes";
@@ -155,6 +156,8 @@ export const CodeEditor = ({
155156
}}
156157
theme={resolvedTheme === "dark" ? githubDark : githubLight}
157158
extensions={[
159+
search(),
160+
keymap.of(searchKeymap),
158161
language === "yaml"
159162
? yaml()
160163
: language === "json"

apps/dokploy/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dokploy",
3-
"version": "v0.28.4",
3+
"version": "v0.28.5",
44
"private": true,
55
"license": "Apache-2.0",
66
"type": "module",
@@ -53,7 +53,8 @@
5353
"@codemirror/lang-yaml": "^6.1.2",
5454
"@codemirror/language": "^6.11.0",
5555
"@codemirror/legacy-modes": "6.4.0",
56-
"@codemirror/view": "6.29.0",
56+
"@codemirror/search": "^6.6.0",
57+
"@codemirror/view": "^6.39.15",
5758
"@dokploy/server": "workspace:*",
5859
"@dokploy/trpc-openapi": "0.0.17",
5960
"@faker-js/faker": "^8.4.1",

apps/dokploy/pages/api/providers/github/setup.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,29 @@ type Query = {
1010
state: string;
1111
installation_id: string;
1212
setup_action: string;
13-
userId: string;
1413
};
1514

1615
export default async function handler(
1716
req: NextApiRequest,
1817
res: NextApiResponse,
1918
) {
20-
const { code, state, installation_id, userId }: Query = req.query as Query;
19+
const { code, state, installation_id }: Query = req.query as Query;
2120

2221
if (!code) {
2322
return res.status(400).json({ error: "Missing code parameter" });
2423
}
25-
const [action, value] = state?.split(":");
26-
// Value could be the organizationId or the githubProviderId
24+
const [action, ...rest] = state?.split(":");
25+
// For gh_init: rest[0] = organizationId, rest[1] = userId
26+
// For gh_setup: rest[0] = githubProviderId
2727

2828
if (action === "gh_init") {
29+
const organizationId = rest[0];
30+
const userId = rest[1] || (req.query.userId as string);
31+
32+
if (!userId) {
33+
return res.status(400).json({ error: "Missing userId parameter" });
34+
}
35+
2936
const octokit = new Octokit({});
3037
const { data } = await octokit.request(
3138
"POST /app-manifests/{code}/conversions",
@@ -44,7 +51,7 @@ export default async function handler(
4451
githubWebhookSecret: data.webhook_secret,
4552
githubPrivateKey: data.pem,
4653
},
47-
value as string,
54+
organizationId as string,
4855
userId,
4956
);
5057
} else if (action === "gh_setup") {
@@ -53,7 +60,7 @@ export default async function handler(
5360
.set({
5461
githubInstallationId: installation_id,
5562
})
56-
.where(eq(github.githubId, value as string))
63+
.where(eq(github.githubId, rest[0] as string))
5764
.returning();
5865
}
5966

apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ const EnvironmentPage = (
777777
}
778778
if (success > 0) {
779779
toast.success(
780-
`${success} service${success !== 1 ? "s" : ""} deployed successfully`,
780+
`${success} service${success !== 1 ? "s" : ""} queued for deployment`,
781781
);
782782
}
783783
if (failed > 0) {

apps/dokploy/server/api/routers/settings.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ export const settingsRouter = createTRPCRouter({
149149
// Check if port 8080 is already in use before enabling dashboard
150150
const portCheck = await checkPortInUse(8080, input.serverId);
151151
if (portCheck.isInUse) {
152-
const conflictingContainer = portCheck.conflictingContainer
153-
? ` by container "${portCheck.conflictingContainer}"`
152+
const conflictInfo = portCheck.conflictingContainer
153+
? ` by ${portCheck.conflictingContainer}`
154154
: "";
155155
throw new TRPCError({
156156
code: "CONFLICT",
157-
message: `Port 8080 is already in use${conflictingContainer}. Please stop the conflicting service or use a different port for the Traefik dashboard.`,
157+
message: `Port 8080 is already in use${conflictInfo}. Please stop the conflicting service or use a different port for the Traefik dashboard.`,
158158
});
159159
}
160160
newPorts.push({

apps/dokploy/server/api/routers/user.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ export const userRouter = createTRPCRouter({
101101

102102
return memberResult;
103103
}),
104+
session: protectedProcedure.query(async ({ ctx }) => {
105+
return {
106+
user: {
107+
id: ctx.user.id,
108+
},
109+
session: {
110+
activeOrganizationId: ctx.session.activeOrganizationId,
111+
},
112+
};
113+
}),
104114
get: protectedProcedure.query(async ({ ctx }) => {
105115
const memberResult = await db.query.member.findFirst({
106116
where: and(

0 commit comments

Comments
 (0)