mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-31 09:45:45 +02:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af87edf3a6 | |||
| 13caad18c7 | |||
| 47522b7e3a | |||
| c8c8d74452 |
@@ -46,7 +46,7 @@ const getCertificateQuerySchema = z.object({
|
|||||||
|
|
||||||
async function query(orgId: string, domainList: string[]) {
|
async function query(orgId: string, domainList: string[]) {
|
||||||
// Try to get CNAME certificates first
|
// Try to get CNAME certificates first
|
||||||
let existingCertificates = await db
|
const existingCertificates = await db
|
||||||
.select({
|
.select({
|
||||||
certId: certificates.certId,
|
certId: certificates.certId,
|
||||||
domain: certificates.domain,
|
domain: certificates.domain,
|
||||||
@@ -73,16 +73,19 @@ async function query(orgId: string, domainList: string[]) {
|
|||||||
.where(and(inArray(certificates.domain, domainList)));
|
.where(and(inArray(certificates.domain, domainList)));
|
||||||
|
|
||||||
// All non resolved domain certificates might be `ns` or `wildcard`,
|
// All non resolved domain certificates might be `ns` or `wildcard`,
|
||||||
// which means exact domain certificates do not
|
// which means exact domain certificates do not exist
|
||||||
const nonAvailableCertificates = existingCertificates
|
const foundDomains = new Set(
|
||||||
.filter((cert) => !domainList.includes(cert.domain))
|
existingCertificates.map((cert) => cert.domain)
|
||||||
.map((cert) => cert.domain);
|
);
|
||||||
|
const domainsWithMissingCertificates = domainList.filter(
|
||||||
|
(domain) => !foundDomains.has(domain)
|
||||||
|
);
|
||||||
|
|
||||||
if (nonAvailableCertificates.length > 0) {
|
if (domainsWithMissingCertificates.length > 0) {
|
||||||
const domainLevelDownSet = new Set<string>();
|
const domainLevelDownSet = new Set<string>();
|
||||||
const wildcardDomainSet = new Set<string>();
|
const wildcardDomainSet = new Set<string>();
|
||||||
|
|
||||||
for (const domain of nonAvailableCertificates) {
|
for (const domain of domainsWithMissingCertificates) {
|
||||||
const domainLevelDown = domain.split(".").slice(1).join(".");
|
const domainLevelDown = domain.split(".").slice(1).join(".");
|
||||||
const wildcardPrefixed = `*.${domainLevelDown}`;
|
const wildcardPrefixed = `*.${domainLevelDown}`;
|
||||||
domainLevelDownSet.add(domainLevelDown);
|
domainLevelDownSet.add(domainLevelDown);
|
||||||
@@ -131,6 +134,7 @@ async function query(orgId: string, domainList: string[]) {
|
|||||||
for (const domain of domainList) {
|
for (const domain of domainList) {
|
||||||
const domainLevelDown = domain.split(".").slice(1).join(".");
|
const domainLevelDown = domain.split(".").slice(1).join(".");
|
||||||
const wildcardPrefixed = `*.${domainLevelDown}`;
|
const wildcardPrefixed = `*.${domainLevelDown}`;
|
||||||
|
|
||||||
certificateMap[domain] =
|
certificateMap[domain] =
|
||||||
existingCertificates.find(
|
existingCertificates.find(
|
||||||
(cert) =>
|
(cert) =>
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ export function useCertificate({
|
|||||||
let certError: string | null = null;
|
let certError: string | null = null;
|
||||||
if (restartCert.isError) {
|
if (restartCert.isError) {
|
||||||
certError = "Failed to restart";
|
certError = "Failed to restart";
|
||||||
} else if (isError) {
|
} else if (isError || initialCertValue === null) {
|
||||||
|
// Null value means failed to get the certificate
|
||||||
certError = "Failed";
|
certError = "Failed";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+27
-29
@@ -1,4 +1,10 @@
|
|||||||
|
import type { LauncherQueryFilters } from "@app/lib/launcherSearchParams";
|
||||||
|
import { buildLauncherSearchParams } from "@app/lib/launcherSearchParams";
|
||||||
import { build } from "@server/build";
|
import { build } from "@server/build";
|
||||||
|
import {
|
||||||
|
StatusHistoryResponse,
|
||||||
|
type BatchedStatusHistoryResponse
|
||||||
|
} from "@server/lib/statusHistory";
|
||||||
import type { ListAlertRulesResponse } from "@server/routers/alertRule/types";
|
import type { ListAlertRulesResponse } from "@server/routers/alertRule/types";
|
||||||
import type { QueryRequestAnalyticsResponse } from "@server/routers/auditLogs";
|
import type { QueryRequestAnalyticsResponse } from "@server/routers/auditLogs";
|
||||||
import type {
|
import type {
|
||||||
@@ -7,6 +13,7 @@ import type {
|
|||||||
QueryConnectionAuditLogResponse,
|
QueryConnectionAuditLogResponse,
|
||||||
QueryRequestAuditLogResponse
|
QueryRequestAuditLogResponse
|
||||||
} from "@server/routers/auditLogs/types";
|
} from "@server/routers/auditLogs/types";
|
||||||
|
import type { GetCertificateResponse } from "@server/routers/certificates/types";
|
||||||
import type {
|
import type {
|
||||||
ListClientsResponse,
|
ListClientsResponse,
|
||||||
ListUserDevicesResponse
|
ListUserDevicesResponse
|
||||||
@@ -16,15 +23,30 @@ import type {
|
|||||||
ListDomainsResponse
|
ListDomainsResponse
|
||||||
} from "@server/routers/domain";
|
} from "@server/routers/domain";
|
||||||
import type { GetDomainResponse } from "@server/routers/domain/getDomain";
|
import type { GetDomainResponse } from "@server/routers/domain/getDomain";
|
||||||
|
import { ListHealthChecksResponse } from "@server/routers/healthChecks/types";
|
||||||
|
import type { ListOrgLabelsResponse } from "@server/routers/labels/types";
|
||||||
|
import type {
|
||||||
|
LauncherResource,
|
||||||
|
ListLauncherGroupsResponse,
|
||||||
|
ListLauncherLabelsResponse,
|
||||||
|
ListLauncherResourcesResponse,
|
||||||
|
ListLauncherScaleResponse,
|
||||||
|
ListLauncherSitesResponse,
|
||||||
|
ListLauncherViewsResponse
|
||||||
|
} from "@server/routers/launcher/types";
|
||||||
|
import type { GetResourcePolicyResponse } from "@server/routers/policy";
|
||||||
import type {
|
import type {
|
||||||
GetResourceWhitelistResponse,
|
|
||||||
GetResourcePoliciesResponse,
|
GetResourcePoliciesResponse,
|
||||||
|
GetResourceWhitelistResponse,
|
||||||
ListResourceNamesResponse,
|
ListResourceNamesResponse,
|
||||||
ListResourcesResponse,
|
|
||||||
ListResourceRolesResponse,
|
ListResourceRolesResponse,
|
||||||
ListResourceRulesResponse,
|
ListResourceRulesResponse,
|
||||||
|
ListResourcesResponse,
|
||||||
ListResourceUsersResponse
|
ListResourceUsersResponse
|
||||||
} from "@server/routers/resource";
|
} from "@server/routers/resource";
|
||||||
|
import type { GetResourceResponse } from "@server/routers/resource/getResource";
|
||||||
|
import type { GetResourceAuthInfoResponse } from "@server/routers/resource/getResourceAuthInfo";
|
||||||
|
import type { ListResourcePoliciesResponse } from "@server/routers/resource/types";
|
||||||
import type { ListRolesResponse } from "@server/routers/role";
|
import type { ListRolesResponse } from "@server/routers/role";
|
||||||
import type { ListSitesResponse } from "@server/routers/site";
|
import type { ListSitesResponse } from "@server/routers/site";
|
||||||
import type {
|
import type {
|
||||||
@@ -33,6 +55,7 @@ import type {
|
|||||||
ListSiteResourceRolesResponse,
|
ListSiteResourceRolesResponse,
|
||||||
ListSiteResourceUsersResponse
|
ListSiteResourceUsersResponse
|
||||||
} from "@server/routers/siteResource";
|
} from "@server/routers/siteResource";
|
||||||
|
import type { GetSiteResourceResponse } from "@server/routers/siteResource/getSiteResource";
|
||||||
import type { ListTargetsResponse } from "@server/routers/target";
|
import type { ListTargetsResponse } from "@server/routers/target";
|
||||||
import type { ListUsersResponse } from "@server/routers/user";
|
import type { ListUsersResponse } from "@server/routers/user";
|
||||||
import type ResponseT from "@server/types/Response";
|
import type ResponseT from "@server/types/Response";
|
||||||
@@ -42,37 +65,12 @@ import {
|
|||||||
queryOptions
|
queryOptions
|
||||||
} from "@tanstack/react-query";
|
} from "@tanstack/react-query";
|
||||||
import { isAxiosError, type AxiosResponse } from "axios";
|
import { isAxiosError, type AxiosResponse } from "axios";
|
||||||
import z, { meta } from "zod";
|
import z from "zod";
|
||||||
import { remote } from "./api";
|
import { remote } from "./api";
|
||||||
import { durationToMs } from "./durationToMs";
|
import { durationToMs } from "./durationToMs";
|
||||||
import type { ListOrgLabelsResponse } from "@server/routers/labels/types";
|
|
||||||
import { ListHealthChecksResponse } from "@server/routers/healthChecks/types";
|
|
||||||
import {
|
|
||||||
StatusHistoryResponse,
|
|
||||||
type BatchedStatusHistoryResponse
|
|
||||||
} from "@server/lib/statusHistory";
|
|
||||||
import type { ListResourcePoliciesResponse } from "@server/routers/resource/types";
|
|
||||||
import type { GetResourcePolicyResponse } from "@server/routers/policy";
|
|
||||||
import type {
|
|
||||||
ListLauncherGroupsResponse,
|
|
||||||
ListLauncherLabelsResponse,
|
|
||||||
ListLauncherResourcesResponse,
|
|
||||||
ListLauncherScaleResponse,
|
|
||||||
ListLauncherSitesResponse,
|
|
||||||
ListLauncherViewsResponse,
|
|
||||||
LauncherListQuery,
|
|
||||||
LauncherResource,
|
|
||||||
LauncherViewConfig
|
|
||||||
} from "@server/routers/launcher/types";
|
|
||||||
import type { GetResourceResponse } from "@server/routers/resource/getResource";
|
|
||||||
import type { GetResourceAuthInfoResponse } from "@server/routers/resource/getResourceAuthInfo";
|
|
||||||
import type { GetSiteResourceResponse } from "@server/routers/siteResource/getSiteResource";
|
|
||||||
import type { LauncherQueryFilters } from "@app/lib/launcherSearchParams";
|
|
||||||
import { buildLauncherSearchParams } from "@app/lib/launcherSearchParams";
|
|
||||||
import type { GetCertificateResponse } from "@server/routers/certificates/types";
|
|
||||||
|
|
||||||
export type { LauncherQueryFilters } from "@app/lib/launcherSearchParams";
|
|
||||||
export { buildLauncherSearchParams } from "@app/lib/launcherSearchParams";
|
export { buildLauncherSearchParams } from "@app/lib/launcherSearchParams";
|
||||||
|
export type { LauncherQueryFilters } from "@app/lib/launcherSearchParams";
|
||||||
|
|
||||||
export type ProductUpdate = {
|
export type ProductUpdate = {
|
||||||
link: string | null;
|
link: string | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user