mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-07 11:16:37 +00:00
Dont send enableProxy
This commit is contained in:
@@ -33,14 +33,11 @@ const createResourceParamsSchema = z
|
|||||||
const createHttpResourceSchema = z
|
const createHttpResourceSchema = z
|
||||||
.object({
|
.object({
|
||||||
name: z.string().min(1).max(255),
|
name: z.string().min(1).max(255),
|
||||||
subdomain: z
|
subdomain: z.string().nullable().optional(),
|
||||||
.string()
|
|
||||||
.nullable()
|
|
||||||
.optional(),
|
|
||||||
siteId: z.number(),
|
siteId: z.number(),
|
||||||
http: z.boolean(),
|
http: z.boolean(),
|
||||||
protocol: z.enum(["tcp", "udp"]),
|
protocol: z.enum(["tcp", "udp"]),
|
||||||
domainId: z.string(),
|
domainId: z.string()
|
||||||
})
|
})
|
||||||
.strict()
|
.strict()
|
||||||
.refine(
|
.refine(
|
||||||
@@ -51,7 +48,7 @@ const createHttpResourceSchema = z
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
{ message: "Invalid subdomain" }
|
{ message: "Invalid subdomain" }
|
||||||
)
|
);
|
||||||
|
|
||||||
const createRawResourceSchema = z
|
const createRawResourceSchema = z
|
||||||
.object({
|
.object({
|
||||||
@@ -89,12 +86,7 @@ registry.registerPath({
|
|||||||
body: {
|
body: {
|
||||||
content: {
|
content: {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
schema:
|
schema: createHttpResourceSchema.or(createRawResourceSchema)
|
||||||
build == "oss"
|
|
||||||
? createHttpResourceSchema.or(
|
|
||||||
createRawResourceSchema
|
|
||||||
)
|
|
||||||
: createHttpResourceSchema
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,7 +149,10 @@ export async function createResource(
|
|||||||
{ siteId, orgId }
|
{ siteId, orgId }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (!config.getRawConfig().flags?.allow_raw_resources && build == "oss") {
|
if (
|
||||||
|
!config.getRawConfig().flags?.allow_raw_resources &&
|
||||||
|
build == "oss"
|
||||||
|
) {
|
||||||
return next(
|
return next(
|
||||||
createHttpError(
|
createHttpError(
|
||||||
HttpCode.BAD_REQUEST,
|
HttpCode.BAD_REQUEST,
|
||||||
|
|||||||
@@ -34,9 +34,7 @@ const updateResourceParamsSchema = z
|
|||||||
const updateHttpResourceBodySchema = z
|
const updateHttpResourceBodySchema = z
|
||||||
.object({
|
.object({
|
||||||
name: z.string().min(1).max(255).optional(),
|
name: z.string().min(1).max(255).optional(),
|
||||||
subdomain: subdomainSchema
|
subdomain: subdomainSchema.nullable().optional(),
|
||||||
.nullable()
|
|
||||||
.optional(),
|
|
||||||
ssl: z.boolean().optional(),
|
ssl: z.boolean().optional(),
|
||||||
sso: z.boolean().optional(),
|
sso: z.boolean().optional(),
|
||||||
blockAccess: z.boolean().optional(),
|
blockAccess: z.boolean().optional(),
|
||||||
@@ -94,7 +92,7 @@ const updateRawResourceBodySchema = z
|
|||||||
proxyPort: z.number().int().min(1).max(65535).optional(),
|
proxyPort: z.number().int().min(1).max(65535).optional(),
|
||||||
stickySession: z.boolean().optional(),
|
stickySession: z.boolean().optional(),
|
||||||
enabled: z.boolean().optional(),
|
enabled: z.boolean().optional(),
|
||||||
enableProxy: z.boolean().optional(),
|
enableProxy: z.boolean().optional()
|
||||||
})
|
})
|
||||||
.strict()
|
.strict()
|
||||||
.refine((data) => Object.keys(data).length > 0, {
|
.refine((data) => Object.keys(data).length > 0, {
|
||||||
@@ -122,12 +120,9 @@ registry.registerPath({
|
|||||||
body: {
|
body: {
|
||||||
content: {
|
content: {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
schema:
|
schema: updateHttpResourceBodySchema.and(
|
||||||
build == "oss"
|
updateRawResourceBodySchema
|
||||||
? updateHttpResourceBodySchema.and(
|
)
|
||||||
updateRawResourceBodySchema
|
|
||||||
)
|
|
||||||
: updateHttpResourceBodySchema
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,7 +284,9 @@ async function updateHttpResource(
|
|||||||
} else if (domainRes.domains.type == "wildcard") {
|
} else if (domainRes.domains.type == "wildcard") {
|
||||||
if (updateData.subdomain !== undefined) {
|
if (updateData.subdomain !== undefined) {
|
||||||
// the subdomain cant have a dot in it
|
// the subdomain cant have a dot in it
|
||||||
const parsedSubdomain = subdomainSchema.safeParse(updateData.subdomain);
|
const parsedSubdomain = subdomainSchema.safeParse(
|
||||||
|
updateData.subdomain
|
||||||
|
);
|
||||||
if (!parsedSubdomain.success) {
|
if (!parsedSubdomain.success) {
|
||||||
return next(
|
return next(
|
||||||
createHttpError(
|
createHttpError(
|
||||||
@@ -342,7 +339,7 @@ async function updateHttpResource(
|
|||||||
|
|
||||||
const updatedResource = await db
|
const updatedResource = await db
|
||||||
.update(resources)
|
.update(resources)
|
||||||
.set({...updateData, })
|
.set({ ...updateData })
|
||||||
.where(eq(resources.resourceId, resource.resourceId))
|
.where(eq(resources.resourceId, resource.resourceId))
|
||||||
.returning();
|
.returning();
|
||||||
|
|
||||||
|
|||||||
@@ -221,7 +221,9 @@ export default function GeneralForm() {
|
|||||||
subdomain: data.subdomain,
|
subdomain: data.subdomain,
|
||||||
domainId: data.domainId,
|
domainId: data.domainId,
|
||||||
proxyPort: data.proxyPort,
|
proxyPort: data.proxyPort,
|
||||||
enableProxy: data.enableProxy
|
...(!resource.http && {
|
||||||
|
enableProxy: data.enableProxy
|
||||||
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
@@ -249,7 +251,9 @@ export default function GeneralForm() {
|
|||||||
subdomain: data.subdomain,
|
subdomain: data.subdomain,
|
||||||
fullDomain: resource.fullDomain,
|
fullDomain: resource.fullDomain,
|
||||||
proxyPort: data.proxyPort,
|
proxyPort: data.proxyPort,
|
||||||
enableProxy: data.enableProxy
|
...(!resource.http && {
|
||||||
|
enableProxy: data.enableProxy
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
router.refresh();
|
router.refresh();
|
||||||
|
|||||||
Reference in New Issue
Block a user