mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-31 23:16:38 +00:00
Make work for demo
This commit is contained in:
@@ -2,7 +2,7 @@ import path from "path";
|
|||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
// This is a placeholder value replaced by the build process
|
// This is a placeholder value replaced by the build process
|
||||||
export const APP_VERSION = "1.16.0";
|
export const APP_VERSION = "1.17.0";
|
||||||
|
|
||||||
export const __FILENAME = fileURLToPath(import.meta.url);
|
export const __FILENAME = fileURLToPath(import.meta.url);
|
||||||
export const __DIRNAME = path.dirname(__FILENAME);
|
export const __DIRNAME = path.dirname(__FILENAME);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { and, eq } from "drizzle-orm";
|
|||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
import { checkOrgAccessPolicy } from "#dynamic/lib/checkOrgAccessPolicy";
|
import { checkOrgAccessPolicy } from "#dynamic/lib/checkOrgAccessPolicy";
|
||||||
|
import { getUserOrgRoleIds } from "@server/lib/userOrgRoles";
|
||||||
|
|
||||||
export async function verifySiteProvisioningKeyAccess(
|
export async function verifySiteProvisioningKeyAccess(
|
||||||
req: Request,
|
req: Request,
|
||||||
@@ -116,8 +117,11 @@ export async function verifySiteProvisioningKeyAccess(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const userOrgRoleId = req.userOrg.roleId;
|
req.userOrgRoleIds = await getUserOrgRoleIds(
|
||||||
req.userOrgRoleId = userOrgRoleId;
|
req.userOrg.userId,
|
||||||
|
row.siteProvisioningKeyOrg.orgId
|
||||||
|
);
|
||||||
|
req.userOrgId = row.siteProvisioningKeyOrg.orgId;
|
||||||
|
|
||||||
return next();
|
return next();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
import { rateLimitService } from "#private/lib/rateLimit";
|
import { rateLimitService } from "#private/lib/rateLimit";
|
||||||
import { cleanup as wsCleanup } from "#private/routers/ws";
|
import { cleanup as wsCleanup } from "#private/routers/ws";
|
||||||
import { flushBandwidthToDb } from "@server/routers/newt/handleReceiveBandwidthMessage";
|
import { flushBandwidthToDb } from "@server/routers/newt/handleReceiveBandwidthMessage";
|
||||||
import { flushConnectionLogToDb } from "#dynamic/routers/newt";
|
import { flushConnectionLogToDb } from "#private/routers/newt";
|
||||||
import { flushSiteBandwidthToDb } from "@server/routers/gerbil/receiveBandwidth";
|
import { flushSiteBandwidthToDb } from "@server/routers/gerbil/receiveBandwidth";
|
||||||
import { stopPingAccumulator } from "@server/routers/newt/pingAccumulator";
|
import { stopPingAccumulator } from "@server/routers/newt/pingAccumulator";
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
} from "#private/routers/remoteExitNode";
|
} from "#private/routers/remoteExitNode";
|
||||||
import { MessageHandler } from "@server/routers/ws";
|
import { MessageHandler } from "@server/routers/ws";
|
||||||
import { build } from "@server/build";
|
import { build } from "@server/build";
|
||||||
import { handleConnectionLogMessage } from "#dynamic/routers/newt";
|
import { handleConnectionLogMessage } from "#private/routers/newt";
|
||||||
|
|
||||||
export const messageHandlers: Record<string, MessageHandler> = {
|
export const messageHandlers: Record<string, MessageHandler> = {
|
||||||
"remoteExitNode/register": handleRemoteExitNodeRegisterMessage,
|
"remoteExitNode/register": handleRemoteExitNodeRegisterMessage,
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ export default async function ProvisioningKeysPage(
|
|||||||
lastUsed: k.lastUsed,
|
lastUsed: k.lastUsed,
|
||||||
maxBatchSize: k.maxBatchSize,
|
maxBatchSize: k.maxBatchSize,
|
||||||
numUsed: k.numUsed,
|
numUsed: k.numUsed,
|
||||||
validUntil: k.validUntil
|
validUntil: k.validUntil,
|
||||||
|
approveNewSites: k.approveNewSites
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export default function PendingSitesTable({
|
|||||||
async function approveSite(siteId: number) {
|
async function approveSite(siteId: number) {
|
||||||
setApprovingIds((prev) => new Set(prev).add(siteId));
|
setApprovingIds((prev) => new Set(prev).add(siteId));
|
||||||
try {
|
try {
|
||||||
await api.post(`/site/${siteId}`, { status: "accepted" });
|
await api.post(`/site/${siteId}`, { status: "approved" });
|
||||||
toast({
|
toast({
|
||||||
title: t("success"),
|
title: t("success"),
|
||||||
description: t("siteApproveSuccess"),
|
description: t("siteApproveSuccess"),
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export type SiteProvisioningKeyRow = {
|
|||||||
maxBatchSize: number | null;
|
maxBatchSize: number | null;
|
||||||
numUsed: number;
|
numUsed: number;
|
||||||
validUntil: string | null;
|
validUntil: string | null;
|
||||||
|
approveNewSites: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type SiteProvisioningKeysTableProps = {
|
type SiteProvisioningKeysTableProps = {
|
||||||
|
|||||||
Reference in New Issue
Block a user