mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-05 14:05:30 +02:00
Merge branch 'canary' into feat/label-previews
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { appRouter } from "@/server/api/root";
|
||||
import { createTRPCContext } from "@/server/api/trpc";
|
||||
import { validateRequest } from "@dokploy/server";
|
||||
import { createOpenApiNextHandler } from "@dokploy/trpc-openapi";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { appRouter } from "@/server/api/root";
|
||||
import { createTRPCContext } from "@/server/api/trpc";
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const { session, user } = await validateRequest(req);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { IS_CLOUD, shouldDeploy } from "@dokploy/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { db } from "@/server/db";
|
||||
import { applications } from "@/server/db/schema";
|
||||
import type { DeploymentJob } from "@/server/queues/queue-types";
|
||||
import { myQueue } from "@/server/queues/queueSetup";
|
||||
import { deploy } from "@/server/utils/deploy";
|
||||
import { IS_CLOUD, shouldDeploy } from "@dokploy/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { IS_CLOUD, shouldDeploy } from "@dokploy/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { db } from "@/server/db";
|
||||
import { compose } from "@/server/db/schema";
|
||||
import type { DeploymentJob } from "@/server/queues/queue-types";
|
||||
import { myQueue } from "@/server/queues/queueSetup";
|
||||
import { deploy } from "@/server/utils/deploy";
|
||||
import { IS_CLOUD, shouldDeploy } from "@dokploy/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import {
|
||||
extractBranchName,
|
||||
extractCommitMessage,
|
||||
extractCommitedPaths,
|
||||
extractCommitMessage,
|
||||
extractHash,
|
||||
getProviderByHeader,
|
||||
} from "../[refreshToken]";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { updateGitea } from "@dokploy/server";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { type Gitea, findGitea, redirectWithError } from "./helper";
|
||||
import { findGitea, type Gitea, redirectWithError } from "./helper";
|
||||
|
||||
// Helper to parse the state parameter
|
||||
const parseState = (state: string): string | null => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { db } from "@/server/db";
|
||||
import { github } from "@/server/db/schema";
|
||||
import { createGithub } from "@dokploy/server";
|
||||
import { eq } from "drizzle-orm";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { Octokit } from "octokit";
|
||||
import { db } from "@/server/db";
|
||||
import { github } from "@/server/db/schema";
|
||||
|
||||
type Query = {
|
||||
code: string;
|
||||
|
||||
@@ -12,12 +12,30 @@ export default async function handler(
|
||||
}
|
||||
|
||||
const gitlab = await findGitlabById(gitlabId as string);
|
||||
const gitlabUrl = new URL(gitlab.gitlabUrl);
|
||||
|
||||
const response = await fetch(`${gitlab.gitlabUrl}/oauth/token`, {
|
||||
const headers: HeadersInit = {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
};
|
||||
|
||||
// In case of basic auth being present in the URL, we need to remove it from the URL
|
||||
// and add it to the Authorization header.
|
||||
if (gitlabUrl.username && gitlabUrl.password) {
|
||||
headers.Authorization = `Basic ${Buffer.from(`${gitlabUrl.username}:${gitlabUrl.password}`).toString("base64")}`;
|
||||
}
|
||||
|
||||
const url =
|
||||
gitlabUrl.username && gitlabUrl.password
|
||||
? new URL(gitlabUrl, {
|
||||
...gitlabUrl,
|
||||
username: "",
|
||||
password: "",
|
||||
}).toString()
|
||||
: gitlabUrl.toString();
|
||||
|
||||
const response = await fetch(`${url}/oauth/token`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
headers,
|
||||
body: new URLSearchParams({
|
||||
client_id: gitlab.applicationId as string,
|
||||
client_secret: gitlab.secret as string,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { buffer } from "node:stream/consumers";
|
||||
import { db } from "@/server/db";
|
||||
import { organization, server, users_temp } from "@/server/db/schema";
|
||||
import { type Server, findUserById } from "@dokploy/server";
|
||||
import { findUserById, type Server } from "@dokploy/server";
|
||||
import { asc, eq } from "drizzle-orm";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import Stripe from "stripe";
|
||||
import { db } from "@/server/db";
|
||||
import { organization, server, users_temp } from "@/server/db/schema";
|
||||
|
||||
const endpointSecret = process.env.STRIPE_WEBHOOK_SECRET!;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { appRouter } from "@/server/api/root";
|
||||
import { createTRPCContext } from "@/server/api/trpc";
|
||||
import { createNextApiHandler } from "@trpc/server/adapters/next";
|
||||
import { nodeHTTPFormDataContentTypeHandler } from "@trpc/server/adapters/node-http/content-type/form-data";
|
||||
import { nodeHTTPJSONContentTypeHandler } from "@trpc/server/adapters/node-http/content-type/json";
|
||||
import { appRouter } from "@/server/api/root";
|
||||
import { createTRPCContext } from "@/server/api/trpc";
|
||||
|
||||
// export API handler
|
||||
export default createNextApiHandler({
|
||||
|
||||
Reference in New Issue
Block a user