mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-07 03:06:40 +00:00
🚨 fix lint errors
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
import { db } from "@server/db";
|
|
||||||
import { clients, olms, newts, sites } from "@server/db";
|
|
||||||
import { eq } from "drizzle-orm";
|
|
||||||
import { sendToClient } from "#dynamic/routers/ws";
|
import { sendToClient } from "#dynamic/routers/ws";
|
||||||
|
import { db, olms } from "@server/db";
|
||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
|
import { eq } from "drizzle-orm";
|
||||||
import { Alias } from "yaml";
|
import { Alias } from "yaml";
|
||||||
|
|
||||||
export async function addPeer(
|
export async function addPeer(
|
||||||
@@ -102,7 +101,7 @@ export async function updatePeer(
|
|||||||
.where(eq(olms.clientId, clientId))
|
.where(eq(olms.clientId, clientId))
|
||||||
.limit(1);
|
.limit(1);
|
||||||
if (!olm) {
|
if (!olm) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
olmId = olm.olmId;
|
olmId = olm.olmId;
|
||||||
}
|
}
|
||||||
@@ -162,5 +161,7 @@ export async function initPeerAddHandshake(
|
|||||||
logger.warn(`Error sending message:`, error);
|
logger.warn(`Error sending message:`, error);
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info(`Initiated peer add handshake for site ${peer.siteId} to olm ${olmId}`);
|
logger.info(
|
||||||
|
`Initiated peer add handshake for site ${peer.siteId} to olm ${olmId}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,26 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
|
||||||
import { z } from "zod";
|
|
||||||
import {
|
import {
|
||||||
clientSiteResources,
|
clientSiteResources,
|
||||||
db,
|
db,
|
||||||
newts,
|
newts,
|
||||||
roles,
|
roles,
|
||||||
roleSiteResources,
|
roleSiteResources,
|
||||||
|
SiteResource,
|
||||||
|
siteResources,
|
||||||
|
sites,
|
||||||
userSiteResources
|
userSiteResources
|
||||||
} from "@server/db";
|
} from "@server/db";
|
||||||
import { siteResources, sites, SiteResource } from "@server/db";
|
import { getUniqueSiteResourceName } from "@server/db/names";
|
||||||
|
import { getNextAvailableAliasAddress } from "@server/lib/ip";
|
||||||
|
import { rebuildClientAssociationsFromSiteResource } from "@server/lib/rebuildClientAssociations";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
|
||||||
import createHttpError from "http-errors";
|
|
||||||
import { eq, and, is } from "drizzle-orm";
|
|
||||||
import { fromError } from "zod-validation-error";
|
|
||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
import { OpenAPITags, registry } from "@server/openApi";
|
import { OpenAPITags, registry } from "@server/openApi";
|
||||||
import { getUniqueSiteResourceName } from "@server/db/names";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
import { rebuildClientAssociationsFromSiteResource } from "@server/lib/rebuildClientAssociations";
|
import { and, eq } from "drizzle-orm";
|
||||||
import { getNextAvailableAliasAddress } from "@server/lib/ip";
|
import { NextFunction, Request, Response } from "express";
|
||||||
|
import createHttpError from "http-errors";
|
||||||
|
import { z } from "zod";
|
||||||
|
import { fromError } from "zod-validation-error";
|
||||||
|
|
||||||
const createSiteResourceParamsSchema = z.strictObject({
|
const createSiteResourceParamsSchema = z.strictObject({
|
||||||
siteId: z.string().transform(Number).pipe(z.int().positive()),
|
siteId: z.string().transform(Number).pipe(z.int().positive()),
|
||||||
@@ -55,7 +57,7 @@ const createSiteResourceSchema = z
|
|||||||
.safeParse(data.destination).success;
|
.safeParse(data.destination).success;
|
||||||
|
|
||||||
if (isValidIP) {
|
if (isValidIP) {
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it's a valid domain (hostname pattern, TLD not required)
|
// Check if it's a valid domain (hostname pattern, TLD not required)
|
||||||
@@ -64,7 +66,7 @@ const createSiteResourceSchema = z
|
|||||||
const isValidDomain = domainRegex.test(data.destination);
|
const isValidDomain = domainRegex.test(data.destination);
|
||||||
const isValidAlias = data.alias && domainRegex.test(data.alias);
|
const isValidAlias = data.alias && domainRegex.test(data.alias);
|
||||||
|
|
||||||
return isValidDomain && isValidAlias; // require the alias to be set in the case of domain
|
return isValidDomain && isValidAlias; // require the alias to be set in the case of domain
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user