mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-28 22:00:51 +00:00
Make private
This commit is contained in:
1394
package-lock.json
generated
1394
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,7 @@ import * as auth from "#private/routers/auth";
|
||||
import * as orgIdp from "#private/routers/orgIdp";
|
||||
import * as billing from "#private/routers/billing";
|
||||
import * as license from "#private/routers/license";
|
||||
import * as resource from "#private/routers/resource";
|
||||
|
||||
import { verifySessionUserMiddleware } from "@server/middlewares";
|
||||
|
||||
@@ -37,3 +38,5 @@ internalRouter.post(
|
||||
);
|
||||
|
||||
internalRouter.get(`/license/status`, license.getLicenseStatus);
|
||||
|
||||
internalRouter.get("/maintenance/info", resource.getMaintenanceInfo);
|
||||
@@ -1,3 +1,15 @@
|
||||
/*
|
||||
* This file is part of a proprietary work.
|
||||
*
|
||||
* Copyright (c) 2025 Fossorial, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is licensed under the Fossorial Commercial License.
|
||||
* You may not use this file except in compliance with the License.
|
||||
* Unauthorized use, copying, modification, or distribution is strictly prohibited.
|
||||
*
|
||||
* This file is not licensed under the AGPLv3.
|
||||
*/
|
||||
|
||||
import { Request, Response, NextFunction } from "express";
|
||||
import { z } from "zod";
|
||||
@@ -10,6 +22,7 @@ import createHttpError from "http-errors";
|
||||
import { fromError } from "zod-validation-error";
|
||||
import logger from "@server/logger";
|
||||
import { OpenAPITags, registry } from "@server/openApi";
|
||||
import { GetMaintenanceInfoResponse } from "@server/routers/resource/types";
|
||||
|
||||
const getMaintenanceInfoSchema = z
|
||||
.object({
|
||||
@@ -35,10 +48,6 @@ async function query(fullDomain: string) {
|
||||
return res;
|
||||
}
|
||||
|
||||
export type GetMaintenanceInfoResponse = NonNullable<
|
||||
Awaited<ReturnType<typeof query>>
|
||||
>;
|
||||
|
||||
registry.registerPath({
|
||||
method: "get",
|
||||
path: "/maintenance/info",
|
||||
14
server/private/routers/resource/index.ts
Normal file
14
server/private/routers/resource/index.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* This file is part of a proprietary work.
|
||||
*
|
||||
* Copyright (c) 2025 Fossorial, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is licensed under the Fossorial Commercial License.
|
||||
* You may not use this file except in compliance with the License.
|
||||
* Unauthorized use, copying, modification, or distribution is strictly prohibited.
|
||||
*
|
||||
* This file is not licensed under the AGPLv3.
|
||||
*/
|
||||
|
||||
export * from "./getMaintenanceInfo";
|
||||
@@ -48,7 +48,6 @@ import createHttpError from "http-errors";
|
||||
import { build } from "@server/build";
|
||||
import { createStore } from "#dynamic/lib/rateLimitStore";
|
||||
import { logActionAudit } from "#dynamic/middlewares";
|
||||
import { log } from "console";
|
||||
|
||||
// Root routes
|
||||
export const unauthenticated = Router();
|
||||
@@ -57,8 +56,6 @@ unauthenticated.get("/", (_, res) => {
|
||||
res.status(HttpCode.OK).json({ message: "Healthy" });
|
||||
});
|
||||
|
||||
unauthenticated.get("/maintenance/info", resource.getMaintenanceInfo);
|
||||
|
||||
// Authenticated Root routes
|
||||
export const authenticated = Router();
|
||||
authenticated.use(verifySessionUserMiddleware);
|
||||
|
||||
@@ -31,3 +31,4 @@ export * from "./addUserToResource";
|
||||
export * from "./removeUserFromResource";
|
||||
export * from "./listAllResourceNames";
|
||||
export * from "./getMaintenanceInfo";
|
||||
export * from "./removeEmailFromResourceWhitelist";
|
||||
|
||||
10
server/routers/resource/types.ts
Normal file
10
server/routers/resource/types.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export type GetMaintenanceInfoResponse = {
|
||||
resourceId: number;
|
||||
name: string;
|
||||
fullDomain: string | null;
|
||||
maintenanceModeEnabled: boolean;
|
||||
maintenanceModeType: "forced" | "automatic" | null;
|
||||
maintenanceTitle: string | null;
|
||||
maintenanceMessage: string | null;
|
||||
maintenanceEstimatedTime: string | null;
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
import { headers } from "next/headers";
|
||||
import { priv } from "@app/lib/api";
|
||||
import { GetMaintenanceInfoResponse } from "@server/routers/resource";
|
||||
|
||||
import { GetMaintenanceInfoResponse } from "@server/routers/resource/types";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const revalidate = 0;
|
||||
@@ -13,10 +12,6 @@ export default async function MaintenanceScreen() {
|
||||
"We are currently experiencing technical difficulties. Please check back soon.";
|
||||
let estimatedTime: string | null = null;
|
||||
|
||||
// Check if we're in build mode
|
||||
const isBuildTime = process.env.NEXT_PHASE === 'phase-production-build';
|
||||
|
||||
if (!isBuildTime) {
|
||||
try {
|
||||
const headersList = await headers();
|
||||
const host = headersList.get("host") || "";
|
||||
@@ -26,7 +21,6 @@ export default async function MaintenanceScreen() {
|
||||
`/maintenance/info?fullDomain=${encodeURIComponent(hostname)}`
|
||||
);
|
||||
|
||||
|
||||
if (res && res.status === 200) {
|
||||
const maintenanceInfo = res.data;
|
||||
title = maintenanceInfo?.maintenanceTitle || title;
|
||||
@@ -39,7 +33,6 @@ export default async function MaintenanceScreen() {
|
||||
err instanceof Error ? err.message : String(err)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-gray-100">
|
||||
|
||||
Reference in New Issue
Block a user