fix: dns checking
This commit is contained in:
parent
3d488da5ab
commit
de77cbb9d8
@ -0,0 +1,2 @@
|
||||
-- DropIndex
|
||||
DROP INDEX "Application_fqdn_key";
|
@ -82,7 +82,7 @@ model TeamInvitation {
|
||||
model Application {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
fqdn String? @unique
|
||||
fqdn String?
|
||||
repository String?
|
||||
configHash String?
|
||||
branch String?
|
||||
|
@ -318,12 +318,12 @@ export async function isDomainConfigured({
|
||||
id,
|
||||
fqdn,
|
||||
checkOwn = false,
|
||||
dockerId = undefined
|
||||
remoteIpAddress = undefined
|
||||
}: {
|
||||
id: string;
|
||||
fqdn: string;
|
||||
checkOwn?: boolean;
|
||||
dockerId?: string;
|
||||
remoteIpAddress?: string;
|
||||
}): Promise<boolean> {
|
||||
const domain = getDomain(fqdn);
|
||||
const nakedDomain = domain.replace('www.', '');
|
||||
@ -335,7 +335,7 @@ export async function isDomainConfigured({
|
||||
],
|
||||
id: { not: id },
|
||||
destinationDocker: {
|
||||
id: dockerId
|
||||
remoteIpAddress,
|
||||
}
|
||||
},
|
||||
select: { fqdn: true }
|
||||
@ -350,7 +350,7 @@ export async function isDomainConfigured({
|
||||
],
|
||||
id: { not: checkOwn ? undefined : id },
|
||||
destinationDocker: {
|
||||
id: dockerId
|
||||
remoteIpAddress
|
||||
}
|
||||
},
|
||||
select: { fqdn: true }
|
||||
|
@ -387,7 +387,7 @@ export async function checkDNS(request: FastifyRequest<CheckDNS>) {
|
||||
const { destinationDocker: { id: dockerId, remoteIpAddress, remoteEngine }, exposePort: configuredPort } = await prisma.application.findUnique({ where: { id }, include: { destinationDocker: true } })
|
||||
const { isDNSCheckEnabled } = await prisma.setting.findFirst({});
|
||||
|
||||
const found = await isDomainConfigured({ id, fqdn, dockerId });
|
||||
const found = await isDomainConfigured({ id, fqdn, remoteIpAddress });
|
||||
if (found) {
|
||||
throw { status: 500, message: `Domain ${getDomain(fqdn).replace('www.', '')} is already in use!` }
|
||||
}
|
||||
|
@ -368,13 +368,13 @@ export async function checkService(request: FastifyRequest<CheckService>) {
|
||||
const { destinationDocker: { id: dockerId, remoteIpAddress, remoteEngine }, exposePort: configuredPort } = await prisma.service.findUnique({ where: { id }, include: { destinationDocker: true } })
|
||||
const { isDNSCheckEnabled } = await prisma.setting.findFirst({});
|
||||
|
||||
let found = await isDomainConfigured({ id, fqdn, dockerId });
|
||||
let found = await isDomainConfigured({ id, fqdn, remoteIpAddress });
|
||||
if (found) {
|
||||
throw { status: 500, message: `Domain ${getDomain(fqdn).replace('www.', '')} is already in use!` }
|
||||
}
|
||||
if (otherFqdns && otherFqdns.length > 0) {
|
||||
for (const ofqdn of otherFqdns) {
|
||||
found = await isDomainConfigured({ id, fqdn: ofqdn, dockerId });
|
||||
found = await isDomainConfigured({ id, fqdn: ofqdn,remoteIpAddress });
|
||||
if (found) {
|
||||
throw { status: 500, message: `Domain ${getDomain(ofqdn).replace('www.', '')} is already in use!` }
|
||||
}
|
||||
|
@ -23,7 +23,6 @@
|
||||
class="flex justify-center"
|
||||
>
|
||||
<div
|
||||
type="button"
|
||||
on:click
|
||||
aria-pressed="false"
|
||||
class="relative mx-20 inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out"
|
||||
|
Loading…
x
Reference in New Issue
Block a user