mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-06 20:51:36 +02:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 053e29c7a2 | |||
| b7c0669c38 |
Generated
+1745
-3105
File diff suppressed because it is too large
Load Diff
+69
-69
@@ -32,49 +32,49 @@
|
|||||||
"format": "prettier --write ."
|
"format": "prettier --write ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@asteasolutions/zod-to-openapi": "8.5.0",
|
"@asteasolutions/zod-to-openapi": "9.1.0",
|
||||||
"@devolutions/iron-remote-desktop": "https://static.pangolin.net/packages/devolutions-iron-remote-desktop-0.0.0.tgz",
|
"@devolutions/iron-remote-desktop": "https://static.pangolin.net/packages/devolutions-iron-remote-desktop-0.0.0.tgz",
|
||||||
"@devolutions/iron-remote-desktop-rdp": "https://static.pangolin.net/packages/devolutions-iron-remote-desktop-rdp-0.0.1.tgz",
|
"@devolutions/iron-remote-desktop-rdp": "https://static.pangolin.net/packages/devolutions-iron-remote-desktop-rdp-0.0.1.tgz",
|
||||||
"@aws-sdk/client-s3": "3.1056.0",
|
"@aws-sdk/client-s3": "3.1101.0",
|
||||||
"@headlessui/react": "2.2.10",
|
"@headlessui/react": "2.2.10",
|
||||||
"@hookform/resolvers": "5.4.0",
|
"@hookform/resolvers": "5.7.1",
|
||||||
"@monaco-editor/react": "4.7.0",
|
"@monaco-editor/react": "4.7.0",
|
||||||
"@node-rs/argon2": "2.0.2",
|
"@node-rs/argon2": "2.0.2",
|
||||||
"@novnc/novnc": "^1.7.0",
|
"@novnc/novnc": "^1.7.0",
|
||||||
"@oslojs/crypto": "1.0.1",
|
"@oslojs/crypto": "1.0.1",
|
||||||
"@oslojs/encoding": "1.1.0",
|
"@oslojs/encoding": "1.1.0",
|
||||||
"@radix-ui/react-avatar": "1.1.11",
|
"@radix-ui/react-avatar": "1.2.6",
|
||||||
"@radix-ui/react-checkbox": "1.3.3",
|
"@radix-ui/react-checkbox": "1.3.11",
|
||||||
"@radix-ui/react-collapsible": "1.1.12",
|
"@radix-ui/react-collapsible": "1.1.20",
|
||||||
"@radix-ui/react-dialog": "1.1.15",
|
"@radix-ui/react-dialog": "1.1.23",
|
||||||
"@radix-ui/react-dropdown-menu": "2.1.16",
|
"@radix-ui/react-dropdown-menu": "2.1.24",
|
||||||
"@radix-ui/react-icons": "1.3.2",
|
"@radix-ui/react-icons": "1.3.2",
|
||||||
"@radix-ui/react-label": "2.1.8",
|
"@radix-ui/react-label": "2.1.15",
|
||||||
"@radix-ui/react-popover": "1.1.15",
|
"@radix-ui/react-popover": "1.1.23",
|
||||||
"@radix-ui/react-progress": "1.1.8",
|
"@radix-ui/react-progress": "1.1.16",
|
||||||
"@radix-ui/react-radio-group": "1.3.8",
|
"@radix-ui/react-radio-group": "1.4.7",
|
||||||
"@radix-ui/react-scroll-area": "1.2.10",
|
"@radix-ui/react-scroll-area": "1.2.18",
|
||||||
"@radix-ui/react-select": "2.2.6",
|
"@radix-ui/react-select": "2.3.7",
|
||||||
"@radix-ui/react-separator": "1.1.8",
|
"@radix-ui/react-separator": "1.1.15",
|
||||||
"@radix-ui/react-slot": "1.2.4",
|
"@radix-ui/react-slot": "1.3.3",
|
||||||
"@radix-ui/react-switch": "1.2.6",
|
"@radix-ui/react-switch": "1.3.7",
|
||||||
"@radix-ui/react-tabs": "1.1.13",
|
"@radix-ui/react-tabs": "1.1.21",
|
||||||
"@radix-ui/react-toast": "1.2.15",
|
"@radix-ui/react-toast": "1.2.23",
|
||||||
"@radix-ui/react-tooltip": "1.2.8",
|
"@radix-ui/react-tooltip": "1.2.16",
|
||||||
"@react-email/body": "0.3.0",
|
"@react-email/body": "0.3.0",
|
||||||
"@react-email/components": "1.0.12",
|
"@react-email/components": "1.0.12",
|
||||||
"@react-email/render": "2.0.8",
|
"@react-email/render": "2.1.0",
|
||||||
"@react-email/tailwind": "2.0.7",
|
"@react-email/tailwind": "2.0.7",
|
||||||
"@simplewebauthn/browser": "13.3.0",
|
"@simplewebauthn/browser": "13.3.0",
|
||||||
"@simplewebauthn/server": "13.3.1",
|
"@simplewebauthn/server": "13.3.2",
|
||||||
"@tailwindcss/forms": "0.5.11",
|
"@tailwindcss/forms": "0.5.11",
|
||||||
"@tanstack/react-query": "5.100.14",
|
"@tanstack/react-query": "5.101.4",
|
||||||
"@tanstack/react-table": "8.21.3",
|
"@tanstack/react-table": "8.21.3",
|
||||||
"@xterm/addon-fit": "^0.11.0",
|
"@xterm/addon-fit": "^0.11.0",
|
||||||
"@xterm/addon-web-links": "^0.12.0",
|
"@xterm/addon-web-links": "^0.12.0",
|
||||||
"@xterm/xterm": "^6.0.0",
|
"@xterm/xterm": "^6.0.0",
|
||||||
"arctic": "3.7.0",
|
"arctic": "3.7.0",
|
||||||
"axios": "1.18.0",
|
"axios": "1.19.0",
|
||||||
"better-sqlite3": "11.9.1",
|
"better-sqlite3": "11.9.1",
|
||||||
"canvas-confetti": "1.9.4",
|
"canvas-confetti": "1.9.4",
|
||||||
"class-variance-authority": "0.7.1",
|
"class-variance-authority": "0.7.1",
|
||||||
@@ -86,61 +86,61 @@
|
|||||||
"d3": "7.9.0",
|
"d3": "7.9.0",
|
||||||
"drizzle-orm": "0.45.2",
|
"drizzle-orm": "0.45.2",
|
||||||
"express": "5.2.1",
|
"express": "5.2.1",
|
||||||
"express-rate-limit": "8.5.2",
|
"express-rate-limit": "8.6.1",
|
||||||
"glob": "13.0.6",
|
"glob": "13.0.6",
|
||||||
"helmet": "8.2.0",
|
"helmet": "8.3.0",
|
||||||
"http-errors": "2.0.1",
|
"http-errors": "2.0.1",
|
||||||
"input-otp": "1.4.2",
|
"input-otp": "1.4.2",
|
||||||
"ioredis": "5.11.0",
|
"ioredis": "6.0.0",
|
||||||
"jmespath": "0.16.0",
|
"jmespath": "0.16.0",
|
||||||
"js-yaml": "4.3.0",
|
"js-yaml": "5.2.3",
|
||||||
"jsonwebtoken": "9.0.3",
|
"jsonwebtoken": "9.0.3",
|
||||||
"lucide-react": "1.17.0",
|
"lucide-react": "1.28.0",
|
||||||
"maxmind": "5.0.6",
|
"maxmind": "5.0.7",
|
||||||
"moment": "2.30.1",
|
"moment": "2.30.1",
|
||||||
"next": "16.2.11",
|
"next": "16.2.12",
|
||||||
"next-intl": "4.13.0",
|
"next-intl": "4.13.4",
|
||||||
"next-themes": "0.4.6",
|
"next-themes": "0.4.6",
|
||||||
"nextjs-toploader": "3.9.17",
|
"nextjs-toploader": "3.9.17",
|
||||||
"node-cache": "5.1.2",
|
"node-cache": "5.1.2",
|
||||||
"nodemailer": "9.0.1",
|
"nodemailer": "9.0.3",
|
||||||
"oslo": "1.2.1",
|
"oslo": "1.2.1",
|
||||||
"pg": "8.21.0",
|
"pg": "8.22.0",
|
||||||
"posthog-node": "5.35.6",
|
"posthog-node": "5.47.3",
|
||||||
"qrcode.react": "4.2.0",
|
"qrcode.react": "4.2.0",
|
||||||
"react": "19.2.6",
|
"react": "19.2.8",
|
||||||
"react-day-picker": "9.14.0",
|
"react-day-picker": "10.0.1",
|
||||||
"react-dom": "19.2.6",
|
"react-dom": "19.2.8",
|
||||||
"react-easy-sort": "1.8.0",
|
"react-easy-sort": "1.8.0",
|
||||||
"react-hook-form": "7.76.1",
|
"react-hook-form": "7.84.0",
|
||||||
"react-icons": "5.6.0",
|
"react-icons": "5.7.0",
|
||||||
"recharts": "3.8.1",
|
"recharts": "3.10.1",
|
||||||
"reodotdev": "1.1.0",
|
"reodotdev": "1.1.0",
|
||||||
"semver": "7.8.1",
|
"semver": "7.8.5",
|
||||||
"sshpk": "1.18.0",
|
"sshpk": "1.18.0",
|
||||||
"stripe": "22.2.0",
|
"stripe": "22.4.0",
|
||||||
"swagger-ui-express": "5.0.1",
|
"swagger-ui-express": "5.0.1",
|
||||||
"tailwind-merge": "3.6.0",
|
"tailwind-merge": "3.6.0",
|
||||||
"topojson-client": "3.1.0",
|
"topojson-client": "3.1.0",
|
||||||
"tw-animate-css": "1.4.0",
|
"tw-animate-css": "1.4.0",
|
||||||
"use-debounce": "10.1.1",
|
"use-debounce": "10.1.1",
|
||||||
"uuid": "14.0.0",
|
"uuid": "14.0.1",
|
||||||
"vaul": "1.1.2",
|
"vaul": "1.1.2",
|
||||||
"visionscarto-world-atlas": "1.0.0",
|
"visionscarto-world-atlas": "1.0.0",
|
||||||
"winston": "3.19.0",
|
"winston": "3.19.0",
|
||||||
"winston-daily-rotate-file": "5.0.0",
|
"winston-daily-rotate-file": "5.0.0",
|
||||||
"ws": "8.21.0",
|
"ws": "8.21.1",
|
||||||
"yaml": "2.9.0",
|
"yaml": "2.9.0",
|
||||||
"yargs": "18.0.0",
|
"yargs": "18.1.0",
|
||||||
"zod": "4.4.3",
|
"zod": "4.4.3",
|
||||||
"zod-validation-error": "5.0.0"
|
"zod-validation-error": "5.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dotenvx/dotenvx": "1.69.1",
|
"@dotenvx/dotenvx": "2.19.1",
|
||||||
"@esbuild-plugins/tsconfig-paths": "0.1.2",
|
"@esbuild-plugins/tsconfig-paths": "0.1.2",
|
||||||
"@react-email/ui": "^6.5.0",
|
"@react-email/ui": "^6.9.1",
|
||||||
"@tailwindcss/postcss": "4.3.0",
|
"@tailwindcss/postcss": "4.3.3",
|
||||||
"@tanstack/react-query-devtools": "5.100.14",
|
"@tanstack/react-query-devtools": "5.101.4",
|
||||||
"@types/better-sqlite3": "7.6.13",
|
"@types/better-sqlite3": "7.6.13",
|
||||||
"@types/cookie-parser": "1.4.10",
|
"@types/cookie-parser": "1.4.10",
|
||||||
"@types/cors": "2.8.19",
|
"@types/cors": "2.8.19",
|
||||||
@@ -151,14 +151,14 @@
|
|||||||
"@types/jmespath": "0.15.2",
|
"@types/jmespath": "0.15.2",
|
||||||
"@types/js-yaml": "4.0.9",
|
"@types/js-yaml": "4.0.9",
|
||||||
"@types/jsonwebtoken": "9.0.10",
|
"@types/jsonwebtoken": "9.0.10",
|
||||||
"@types/node": "25.9.1",
|
"@types/node": "26.1.2",
|
||||||
"@types/nodemailer": "8.0.0",
|
"@types/nodemailer": "8.0.1",
|
||||||
"@types/nprogress": "0.2.3",
|
"@types/nprogress": "0.2.3",
|
||||||
"@types/pg": "8.20.0",
|
"@types/pg": "8.20.3",
|
||||||
"@types/react": "19.2.15",
|
"@types/react": "19.2.18",
|
||||||
"@types/react-dom": "19.2.3",
|
"@types/react-dom": "19.2.4",
|
||||||
"@types/semver": "7.7.1",
|
"@types/semver": "7.8.0",
|
||||||
"@types/sshpk": "1.17.4",
|
"@types/sshpk": "1.17.5",
|
||||||
"@types/swagger-ui-express": "4.1.8",
|
"@types/swagger-ui-express": "4.1.8",
|
||||||
"@types/topojson-client": "3.1.5",
|
"@types/topojson-client": "3.1.5",
|
||||||
"@types/ws": "8.18.1",
|
"@types/ws": "8.18.1",
|
||||||
@@ -166,21 +166,21 @@
|
|||||||
"babel-plugin-react-compiler": "1.0.0",
|
"babel-plugin-react-compiler": "1.0.0",
|
||||||
"drizzle-kit": "0.31.10",
|
"drizzle-kit": "0.31.10",
|
||||||
"esbuild": "0.28.1",
|
"esbuild": "0.28.1",
|
||||||
"esbuild-node-externals": "1.22.0",
|
"esbuild-node-externals": "1.23.1",
|
||||||
"eslint": "10.4.0",
|
"eslint": "10.8.0",
|
||||||
"eslint-config-next": "16.2.6",
|
"eslint-config-next": "16.2.12",
|
||||||
"postcss": "8.5.15",
|
"postcss": "8.5.25",
|
||||||
"prettier": "3.8.3",
|
"prettier": "3.9.6",
|
||||||
"react-email": "6.5.0",
|
"react-email": "6.9.1",
|
||||||
"tailwindcss": "4.3.0",
|
"tailwindcss": "4.3.3",
|
||||||
"tsc-alias": "1.8.17",
|
"tsc-alias": "1.9.1",
|
||||||
"tsx": "4.22.3",
|
"tsx": "4.23.5",
|
||||||
"typescript": "6.0.3",
|
"typescript": "7.0.2",
|
||||||
"typescript-eslint": "8.60.0"
|
"typescript-eslint": "8.65.0"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"esbuild": "0.28.1",
|
"esbuild": "0.28.1",
|
||||||
"dompurify": "3.4.0",
|
"dompurify": "3.4.0",
|
||||||
"postcss": "8.5.15"
|
"postcss": "8.5.25"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,9 +34,7 @@ const createRoleSchema = z.strictObject({
|
|||||||
export const defaultRoleAllowedActions: ActionsEnum[] = [
|
export const defaultRoleAllowedActions: ActionsEnum[] = [
|
||||||
ActionsEnum.getOrg,
|
ActionsEnum.getOrg,
|
||||||
ActionsEnum.getResource,
|
ActionsEnum.getResource,
|
||||||
ActionsEnum.listResources,
|
ActionsEnum.listResources
|
||||||
ActionsEnum.getSiteResource,
|
|
||||||
ActionsEnum.listSiteResources
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export type CreateRoleBody = z.infer<typeof createRoleSchema>;
|
export type CreateRoleBody = z.infer<typeof createRoleSchema>;
|
||||||
|
|||||||
@@ -3,13 +3,11 @@ import {
|
|||||||
DB_TYPE,
|
DB_TYPE,
|
||||||
Label,
|
Label,
|
||||||
SiteResource,
|
SiteResource,
|
||||||
roleSiteResources,
|
|
||||||
siteNetworks,
|
siteNetworks,
|
||||||
siteResourceLabels,
|
siteResourceLabels,
|
||||||
siteResources,
|
siteResources,
|
||||||
sites,
|
sites,
|
||||||
labels,
|
labels
|
||||||
userSiteResources
|
|
||||||
} from "@server/db";
|
} from "@server/db";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
@@ -325,48 +323,7 @@ export async function listAllSiteResourcesByOrg(
|
|||||||
labels: labelFilter
|
labels: labelFilter
|
||||||
} = parsedQuery.data;
|
} = parsedQuery.data;
|
||||||
|
|
||||||
let accessibleSiteResourceIds: number[];
|
const conditions = [and(eq(siteResources.orgId, orgId))];
|
||||||
if (req.user) {
|
|
||||||
const accessibleSiteResources = await db
|
|
||||||
.select({
|
|
||||||
siteResourceId: sql<number>`COALESCE(${userSiteResources.siteResourceId}, ${roleSiteResources.siteResourceId})`
|
|
||||||
})
|
|
||||||
.from(userSiteResources)
|
|
||||||
.fullJoin(
|
|
||||||
roleSiteResources,
|
|
||||||
eq(
|
|
||||||
userSiteResources.siteResourceId,
|
|
||||||
roleSiteResources.siteResourceId
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.where(
|
|
||||||
or(
|
|
||||||
eq(userSiteResources.userId, req.user.userId),
|
|
||||||
inArray(
|
|
||||||
roleSiteResources.roleId,
|
|
||||||
req.userOrgRoleIds ?? []
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
accessibleSiteResourceIds = accessibleSiteResources.map(
|
|
||||||
(row) => row.siteResourceId
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
const allOrgSiteResources = await db
|
|
||||||
.select({ siteResourceId: siteResources.siteResourceId })
|
|
||||||
.from(siteResources)
|
|
||||||
.where(eq(siteResources.orgId, orgId));
|
|
||||||
accessibleSiteResourceIds = allOrgSiteResources.map(
|
|
||||||
(row) => row.siteResourceId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const conditions = [
|
|
||||||
and(
|
|
||||||
eq(siteResources.orgId, orgId),
|
|
||||||
inArray(siteResources.siteResourceId, accessibleSiteResourceIds)
|
|
||||||
)
|
|
||||||
];
|
|
||||||
|
|
||||||
if (siteId != null) {
|
if (siteId != null) {
|
||||||
// Keep inner joins here: filtering by a specific site implies the
|
// Keep inner joins here: filtering by a specific site implies the
|
||||||
|
|||||||
@@ -1,17 +1,11 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import {
|
import { db, networks, siteNetworks } from "@server/db";
|
||||||
db,
|
|
||||||
networks,
|
|
||||||
roleSiteResources,
|
|
||||||
siteNetworks,
|
|
||||||
userSiteResources
|
|
||||||
} from "@server/db";
|
|
||||||
import { siteResources, sites, SiteResource } from "@server/db";
|
import { siteResources, sites, SiteResource } from "@server/db";
|
||||||
import response from "@server/lib/response";
|
import response from "@server/lib/response";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
|
import { and, asc, desc, eq } from "drizzle-orm";
|
||||||
import { fromError } from "zod-validation-error";
|
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";
|
||||||
@@ -165,47 +159,10 @@ export async function listSiteResources(
|
|||||||
return next(createHttpError(HttpCode.NOT_FOUND, "Site not found"));
|
return next(createHttpError(HttpCode.NOT_FOUND, "Site not found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
let accessibleSiteResourceIds: number[];
|
|
||||||
if (req.user) {
|
|
||||||
const accessibleSiteResources = await db
|
|
||||||
.select({
|
|
||||||
siteResourceId: sql<number>`COALESCE(${userSiteResources.siteResourceId}, ${roleSiteResources.siteResourceId})`
|
|
||||||
})
|
|
||||||
.from(userSiteResources)
|
|
||||||
.fullJoin(
|
|
||||||
roleSiteResources,
|
|
||||||
eq(
|
|
||||||
userSiteResources.siteResourceId,
|
|
||||||
roleSiteResources.siteResourceId
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.where(
|
|
||||||
or(
|
|
||||||
eq(userSiteResources.userId, req.user.userId),
|
|
||||||
inArray(
|
|
||||||
roleSiteResources.roleId,
|
|
||||||
req.userOrgRoleIds ?? []
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
accessibleSiteResourceIds = accessibleSiteResources.map(
|
|
||||||
(row) => row.siteResourceId
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
const allOrgSiteResources = await db
|
|
||||||
.select({ siteResourceId: siteResources.siteResourceId })
|
|
||||||
.from(siteResources)
|
|
||||||
.where(eq(siteResources.orgId, orgId));
|
|
||||||
accessibleSiteResourceIds = allOrgSiteResources.map(
|
|
||||||
(row) => row.siteResourceId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get site resources by joining networks to siteResources via siteNetworks
|
// Get site resources by joining networks to siteResources via siteNetworks
|
||||||
const conditions = [
|
const conditions = [
|
||||||
eq(siteNetworks.siteId, siteId),
|
eq(siteNetworks.siteId, siteId),
|
||||||
eq(siteResources.orgId, orgId),
|
eq(siteResources.orgId, orgId)
|
||||||
inArray(siteResources.siteResourceId, accessibleSiteResourceIds)
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (typeof status !== "undefined") {
|
if (typeof status !== "undefined") {
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import m19 from "./scriptsPg/1.18.4";
|
|||||||
import m20 from "./scriptsPg/1.19.0";
|
import m20 from "./scriptsPg/1.19.0";
|
||||||
import m21 from "./scriptsPg/1.20.0";
|
import m21 from "./scriptsPg/1.20.0";
|
||||||
import m22 from "./scriptsPg/1.21.0";
|
import m22 from "./scriptsPg/1.21.0";
|
||||||
import m23 from "./scriptsPg/1.21.1";
|
|
||||||
|
|
||||||
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
|
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
|
||||||
// EXCEPT FOR THE DATABASE AND THE SCHEMA
|
// EXCEPT FOR THE DATABASE AND THE SCHEMA
|
||||||
@@ -56,8 +55,7 @@ const migrations = [
|
|||||||
{ version: "1.18.4", run: m19 },
|
{ version: "1.18.4", run: m19 },
|
||||||
{ version: "1.19.0", run: m20 },
|
{ version: "1.19.0", run: m20 },
|
||||||
{ version: "1.20.0", run: m21 },
|
{ version: "1.20.0", run: m21 },
|
||||||
{ version: "1.21.0", run: m22 },
|
{ version: "1.21.0", run: m22 }
|
||||||
{ version: "1.21.1", run: m23 }
|
|
||||||
// Add new migrations here as they are created
|
// Add new migrations here as they are created
|
||||||
] as {
|
] as {
|
||||||
version: string;
|
version: string;
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ import m41 from "./scriptsSqlite/1.19.0";
|
|||||||
import m42 from "./scriptsSqlite/1.19.1";
|
import m42 from "./scriptsSqlite/1.19.1";
|
||||||
import m43 from "./scriptsSqlite/1.20.0";
|
import m43 from "./scriptsSqlite/1.20.0";
|
||||||
import m44 from "./scriptsSqlite/1.21.0";
|
import m44 from "./scriptsSqlite/1.21.0";
|
||||||
import m45 from "./scriptsSqlite/1.21.1";
|
|
||||||
|
|
||||||
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
|
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
|
||||||
// EXCEPT FOR THE DATABASE AND THE SCHEMA
|
// EXCEPT FOR THE DATABASE AND THE SCHEMA
|
||||||
@@ -92,8 +91,7 @@ const migrations = [
|
|||||||
{ version: "1.19.0", run: m41 },
|
{ version: "1.19.0", run: m41 },
|
||||||
{ version: "1.19.1", run: m42 },
|
{ version: "1.19.1", run: m42 },
|
||||||
{ version: "1.20.0", run: m43 },
|
{ version: "1.20.0", run: m43 },
|
||||||
{ version: "1.21.0", run: m44 },
|
{ version: "1.21.0", run: m44 }
|
||||||
{ version: "1.21.1", run: m45 }
|
|
||||||
// Add new migrations here as they are created
|
// Add new migrations here as they are created
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
import { db } from "@server/db/pg/driver";
|
|
||||||
import { sql } from "drizzle-orm";
|
|
||||||
|
|
||||||
const version = "1.21.1";
|
|
||||||
|
|
||||||
const actionsToGrant = ["getSiteResource", "listSiteResources"] as const;
|
|
||||||
|
|
||||||
export default async function migration() {
|
|
||||||
console.log(`Running setup script ${version}...`);
|
|
||||||
|
|
||||||
try {
|
|
||||||
await db.execute(sql`BEGIN`);
|
|
||||||
|
|
||||||
for (const actionId of actionsToGrant) {
|
|
||||||
await db.execute(sql`
|
|
||||||
INSERT INTO "roleActions" ("roleId", "actionId", "orgId")
|
|
||||||
SELECT r."roleId", ${actionId}, r."orgId"
|
|
||||||
FROM "roles" r
|
|
||||||
WHERE COALESCE(r."isAdmin", false) = false
|
|
||||||
AND NOT EXISTS (
|
|
||||||
SELECT 1 FROM "roleActions" ra
|
|
||||||
WHERE ra."roleId" = r."roleId"
|
|
||||||
AND ra."actionId" = ${actionId}
|
|
||||||
AND ra."orgId" = r."orgId"
|
|
||||||
);
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
|
|
||||||
await db.execute(sql`COMMIT`);
|
|
||||||
console.log(`Finished setup script ${version}`);
|
|
||||||
} catch (e) {
|
|
||||||
await db.execute(sql`ROLLBACK`);
|
|
||||||
console.log("Unable to migrate database");
|
|
||||||
console.log(e);
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
import { APP_PATH } from "@server/lib/consts";
|
|
||||||
import Database from "better-sqlite3";
|
|
||||||
import path from "path";
|
|
||||||
|
|
||||||
const version = "1.21.1";
|
|
||||||
|
|
||||||
const actionsToGrant = ["getSiteResource", "listSiteResources"] as const;
|
|
||||||
|
|
||||||
export default async function migration() {
|
|
||||||
console.log(`Running setup script ${version}...`);
|
|
||||||
|
|
||||||
const location = path.join(APP_PATH, "db", "db.sqlite");
|
|
||||||
const db = new Database(location);
|
|
||||||
|
|
||||||
try {
|
|
||||||
db.transaction(() => {
|
|
||||||
const insertRoleAction = db.prepare(`
|
|
||||||
INSERT INTO 'roleActions' ("roleId", "actionId", "orgId")
|
|
||||||
SELECT r."roleId", ?, r."orgId"
|
|
||||||
FROM 'roles' r
|
|
||||||
WHERE COALESCE(r."isAdmin", 0) = 0
|
|
||||||
AND NOT EXISTS (
|
|
||||||
SELECT 1 FROM 'roleActions' ra
|
|
||||||
WHERE ra."roleId" = r."roleId"
|
|
||||||
AND ra."actionId" = ?
|
|
||||||
AND ra."orgId" = r."orgId"
|
|
||||||
);
|
|
||||||
`);
|
|
||||||
|
|
||||||
for (const actionId of actionsToGrant) {
|
|
||||||
insertRoleAction.run(actionId, actionId);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
console.log(`Finished setup script ${version}`);
|
|
||||||
} catch (e) {
|
|
||||||
console.log("Unable to migrate database");
|
|
||||||
console.log(e);
|
|
||||||
throw e;
|
|
||||||
} finally {
|
|
||||||
db.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,18 +24,16 @@ export function ContactSalesBanner() {
|
|||||||
<ExternalLink className="size-3.5 shrink-0" />
|
<ExternalLink className="size-3.5 shrink-0" />
|
||||||
</Link>
|
</Link>
|
||||||
{" " + t("contactSalesOr") + " "}
|
{" " + t("contactSalesOr") + " "}
|
||||||
<span className="whitespace-nowrap">
|
<Link
|
||||||
<Link
|
href="https://pangolin.net/contact"
|
||||||
href="https://pangolin.net/contact"
|
target="_blank"
|
||||||
target="_blank"
|
rel="noopener noreferrer"
|
||||||
rel="noopener noreferrer"
|
className="inline-flex items-center gap-1 font-medium text-black-600 underline"
|
||||||
className="inline-flex items-center gap-1 font-medium text-black-600 underline"
|
>
|
||||||
>
|
{t("contactSalesContactUs")}
|
||||||
{t("contactSalesContactUs")}
|
<ExternalLink className="size-3.5 shrink-0" />
|
||||||
<ExternalLink className="size-3.5 shrink-0" />
|
</Link>
|
||||||
</Link>
|
.
|
||||||
.
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
import { InputOTP, InputOTPGroup, InputOTPSlot } from "./ui/input-otp";
|
import { InputOTP, InputOTPGroup, InputOTPSlot } from "./ui/input-otp";
|
||||||
import { Alert, AlertDescription } from "@app/components/ui/alert";
|
import { Alert, AlertDescription } from "@app/components/ui/alert";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { REGEXP_ONLY_DIGITS_AND_CHARS } from "input-otp";
|
import { REGEXP_ONLY_DIGITS } from "input-otp";
|
||||||
|
|
||||||
const MFA_OTP_INPUT_ID = "mfa-otp-code";
|
const MFA_OTP_INPUT_ID = "mfa-otp-code";
|
||||||
|
|
||||||
@@ -82,11 +82,9 @@ export default function MfaInputForm({
|
|||||||
maxLength={6}
|
maxLength={6}
|
||||||
{...field}
|
{...field}
|
||||||
autoComplete="one-time-code"
|
autoComplete="one-time-code"
|
||||||
inputMode="text"
|
inputMode="numeric"
|
||||||
autoFocus
|
autoFocus
|
||||||
pattern={
|
pattern={REGEXP_ONLY_DIGITS}
|
||||||
REGEXP_ONLY_DIGITS_AND_CHARS
|
|
||||||
}
|
|
||||||
onChange={(value: string) => {
|
onChange={(value: string) => {
|
||||||
field.onChange(value);
|
field.onChange(value);
|
||||||
if (value.length === 6) {
|
if (value.length === 6) {
|
||||||
|
|||||||
Reference in New Issue
Block a user