mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-10 20:02:26 +00:00
Fix lint errors
This commit is contained in:
@@ -1011,4 +1011,4 @@ export const COUNTRIES = [
|
|||||||
"name": "Åland Islands",
|
"name": "Åland Islands",
|
||||||
"code": "AX"
|
"code": "AX"
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
@@ -44,7 +44,7 @@ class RedisManager {
|
|||||||
constructor() {
|
constructor() {
|
||||||
if (build == "oss") {
|
if (build == "oss") {
|
||||||
this.isEnabled = false;
|
this.isEnabled = false;
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
this.isEnabled = config.getRawPrivateConfig().flags?.enable_redis || false;
|
this.isEnabled = config.getRawPrivateConfig().flags?.enable_redis || false;
|
||||||
if (this.isEnabled) {
|
if (this.isEnabled) {
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ export async function updateProxyResources(
|
|||||||
for (const [resourceNiceId, resourceData] of Object.entries(
|
for (const [resourceNiceId, resourceData] of Object.entries(
|
||||||
config["proxy-resources"]
|
config["proxy-resources"]
|
||||||
)) {
|
)) {
|
||||||
let targetsToUpdate: Target[] = [];
|
const targetsToUpdate: Target[] = [];
|
||||||
let healthchecksToUpdate: TargetHealthCheck[] = [];
|
const healthchecksToUpdate: TargetHealthCheck[] = [];
|
||||||
let resource: Resource;
|
let resource: Resource;
|
||||||
|
|
||||||
async function createTarget( // reusable function to create a target
|
async function createTarget( // reusable function to create a target
|
||||||
|
|||||||
@@ -651,7 +651,7 @@ export class UsageService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(
|
logger.error(
|
||||||
`Failed to get usage for ${orgId}/${featureId}:`,
|
`Failed to get usage for ${orgId}/${featureId}:`,
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ export const privateConfigSchema = z
|
|||||||
localFilePath: z.string()
|
localFilePath: z.string()
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
})
|
});
|
||||||
|
|
||||||
export function readPrivateConfigFile() {
|
export function readPrivateConfigFile() {
|
||||||
if (build == "oss") {
|
if (build == "oss") {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export async function moveEmailToAudience(
|
|||||||
if (data) {
|
if (data) {
|
||||||
logger.debug(
|
logger.debug(
|
||||||
`Added email ${email} to audience ${audienceId} with contact ID ${data.id}`
|
`Added email ${email} to audience ${audienceId} with contact ID ${data.id}`
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const otherAudiences = Object.values(AudienceIds).filter(
|
const otherAudiences = Object.values(AudienceIds).filter(
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export default function createPathRewriteMiddleware(
|
|||||||
switch (rewritePathType) {
|
switch (rewritePathType) {
|
||||||
case "exact":
|
case "exact":
|
||||||
// Replace the path with the exact rewrite path
|
// Replace the path with the exact rewrite path
|
||||||
let exactPattern = `^${escapeRegex(path)}$`;
|
const exactPattern = `^${escapeRegex(path)}$`;
|
||||||
middlewares[middlewareName] = {
|
middlewares[middlewareName] = {
|
||||||
replacePathRegex: {
|
replacePathRegex: {
|
||||||
regex: exactPattern,
|
regex: exactPattern,
|
||||||
|
|||||||
@@ -183,7 +183,6 @@ export async function quickStart(
|
|||||||
let secret: string;
|
let secret: string;
|
||||||
let fullDomain: string;
|
let fullDomain: string;
|
||||||
let resource: Resource;
|
let resource: Resource;
|
||||||
let orgId: string;
|
|
||||||
let completeSignUpLink: string;
|
let completeSignUpLink: string;
|
||||||
|
|
||||||
await db.transaction(async (trx) => {
|
await db.transaction(async (trx) => {
|
||||||
@@ -216,7 +215,7 @@ export async function quickStart(
|
|||||||
throw new Error("Failed to create user account and organization");
|
throw new Error("Failed to create user account and organization");
|
||||||
}
|
}
|
||||||
|
|
||||||
orgId = org.orgId;
|
const orgId = org.orgId;
|
||||||
|
|
||||||
await db.transaction(async (trx) => {
|
await db.transaction(async (trx) => {
|
||||||
const token = generateRandomString(
|
const token = generateRandomString(
|
||||||
@@ -251,7 +250,6 @@ export async function quickStart(
|
|||||||
// Create the sandbox site
|
// Create the sandbox site
|
||||||
const siteNiceId = await getUniqueSiteName(orgId);
|
const siteNiceId = await getUniqueSiteName(orgId);
|
||||||
const siteName = `First Site`;
|
const siteName = `First Site`;
|
||||||
let siteId: number | undefined;
|
|
||||||
|
|
||||||
// pick a random exit node
|
// pick a random exit node
|
||||||
const exitNodesList = await listExitNodes(orgId);
|
const exitNodesList = await listExitNodes(orgId);
|
||||||
@@ -277,7 +275,7 @@ export async function quickStart(
|
|||||||
})
|
})
|
||||||
.returning();
|
.returning();
|
||||||
|
|
||||||
siteId = newSite.siteId;
|
const siteId = newSite.siteId;
|
||||||
|
|
||||||
const adminRole = await trx
|
const adminRole = await trx
|
||||||
.select()
|
.select()
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export type ExitNodePingResult = {
|
|||||||
wasPreviouslyConnected: boolean;
|
wasPreviouslyConnected: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
let numTimesLimitExceededForId: Record<string, number> = {};
|
const numTimesLimitExceededForId: Record<string, number> = {};
|
||||||
|
|
||||||
export const handleNewtRegisterMessage: MessageHandler = async (context) => {
|
export const handleNewtRegisterMessage: MessageHandler = async (context) => {
|
||||||
const { message, client, sendToClient } = context;
|
const { message, client, sendToClient } = context;
|
||||||
@@ -323,7 +323,7 @@ export const handleNewtRegisterMessage: MessageHandler = async (context) => {
|
|||||||
const hcHeadersParse = target.hcHeaders
|
const hcHeadersParse = target.hcHeaders
|
||||||
? JSON.parse(target.hcHeaders)
|
? JSON.parse(target.hcHeaders)
|
||||||
: null;
|
: null;
|
||||||
let hcHeadersSend: { [key: string]: string } = {};
|
const hcHeadersSend: { [key: string]: string } = {};
|
||||||
if (hcHeadersParse) {
|
if (hcHeadersParse) {
|
||||||
hcHeadersParse.forEach(
|
hcHeadersParse.forEach(
|
||||||
(header: { name: string; value: string }) => {
|
(header: { name: string; value: string }) => {
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export async function removeTargets(
|
|||||||
});
|
});
|
||||||
|
|
||||||
const healthCheckTargets = targets.map((target) => {
|
const healthCheckTargets = targets.map((target) => {
|
||||||
return target.targetId
|
return target.targetId;
|
||||||
});
|
});
|
||||||
|
|
||||||
await sendToClient(newtId, {
|
await sendToClient(newtId, {
|
||||||
|
|||||||
@@ -82,13 +82,13 @@ export async function getOrgUsage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get usage for org
|
// Get usage for org
|
||||||
let usageData = [];
|
const usageData = [];
|
||||||
|
|
||||||
const siteUptime = await usageService.getUsage(orgId, FeatureId.SITE_UPTIME)
|
const siteUptime = await usageService.getUsage(orgId, FeatureId.SITE_UPTIME);
|
||||||
const users = await usageService.getUsageDaily(orgId, FeatureId.USERS)
|
const users = await usageService.getUsageDaily(orgId, FeatureId.USERS);
|
||||||
const domains = await usageService.getUsageDaily(orgId, FeatureId.DOMAINS)
|
const domains = await usageService.getUsageDaily(orgId, FeatureId.DOMAINS);
|
||||||
const remoteExitNodes = await usageService.getUsageDaily(orgId, FeatureId.REMOTE_EXIT_NODES)
|
const remoteExitNodes = await usageService.getUsageDaily(orgId, FeatureId.REMOTE_EXIT_NODES);
|
||||||
const egressData = await usageService.getUsage(orgId, FeatureId.EGRESS_DATA_MB)
|
const egressData = await usageService.getUsage(orgId, FeatureId.EGRESS_DATA_MB);
|
||||||
|
|
||||||
if (siteUptime) {
|
if (siteUptime) {
|
||||||
usageData.push(siteUptime);
|
usageData.push(siteUptime);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ import { NextFunction, Request, Response } from "express";
|
|||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
import { getTraefikConfig } from "../../lib/traefik"
|
import { getTraefikConfig } from "../../lib/traefik";
|
||||||
import {
|
import {
|
||||||
generateGerbilConfig,
|
generateGerbilConfig,
|
||||||
generateRelayMappings,
|
generateRelayMappings,
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ const processPendingMessages = async (
|
|||||||
`Processing ${ws.pendingMessages.length} pending messages for ${clientType.toUpperCase()} ID: ${clientId}`
|
`Processing ${ws.pendingMessages.length} pending messages for ${clientType.toUpperCase()} ID: ${clientId}`
|
||||||
);
|
);
|
||||||
|
|
||||||
let jobs = [];
|
const jobs = [];
|
||||||
for (const messageData of ws.pendingMessages) {
|
for (const messageData of ws.pendingMessages) {
|
||||||
jobs.push(processMessage(ws, messageData, clientId, clientType));
|
jobs.push(processMessage(ws, messageData, clientId, clientType));
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ const NODE_ID = uuidv4();
|
|||||||
const REDIS_CHANNEL = "websocket_messages";
|
const REDIS_CHANNEL = "websocket_messages";
|
||||||
|
|
||||||
// Client tracking map (local to this node)
|
// Client tracking map (local to this node)
|
||||||
let connectedClients: Map<string, AuthenticatedWebSocket[]> = new Map();
|
const connectedClients: Map<string, AuthenticatedWebSocket[]> = new Map();
|
||||||
|
|
||||||
// Recovery tracking
|
// Recovery tracking
|
||||||
let isRedisRecoveryInProgress = false;
|
let isRedisRecoveryInProgress = false;
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ function getActionsCategories(root: boolean) {
|
|||||||
if (build == "saas") {
|
if (build == "saas") {
|
||||||
actionsByCategory["SAAS"] = {
|
actionsByCategory["SAAS"] = {
|
||||||
["Send Usage Notification Email"]: "sendUsageNotification",
|
["Send Usage Notification Email"]: "sendUsageNotification",
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user