mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: remove findAdmin
This commit is contained in:
@@ -3,7 +3,7 @@ import { applications, compose, github } from "@/server/db/schema";
|
|||||||
import type { DeploymentJob } from "@/server/queues/deployments-queue";
|
import type { DeploymentJob } from "@/server/queues/deployments-queue";
|
||||||
import { myQueue } from "@/server/queues/queueSetup";
|
import { myQueue } from "@/server/queues/queueSetup";
|
||||||
import { deploy } from "@/server/utils/deploy";
|
import { deploy } from "@/server/utils/deploy";
|
||||||
import { IS_CLOUD, findAdmin } from "@dokploy/server";
|
import { IS_CLOUD } from "@dokploy/server";
|
||||||
import { Webhooks } from "@octokit/webhooks";
|
import { Webhooks } from "@octokit/webhooks";
|
||||||
import { and, eq } from "drizzle-orm";
|
import { and, eq } from "drizzle-orm";
|
||||||
import type { NextApiRequest, NextApiResponse } from "next";
|
import type { NextApiRequest, NextApiResponse } from "next";
|
||||||
@@ -13,13 +13,6 @@ export default async function handler(
|
|||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
res: NextApiResponse,
|
res: NextApiResponse,
|
||||||
) {
|
) {
|
||||||
const admin = await findAdmin();
|
|
||||||
|
|
||||||
if (!admin) {
|
|
||||||
res.status(200).json({ message: "Could not find admin" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const signature = req.headers["x-hub-signature-256"];
|
const signature = req.headers["x-hub-signature-256"];
|
||||||
const githubBody = req.body;
|
const githubBody = req.body;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import * as bcrypt from "bcrypt";
|
import * as bcrypt from "bcrypt";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
|
import { IS_CLOUD } from "../constants";
|
||||||
|
|
||||||
export type Admin = typeof admins.$inferSelect;
|
export type Admin = typeof admins.$inferSelect;
|
||||||
export const createInvitation = async (
|
export const createInvitation = async (
|
||||||
@@ -141,6 +142,9 @@ export const removeUserByAuthId = async (authId: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getDokployUrl = async () => {
|
export const getDokployUrl = async () => {
|
||||||
|
if (IS_CLOUD) {
|
||||||
|
return "https://app.dokploy.com";
|
||||||
|
}
|
||||||
const admin = await findAdmin();
|
const admin = await findAdmin();
|
||||||
|
|
||||||
if (admin.host) {
|
if (admin.host) {
|
||||||
|
|||||||
Reference in New Issue
Block a user