mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-08 02:50:33 +00:00
Merge branch 'dev' into clients-user
This commit is contained in:
194
diff
Normal file
194
diff
Normal file
@@ -0,0 +1,194 @@
|
||||
@@ -216,36 +216,12 @@ export const ClientResourceSchema = z.object({
|
||||
// Schema for the entire configuration object
|
||||
export const ConfigSchema = z
|
||||
.object({
|
||||
- "proxy-resources": z.record(z.string(), ResourceSchema).optional().default({}),
|
||||
- "client-resources": z.record(z.string(), ClientResourceSchema).optional().default({}),
|
||||
- sites: z.record(z.string(), SiteSchema).optional().default({})
|
||||
+ "proxy-resources": z.record(z.string(), ResourceSchema).optional().prefault({}),
|
||||
+ "client-resources": z.record(z.string(), ClientResourceSchema).optional().prefault({}),
|
||||
+ sites: z.record(z.string(), SiteSchema).optional().prefault({})
|
||||
})
|
||||
.refine(
|
||||
// Enforce the full-domain uniqueness across resources in the same stack
|
||||
- (config) => {
|
||||
- // Extract all full-domain values with their resource keys
|
||||
- const fullDomainMap = new Map<string, string[]>();
|
||||
-
|
||||
--
|
||||
.optional(),
|
||||
log_level: z
|
||||
@@ -31,14 +29,14 @@ export const configSchema = z
|
||||
anonymous_usage: z.boolean().optional().default(true)
|
||||
})
|
||||
.optional()
|
||||
- .default({}),
|
||||
+ .prefault({}),
|
||||
notifications: z
|
||||
.object({
|
||||
product_updates: z.boolean().optional().default(true),
|
||||
new_releases: z.boolean().optional().default(true)
|
||||
})
|
||||
.optional()
|
||||
- .default({})
|
||||
+ .prefault({})
|
||||
})
|
||||
.optional()
|
||||
.default({
|
||||
@@ -107,7 +105,7 @@ export const configSchema = z
|
||||
token: z.string().optional().default("P-Access-Token")
|
||||
})
|
||||
.optional()
|
||||
- .default({}),
|
||||
+ .prefault({}),
|
||||
resource_session_request_param: z
|
||||
.string()
|
||||
.optional()
|
||||
@@ -132,7 +130,7 @@ export const configSchema = z
|
||||
credentials: z.boolean().optional()
|
||||
})
|
||||
.optional(),
|
||||
--
|
||||
maxmind_db_path: z.string().optional()
|
||||
})
|
||||
@@ -189,7 +187,7 @@ export const configSchema = z
|
||||
.default(5000)
|
||||
})
|
||||
.optional()
|
||||
- .default({})
|
||||
+ .prefault({})
|
||||
})
|
||||
.optional(),
|
||||
traefik: z
|
||||
@@ -222,7 +220,7 @@ export const configSchema = z
|
||||
.default("pp-transport-v")
|
||||
})
|
||||
.optional()
|
||||
- .default({}),
|
||||
+ .prefault({}),
|
||||
gerbil: z
|
||||
.object({
|
||||
exit_node_name: z.string().optional(),
|
||||
@@ -247,7 +245,7 @@ export const configSchema = z
|
||||
.default(30)
|
||||
})
|
||||
.optional()
|
||||
- .default({}),
|
||||
+ .prefault({}),
|
||||
orgs: z
|
||||
.object({
|
||||
block_size: z.number().positive().gt(0).optional().default(24),
|
||||
@@ -276,7 +274,7 @@ export const configSchema = z
|
||||
.default(500)
|
||||
})
|
||||
.optional()
|
||||
- .default({}),
|
||||
+ .prefault({}),
|
||||
auth: z
|
||||
.object({
|
||||
window_minutes: z
|
||||
@@ -293,10 +291,10 @@ export const configSchema = z
|
||||
.default(500)
|
||||
})
|
||||
.optional()
|
||||
- .default({})
|
||||
+ .prefault({})
|
||||
})
|
||||
.optional()
|
||||
- .default({}),
|
||||
+ .prefault({}),
|
||||
email: z
|
||||
.object({
|
||||
smtp_host: z.string().optional(),
|
||||
@@ -308,7 +306,7 @@ export const configSchema = z
|
||||
.transform(getEnvOrYaml("EMAIL_SMTP_PASS")),
|
||||
smtp_secure: z.boolean().optional(),
|
||||
smtp_tls_reject_unauthorized: z.boolean().optional(),
|
||||
--
|
||||
.optional(),
|
||||
flags: z
|
||||
@@ -340,7 +338,7 @@ export const configSchema = z
|
||||
.default("cname.pangolin.net")
|
||||
})
|
||||
.optional()
|
||||
- .default({})
|
||||
+ .prefault({})
|
||||
})
|
||||
.refine(
|
||||
(data) => {
|
||||
@@ -355,7 +353,7 @@ export const configSchema = z
|
||||
return true;
|
||||
},
|
||||
{
|
||||
--
|
||||
)
|
||||
.optional()
|
||||
@@ -79,14 +79,14 @@ export const privateConfigSchema = z.object({
|
||||
.default("http://gerbil:3004")
|
||||
})
|
||||
.optional()
|
||||
- .default({}),
|
||||
+ .prefault({}),
|
||||
flags: z
|
||||
.object({
|
||||
enable_redis: z.boolean().optional().default(false),
|
||||
use_pangolin_dns: z.boolean().optional().default(false)
|
||||
})
|
||||
.optional()
|
||||
- .default({}),
|
||||
+ .prefault({}),
|
||||
branding: z
|
||||
.object({
|
||||
app_name: z.string().optional(),
|
||||
diff --git a/server/private/routers/auditLogs/queryAccessAuditLog.ts b/server/private/routers/auditLogs/queryAccessAuditLog.ts
|
||||
index 33383c25..3e0b4601 100644
|
||||
--- a/server/private/routers/auditLogs/queryAccessAuditLog.ts
|
||||
+++ b/server/private/routers/auditLogs/queryAccessAuditLog.ts
|
||||
--
|
||||
.refine((val) => !isNaN(Date.parse(val)), {
|
||||
- message: "timeEnd must be a valid ISO date string"
|
||||
+ error: "timeEnd must be a valid ISO date string"
|
||||
})
|
||||
.transform((val) => Math.floor(new Date(val).getTime() / 1000))
|
||||
.optional()
|
||||
- .default(new Date().toISOString()),
|
||||
+ .prefault(new Date().toISOString()),
|
||||
action: z
|
||||
.union([z.boolean(), z.string()])
|
||||
.transform((val) => (typeof val === "string" ? val === "true" : val))
|
||||
@@ -51,7 +51,7 @@ export const queryAccessAuditLogsQuery = z.object({
|
||||
.string()
|
||||
.optional()
|
||||
.transform(Number)
|
||||
--
|
||||
.refine((val) => !isNaN(Date.parse(val)), {
|
||||
- message: "timeEnd must be a valid ISO date string"
|
||||
+ error: "timeEnd must be a valid ISO date string"
|
||||
})
|
||||
.transform((val) => Math.floor(new Date(val).getTime() / 1000))
|
||||
.optional()
|
||||
- .default(new Date().toISOString()),
|
||||
+ .prefault(new Date().toISOString()),
|
||||
action: z.string().optional(),
|
||||
actorType: z.string().optional(),
|
||||
actorId: z.string().optional(),
|
||||
@@ -50,13 +50,13 @@ export const queryActionAuditLogsQuery = z.object({
|
||||
.optional()
|
||||
.default("1000")
|
||||
.transform(Number)
|
||||
--
|
||||
.refine((val) => !isNaN(Date.parse(val)), {
|
||||
- message: "timeEnd must be a valid ISO date string"
|
||||
+ error: "timeEnd must be a valid ISO date string"
|
||||
})
|
||||
.transform((val) => Math.floor(new Date(val).getTime() / 1000))
|
||||
.optional()
|
||||
- .default(new Date().toISOString()),
|
||||
+ .prefault(new Date().toISOString()),
|
||||
action: z
|
||||
.union([z.boolean(), z.string()])
|
||||
.transform((val) => (typeof val === "string" ? val === "true" : val))
|
||||
@@ -37,13 +37,13 @@ export const queryAccessAuditLogsQuery = z.object({
|
||||
.string()
|
||||
.optional()
|
||||
.transform(Number)
|
||||
Reference in New Issue
Block a user