mirror of
https://github.com/fosrl/pangolin.git
synced 2026-09-22 05:49:05 +02:00
Forgot about blueprints
This commit is contained in:
@@ -210,8 +210,16 @@ export async function updateProxyResources(
|
||||
? true
|
||||
: resourceData.ssl;
|
||||
let headers = "";
|
||||
if (resourceData.headers) {
|
||||
headers = JSON.stringify(resourceData.headers);
|
||||
const requestHeadersData = [
|
||||
...(resourceData.headers ?? []),
|
||||
...(resourceData.requestHeaders ?? [])
|
||||
];
|
||||
if (requestHeadersData.length > 0) {
|
||||
headers = JSON.stringify(requestHeadersData);
|
||||
}
|
||||
let responseHeaders = "";
|
||||
if (resourceData.responseHeaders) {
|
||||
responseHeaders = JSON.stringify(resourceData.responseHeaders);
|
||||
}
|
||||
|
||||
if (existingResource) {
|
||||
@@ -265,7 +273,8 @@ export async function updateProxyResources(
|
||||
]
|
||||
? resourceData.auth["whitelist-users"].length > 0
|
||||
: false,
|
||||
headers: headers || null,
|
||||
requestHeaders: headers || null,
|
||||
responseHeaders: responseHeaders || null,
|
||||
applyRules:
|
||||
resourceData.rules && resourceData.rules.length > 0,
|
||||
maintenanceModeEnabled:
|
||||
@@ -724,7 +733,8 @@ export async function updateProxyResources(
|
||||
setHostHeader: resourceData["host-header"] || null,
|
||||
tlsServerName: resourceData["tls-server-name"] || null,
|
||||
ssl: resourceSsl,
|
||||
headers: headers || null,
|
||||
requestHeaders: headers || null,
|
||||
responseHeaders: responseHeaders || null,
|
||||
applyRules:
|
||||
resourceData.rules && resourceData.rules.length > 0,
|
||||
maintenanceModeEnabled: resourceData.maintenance?.enabled,
|
||||
|
||||
@@ -175,7 +175,9 @@ export const ResourceSchema = z
|
||||
auth: AuthSchema.optional(),
|
||||
"host-header": z.string().optional(),
|
||||
"tls-server-name": z.string().optional(),
|
||||
headers: z.array(HeaderSchema).optional(),
|
||||
headers: z.array(HeaderSchema).optional(), // deprecated alias for requestHeaders
|
||||
requestHeaders: z.array(HeaderSchema).optional(),
|
||||
responseHeaders: z.array(HeaderSchema).optional(),
|
||||
rules: z.array(RuleSchema).optional(),
|
||||
maintenance: MaintenanceSchema.optional()
|
||||
})
|
||||
|
||||
@@ -43,9 +43,10 @@ async function query(resourceId?: number, niceId?: string, orgId?: string) {
|
||||
|
||||
export type GetResourceResponse = Omit<
|
||||
NonNullable<Awaited<ReturnType<typeof query>>>,
|
||||
"headers"
|
||||
"requestHeaders" | "responseHeaders"
|
||||
> & {
|
||||
headers: { name: string; value: string }[] | null;
|
||||
requestHeaders: { name: string; value: string }[] | null;
|
||||
responseHeaders: { name: string; value: string }[] | null;
|
||||
};
|
||||
|
||||
registry.registerPath({
|
||||
|
||||
Reference in New Issue
Block a user