mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-12 15:04:53 +02:00
adjustment to pr
This commit is contained in:
parent
957fa67e24
commit
bf8bb1a0df
3 changed files with 85 additions and 83 deletions
|
@ -78,8 +78,8 @@ export const resources = sqliteTable("resources", {
|
||||||
.notNull()
|
.notNull()
|
||||||
.default(false),
|
.default(false),
|
||||||
enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
|
enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
|
||||||
tlsServerName: text("tlsServerName").notNull().default(""),
|
tlsServerName: text("tlsServerName"),
|
||||||
setHostHeader: text("setHostHeader").notNull().default("")
|
setHostHeader: text("setHostHeader")
|
||||||
});
|
});
|
||||||
|
|
||||||
export const targets = sqliteTable("targets", {
|
export const targets = sqliteTable("targets", {
|
||||||
|
|
|
@ -123,7 +123,8 @@ const AdvancedFormSchema = z
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
message: "Invalid TLS Server Name. Use domain name format, or save empty to remove the TLS Server Name.",
|
message:
|
||||||
|
"Invalid TLS Server Name. Use domain name format, or save empty to remove the TLS Server Name.",
|
||||||
path: ["tlsServerName"]
|
path: ["tlsServerName"]
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -135,7 +136,8 @@ const AdvancedFormSchema = z
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
message: "Invalid custom Host Header value. Use domain name format, or save empty to unset the custom Host Header",
|
message:
|
||||||
|
"Invalid custom Host Header value. Use domain name format, or save empty to unset the custom Host Header",
|
||||||
path: ["tlsServerName"]
|
path: ["tlsServerName"]
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -187,8 +189,12 @@ export default function GeneralForm() {
|
||||||
resolver: zodResolver(AdvancedFormSchema),
|
resolver: zodResolver(AdvancedFormSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
http: resource.http,
|
http: resource.http,
|
||||||
tlsServerName: resource.http ? resource.tlsServerName || "" : undefined,
|
tlsServerName: resource.http
|
||||||
setHostHeader: resource.http ? resource.setHostHeader || "" : undefined
|
? resource.tlsServerName || ""
|
||||||
|
: undefined,
|
||||||
|
setHostHeader: resource.http
|
||||||
|
? resource.setHostHeader || ""
|
||||||
|
: undefined
|
||||||
},
|
},
|
||||||
mode: "onChange"
|
mode: "onChange"
|
||||||
});
|
});
|
||||||
|
@ -683,81 +689,77 @@ export default function GeneralForm() {
|
||||||
</SettingsSectionFooter>
|
</SettingsSectionFooter>
|
||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
|
|
||||||
{resource.http && (
|
{resource.http && (
|
||||||
<>
|
<>
|
||||||
<SettingsSection>
|
<SettingsSection>
|
||||||
<SettingsSectionHeader>
|
<SettingsSectionHeader>
|
||||||
<SettingsSectionTitle>Advanced</SettingsSectionTitle>
|
<SettingsSectionTitle>
|
||||||
<SettingsSectionDescription>
|
Advanced
|
||||||
Adjust advanced settings for the resource, like customize the Host Header or set a TLS Server Name for SNI based routing.
|
</SettingsSectionTitle>
|
||||||
</SettingsSectionDescription>
|
<SettingsSectionDescription>
|
||||||
</SettingsSectionHeader>
|
Adjust advanced settings for the resource,
|
||||||
<SettingsSectionBody>
|
like customize the Host Header or set a TLS
|
||||||
<SettingsSectionForm>
|
Server Name for SNI based routing.
|
||||||
<Form {...advancedForm}>
|
</SettingsSectionDescription>
|
||||||
<form
|
</SettingsSectionHeader>
|
||||||
onSubmit={advancedForm.handleSubmit(onSubmitAdvanced)}
|
<SettingsSectionBody>
|
||||||
className="grid grid-cols-1 md:grid-cols-2 gap-4"
|
<SettingsSectionForm>
|
||||||
id="advanced-settings-form"
|
<Form {...advancedForm}>
|
||||||
>
|
<form
|
||||||
{/* New TLS Server Name Field */}
|
onSubmit={advancedForm.handleSubmit(
|
||||||
<div className="w-fill space-y-2">
|
onSubmitAdvanced
|
||||||
<FormLabel>
|
)}
|
||||||
TLS Server Name (optional)
|
id="advanced-settings-form"
|
||||||
</FormLabel>
|
>
|
||||||
<FormField
|
<FormLabel>
|
||||||
control={advancedForm.control}
|
TLS Server Name (optional)
|
||||||
name="tlsServerName"
|
</FormLabel>
|
||||||
render={({ field }) => (
|
<FormField
|
||||||
<FormItem>
|
control={advancedForm.control}
|
||||||
<FormControl>
|
name="tlsServerName"
|
||||||
<Input
|
render={({ field }) => (
|
||||||
{...field}
|
<FormItem>
|
||||||
/>
|
<FormControl>
|
||||||
</FormControl>
|
<Input {...field} />
|
||||||
<FormMessage />
|
</FormControl>
|
||||||
</FormItem>
|
<FormMessage />
|
||||||
)}
|
</FormItem>
|
||||||
/>
|
)}
|
||||||
</div>
|
/>
|
||||||
{/* New Custom Host Header Field */}
|
|
||||||
<div className="w-fill space-y-2">
|
|
||||||
<FormLabel>
|
|
||||||
Custom Host Header (optional)
|
|
||||||
</FormLabel>
|
|
||||||
<FormField
|
|
||||||
control={advancedForm.control}
|
|
||||||
name="setHostHeader"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem>
|
|
||||||
<FormControl>
|
|
||||||
<Input
|
|
||||||
{...field}
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</Form>
|
|
||||||
</SettingsSectionForm>
|
|
||||||
</SettingsSectionBody>
|
|
||||||
|
|
||||||
<SettingsSectionFooter>
|
<FormLabel>
|
||||||
<Button
|
Custom Host Header (optional)
|
||||||
type="submit"
|
</FormLabel>
|
||||||
loading={saveLoading}
|
<FormField
|
||||||
disabled={saveLoading}
|
control={advancedForm.control}
|
||||||
form="advanced-settings-form"
|
name="setHostHeader"
|
||||||
>
|
render={({ field }) => (
|
||||||
Save Advanced Settings
|
<FormItem>
|
||||||
</Button>
|
<FormControl>
|
||||||
</SettingsSectionFooter>
|
<Input {...field} />
|
||||||
</SettingsSection>
|
</FormControl>
|
||||||
</>
|
<FormMessage />
|
||||||
)}
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
</Form>
|
||||||
|
</SettingsSectionForm>
|
||||||
|
</SettingsSectionBody>
|
||||||
|
|
||||||
|
<SettingsSectionFooter>
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
loading={saveLoading}
|
||||||
|
disabled={saveLoading}
|
||||||
|
form="advanced-settings-form"
|
||||||
|
>
|
||||||
|
Save Advanced Settings
|
||||||
|
</Button>
|
||||||
|
</SettingsSectionFooter>
|
||||||
|
</SettingsSection>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<SettingsSection>
|
<SettingsSection>
|
||||||
<SettingsSectionHeader>
|
<SettingsSectionHeader>
|
||||||
<SettingsSectionTitle>
|
<SettingsSectionTitle>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue