feat: boot-ui support behinder

This commit is contained in:
ReaJason
2024-12-22 17:37:21 +08:00
parent 29e9d2b32a
commit 14b9bcc00c
17 changed files with 138 additions and 30 deletions
+3 -1
View File
@@ -6,4 +6,6 @@ cp dist/vite.svg ../boot/src/main/resources/static/
cp -R dist/assets/* ../boot/src/main/resources/static/assets/
mkdir -p ../boot/src/main/resources/templates
cp dist/index.html ../boot/src/main/resources/templates/index.html
cp dist/index.html ../boot/src/main/resources/templates/index.html
echo "copy success"
+2 -4
View File
@@ -6,7 +6,7 @@
"scripts": {
"typecheck": "tsc --noEmit",
"dev": "vite --port=3001",
"build": "tsc -b && vite build --mode production",
"build": "tsc -b && vite build --mode production && bash copy-build.sh",
"serve": "vite preview",
"check": "bunx @biomejs/biome check ./ --write",
"start": "vite"
@@ -53,7 +53,5 @@
"tailwindcss-animate": "^1.0.7",
"zod": "^3.24.1"
},
"trustedDependencies": [
"@biomejs/biome"
]
"trustedDependencies": ["@biomejs/biome"]
}
+37
View File
@@ -271,6 +271,43 @@ export function MainConfigCard({
</div>
</div>
)}
{form.getValues().shellTool === "Behinder" && (
<div className="space-y-1">
<Label>Behinder </Label>
<div className="grid grid-cols-2 gap-2">
<FormField
control={form.control}
name="behinderPass"
render={({ field }) => (
<FormItem className="space-y-1 flex items-center justify-start">
<Label className="text-xs whitespace-nowrap w-1/2"></Label>
<Input {...field} placeholder="Pass" className="h-8" />
</FormItem>
)}
/>
<FormField
control={form.control}
name="behinderHeaderName"
render={({ field }) => (
<FormItem className="space-y-1 flex items-center justify-start">
<Label className="text-xs whitespace-nowrap w-1/2"></Label>
<Input {...field} placeholder="Header Name" className="h-8" />
</FormItem>
)}
/>
<FormField
control={form.control}
name="behinderHeaderValue"
render={({ field }) => (
<FormItem className="space-y-1 flex items-center justify-start">
<Label className="text-xs whitespace-nowrap w-1/2"></Label>
<Input {...field} placeholder="Header Value" className="h-8" />
</FormItem>
)}
/>
</div>
</div>
)}
{form.getValues().shellTool === "Command" && (
<FormField
control={form.control}
+9 -1
View File
@@ -44,6 +44,9 @@ function IndexComponent() {
godzillaHeaderName: "User-Agent",
godzillaHeaderValue: "test",
commandParamName: "cmd",
behinderPass: "pass",
behinderHeaderName: "User-Agent",
behinderHeaderValue: "test",
injectorClassName: "",
packingMethod: "Base64",
},
@@ -56,11 +59,16 @@ function IndexComponent() {
async function onSubmit(values: FormSchema) {
startTransition(async () => {
if (values.shellType.endsWith("Servlet") && values.urlPattern === "/*") {
if (values.shellType.endsWith("Servlet") && (values.urlPattern === "/*" || !values.urlPattern)) {
toast.warning("Servlet 类型的需要填写具体的 URL Pattern,例如 /hello_servlet");
return;
}
if (values.shellType.endsWith("ControllerHandler") && (values.urlPattern === "/*" || !values.urlPattern)) {
toast.warning("ControllerHandler 类型的需要填写具体的 URL Pattern,例如 /hello_controller");
return;
}
const postData = transformToPostData(values);
try {
const response = await fetch(`${env.API_URL}/generate`, {
+3
View File
@@ -13,6 +13,9 @@ export const formSchema = z.object({
godzillaKey: z.optional(z.string()),
godzillaHeaderName: z.optional(z.string()),
godzillaHeaderValue: z.optional(z.string()),
behinderPass: z.optional(z.string()),
behinderHeaderName: z.optional(z.string()),
behinderHeaderValue: z.optional(z.string()),
commandParamName: z.optional(z.string()),
injectorClassName: z.optional(z.string()),
packingMethod: z.string().min(1, { message: "请选择打包方式" }),
+3
View File
@@ -15,6 +15,9 @@ export interface ShellToolConfig {
godzillaHeaderName?: string;
godzillaHeaderValue?: string;
commandParamName?: string;
behinderPass?: string;
behinderHeaderName?: string;
behinderHeaderValue?: string;
}
export interface CommandShellToolConfig {
+3
View File
@@ -16,6 +16,9 @@ export function transformToPostData(formValue: FormSchema) {
godzillaHeaderName: formValue.godzillaHeaderName,
godzillaHeaderValue: formValue.godzillaHeaderValue,
commandParamName: formValue.commandParamName,
behinderPass: formValue.behinderPass,
behinderHeaderName: formValue.behinderHeaderName,
behinderHeaderValue: formValue.behinderHeaderValue,
};
const injectorConfig: InjectorConfig = {