fix(ui): generate fail

This commit is contained in:
ReaJason
2025-02-28 23:25:28 +08:00
parent d14203e78f
commit b71e8ea4de
16 changed files with 113 additions and 94 deletions
@@ -57,6 +57,11 @@ public class GenerateRequest {
.headerName(shellToolConfig.getHeaderName()) .headerName(shellToolConfig.getHeaderName())
.headerValue(shellToolConfig.getHeaderValue()) .headerValue(shellToolConfig.getHeaderValue())
.build(); .build();
case NeoreGeorg -> NeoreGeorgConfig.builder()
.shellClassName(shellToolConfig.getShellClassName())
.headerName(shellToolConfig.getHeaderName())
.headerValue(shellToolConfig.getHeaderValue())
.build();
default -> throw new UnsupportedOperationException("unknown shell tool " + shellConfig.getShellTool()); default -> throw new UnsupportedOperationException("unknown shell tool " + shellConfig.getShellTool());
}; };
} }
+1 -1
View File
@@ -36,7 +36,7 @@ export function CopyableField({ label, value, text }: CopyableFieldProps) {
return ( return (
<div className="flex flex-col gap-1 py-1"> <div className="flex flex-col gap-1 py-1">
<div className="flex items-center justify-between gap-2"> <div className="flex items-center justify-between gap-2 h-8">
<Label className="text-sm text-muted-foreground">{label}</Label> <Label className="text-sm text-muted-foreground">{label}</Label>
{value && ( {value && (
<CopyToClipboard text={value as string} onCopy={handleCopy}> <CopyToClipboard text={value as string} onCopy={handleCopy}>
+1 -1
View File
@@ -282,7 +282,7 @@ export function MainConfigCard({
}} }}
className="w-full" className="w-full"
> >
<div className="relative bg-muted rounded-lg mb-4"> <div className="relative bg-muted rounded-lg">
<TabsList className="flex flex-wrap gap-1 w-full bg-transparent tabs-list"> <TabsList className="flex flex-wrap gap-1 w-full bg-transparent tabs-list">
{shellTools.map((shellTool) => ( {shellTools.map((shellTool) => (
<TabsTrigger <TabsTrigger
+1 -1
View File
@@ -1,6 +1,6 @@
import { downloadBytes } from "@/lib/utils"; import { downloadBytes } from "@/lib/utils";
import { GenerateResult } from "@/types/shell"; import { GenerateResult } from "@/types/shell";
import { Separator } from "@radix-ui/react-dropdown-menu"; import { Separator } from "../ui/separator";
import { ScrollTextIcon } from "lucide-react"; import { ScrollTextIcon } from "lucide-react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
+18 -14
View File
@@ -4,15 +4,17 @@ import {
CommandShellToolConfig, CommandShellToolConfig,
GenerateResult, GenerateResult,
GodzillaShellToolConfig, GodzillaShellToolConfig,
NeoreGeorgShellToolConfig,
ShellToolType,
Suo5ShellToolConfig, Suo5ShellToolConfig,
} from "@/types/shell"; } from "@/types/shell";
import { Separator } from "@radix-ui/react-dropdown-menu";
import { FileTextIcon } from "lucide-react"; import { FileTextIcon } from "lucide-react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Fragment } from "react/jsx-runtime"; import { Fragment } from "react/jsx-runtime";
import { CopyableField } from "../copyable-field"; import { CopyableField } from "../copyable-field";
import { Card, CardContent, CardHeader, CardTitle } from "../ui/card"; import { Card, CardContent, CardHeader, CardTitle } from "../ui/card";
import { FeedbackAlert } from "./feedback-alert"; import { FeedbackAlert } from "./feedback-alert";
import { Separator } from "../ui/separator";
export function BasicInfo({ generateResult }: { generateResult?: GenerateResult }) { export function BasicInfo({ generateResult }: { generateResult?: GenerateResult }) {
const { t } = useTranslation(); const { t } = useTranslation();
@@ -39,15 +41,8 @@ export function BasicInfo({ generateResult }: { generateResult?: GenerateResult
/> />
</div> </div>
<Separator className="my-2" /> <Separator className="my-2" />
{(generateResult?.shellConfig.shellTool === "Behinder" ||
generateResult?.shellConfig.shellTool === "Godzilla" ||
generateResult?.shellConfig.shellTool === "Command" ||
generateResult?.shellConfig.shellTool === "AntSword" ||
generateResult?.shellConfig.shellTool === "Suo5") && (
<div className="grid grid-cols-1 md:grid-cols-2 gap-2"> <div className="grid grid-cols-1 md:grid-cols-2 gap-2">
{/* Tool-specific fields */} {generateResult?.shellConfig.shellTool === ShellToolType.Behinder && (
{generateResult?.shellConfig.shellTool === "Behinder" && (
<> <>
<CopyableField label={t("shellToolConfig.behinderScriptType")} text="jsp" /> <CopyableField label={t("shellToolConfig.behinderScriptType")} text="jsp" />
<CopyableField <CopyableField
@@ -66,7 +61,7 @@ export function BasicInfo({ generateResult }: { generateResult?: GenerateResult
/> />
</> </>
)} )}
{generateResult?.shellConfig.shellTool === "Godzilla" && ( {generateResult?.shellConfig.shellTool === ShellToolType.Godzilla && (
<Fragment> <Fragment>
<CopyableField <CopyableField
label={t("shellToolConfig.pass")} label={t("shellToolConfig.pass")}
@@ -87,7 +82,7 @@ export function BasicInfo({ generateResult }: { generateResult?: GenerateResult
/> />
</Fragment> </Fragment>
)} )}
{generateResult?.shellConfig.shellTool === "Command" && ( {generateResult?.shellConfig.shellTool === ShellToolType.Command && (
<Fragment> <Fragment>
<CopyableField <CopyableField
label={t("shellToolConfig.paramName")} label={t("shellToolConfig.paramName")}
@@ -96,7 +91,7 @@ export function BasicInfo({ generateResult }: { generateResult?: GenerateResult
/> />
</Fragment> </Fragment>
)} )}
{generateResult?.shellConfig.shellTool === "Suo5" && ( {generateResult?.shellConfig.shellTool === ShellToolType.Suo5 && (
<Fragment> <Fragment>
<CopyableField <CopyableField
label={t("shellToolConfig.suo5Header")} label={t("shellToolConfig.suo5Header")}
@@ -105,7 +100,7 @@ export function BasicInfo({ generateResult }: { generateResult?: GenerateResult
/> />
</Fragment> </Fragment>
)} )}
{generateResult?.shellConfig.shellTool === "AntSword" && ( {generateResult?.shellConfig.shellTool === ShellToolType.AntSword && (
<Fragment> <Fragment>
<CopyableField <CopyableField
label={t("shellToolConfig.antSwordPass")} label={t("shellToolConfig.antSwordPass")}
@@ -119,8 +114,17 @@ export function BasicInfo({ generateResult }: { generateResult?: GenerateResult
/> />
</Fragment> </Fragment>
)} )}
</div> {generateResult?.shellConfig.shellTool === ShellToolType.NeoreGeorg && (
<Fragment>
<CopyableField label={t("shellToolConfig.neoreGeorgKey")} text="key" value="key" />
<CopyableField
label={t("shellToolConfig.neoreGeorgHeader")}
text={`${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerValue}`}
value={`${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerValue}`}
/>
</Fragment>
)} )}
</div>
<Separator className="my-2" /> <Separator className="my-2" />
<div className="grid grid-cols-1 md:grid-cols-2 gap-2"> <div className="grid grid-cols-1 md:grid-cols-2 gap-2">
<CopyableField <CopyableField
@@ -6,7 +6,7 @@ import {
AlertDialogDescription, AlertDialogDescription,
AlertDialogTitle, AlertDialogTitle,
AlertDialogTrigger, AlertDialogTrigger,
} from "@radix-ui/react-alert-dialog"; } from "../ui/alert-dialog";
import { CircleHelpIcon } from "lucide-react"; import { CircleHelpIcon } from "lucide-react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { AlertDialogFooter, AlertDialogHeader } from "../ui/alert-dialog"; import { AlertDialogFooter, AlertDialogHeader } from "../ui/alert-dialog";
+1 -1
View File
@@ -1,4 +1,4 @@
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@radix-ui/react-select"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/select";
import { TFunction } from "i18next"; import { TFunction } from "i18next";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Fragment } from "react/jsx-runtime"; import { Fragment } from "react/jsx-runtime";
+1 -1
View File
@@ -1,5 +1,5 @@
import { FormSchema } from "@/types/schema"; import { FormSchema } from "@/types/schema";
import { TabsContent } from "@radix-ui/react-tabs"; import { TabsContent } from "../ui/tabs";
import { FormProvider, UseFormReturn } from "react-hook-form"; import { FormProvider, UseFormReturn } from "react-hook-form";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Card, CardContent } from "../ui/card"; import { Card, CardContent } from "../ui/card";
+1 -1
View File
@@ -1,5 +1,5 @@
import { FormSchema } from "@/types/schema"; import { FormSchema } from "@/types/schema";
import { TabsContent } from "@radix-ui/react-tabs"; import { TabsContent } from "../ui/tabs";
import { FormProvider, UseFormReturn } from "react-hook-form"; import { FormProvider, UseFormReturn } from "react-hook-form";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Card, CardContent } from "../ui/card"; import { Card, CardContent } from "../ui/card";
+1 -1
View File
@@ -1,5 +1,5 @@
import { FormSchema } from "@/types/schema"; import { FormSchema } from "@/types/schema";
import { TabsContent } from "@radix-ui/react-tabs"; import { TabsContent } from "../ui/tabs";
import { FormProvider, UseFormReturn } from "react-hook-form"; import { FormProvider, UseFormReturn } from "react-hook-form";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Card, CardContent } from "../ui/card"; import { Card, CardContent } from "../ui/card";
+1 -1
View File
@@ -1,5 +1,5 @@
import { FormSchema } from "@/types/schema"; import { FormSchema } from "@/types/schema";
import { TabsContent } from "@radix-ui/react-tabs"; import { TabsContent } from "../ui/tabs";
import { FormProvider, UseFormReturn } from "react-hook-form"; import { FormProvider, UseFormReturn } from "react-hook-form";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Card, CardContent } from "../ui/card"; import { Card, CardContent } from "../ui/card";
+1 -1
View File
@@ -1,5 +1,5 @@
import { FormSchema } from "@/types/schema"; import { FormSchema } from "@/types/schema";
import { TabsContent } from "@radix-ui/react-tabs"; import { TabsContent } from "../ui/tabs";
import { FormProvider, UseFormReturn } from "react-hook-form"; import { FormProvider, UseFormReturn } from "react-hook-form";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Card, CardContent } from "../ui/card"; import { Card, CardContent } from "../ui/card";
+1 -1
View File
@@ -1,5 +1,5 @@
import { FormSchema } from "@/types/schema"; import { FormSchema } from "@/types/schema";
import { TabsContent } from "@radix-ui/react-tabs"; import { TabsContent } from "../ui/tabs";
import { FormProvider, UseFormReturn } from "react-hook-form"; import { FormProvider, UseFormReturn } from "react-hook-form";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Card, CardContent } from "../ui/card"; import { Card, CardContent } from "../ui/card";
+2
View File
@@ -103,6 +103,8 @@
"headerValue": "Header Value", "headerValue": "Header Value",
"httpHeader": "HTTP -> HTTP HEADERS", "httpHeader": "HTTP -> HTTP HEADERS",
"key": "Key", "key": "Key",
"neoreGeorgHeader": "Custom Header",
"neoreGeorgKey": "Connection Key",
"paramName": "Param Name", "paramName": "Param Name",
"pass": "Pass", "pass": "Pass",
"suo5Header": "AdvanceConfiguration -> Request Header" "suo5Header": "AdvanceConfiguration -> Request Header"
+2
View File
@@ -103,6 +103,8 @@
"headerValue": "请求头值", "headerValue": "请求头值",
"httpHeader": "请求信息 -> HTTP HEADERS", "httpHeader": "请求信息 -> HTTP HEADERS",
"key": "密钥", "key": "密钥",
"neoreGeorgHeader": "自定义请求头",
"neoreGeorgKey": "连接密钥",
"paramName": "请求参数", "paramName": "请求参数",
"pass": "密码", "pass": "密码",
"suo5Header": "高级配置 -> 请求头" "suo5Header": "高级配置 -> 请求头"
+6
View File
@@ -53,6 +53,12 @@ export interface AntSwordShellToolConfig {
headerValue?: string; headerValue?: string;
} }
export interface NeoreGeorgShellToolConfig {
shellClassName?: string;
headerName?: string;
headerValue?: string;
}
export interface InjectorConfig { export interface InjectorConfig {
injectorClassName?: string; injectorClassName?: string;
classInheritance?: string; classInheritance?: string;