mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-23 07:21:53 +08:00
refactor: rename
1. 将枚举 Server 改为字符串常量,使得 memshell 和 probeshell 都能共用 2. 移除 memshell 模块直接内置在 generator 中 3. 通用类从 memshell 移动至 javaweb 下,命名修改,增加辨识度
This commit is contained in:
@@ -1,41 +1,41 @@
|
||||
import {
|
||||
ArrowUpRightIcon,
|
||||
AxeIcon,
|
||||
CommandIcon,
|
||||
NetworkIcon,
|
||||
ServerIcon,
|
||||
ShieldOffIcon,
|
||||
SwordIcon,
|
||||
WaypointsIcon,
|
||||
ZapIcon,
|
||||
ArrowUpRightIcon,
|
||||
AxeIcon,
|
||||
CommandIcon,
|
||||
NetworkIcon,
|
||||
ServerIcon,
|
||||
ShieldOffIcon,
|
||||
SwordIcon,
|
||||
WaypointsIcon,
|
||||
ZapIcon,
|
||||
} from "lucide-react";
|
||||
import { type JSX, useCallback, useEffect, useId, useState } from "react";
|
||||
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { AntSwordTabContent } from "@/components/memshell/tabs/antsword-tab";
|
||||
import { BehinderTabContent } from "@/components/memshell/tabs/behinder-tab";
|
||||
import { CommandTabContent } from "@/components/memshell/tabs/command-tab";
|
||||
import {type JSX, useCallback, useEffect, useId, useState} from "react";
|
||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {AntSwordTabContent} from "@/components/memshell/tabs/antsword-tab";
|
||||
import {BehinderTabContent} from "@/components/memshell/tabs/behinder-tab";
|
||||
import {CommandTabContent} from "@/components/memshell/tabs/command-tab";
|
||||
import CustomTabContent from "@/components/memshell/tabs/custom-tab";
|
||||
import { GodzillaTabContent } from "@/components/memshell/tabs/godzilla-tab";
|
||||
import { NeoRegTabContent } from "@/components/memshell/tabs/neoreg-tab";
|
||||
import { Suo5TabContent } from "@/components/memshell/tabs/suo5-tab";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card.tsx";
|
||||
import {GodzillaTabContent} from "@/components/memshell/tabs/godzilla-tab";
|
||||
import {NeoRegTabContent} from "@/components/memshell/tabs/neoreg-tab";
|
||||
import {Suo5TabContent} from "@/components/memshell/tabs/suo5-tab";
|
||||
import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card.tsx";
|
||||
import {
|
||||
FormControl,
|
||||
FormDescription,
|
||||
FormField,
|
||||
FormFieldItem,
|
||||
FormFieldLabel,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
FormControl,
|
||||
FormDescription,
|
||||
FormField,
|
||||
FormFieldItem,
|
||||
FormFieldLabel,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from "@/components/ui/form.tsx";
|
||||
import { Label } from "@/components/ui/label.tsx";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select.tsx";
|
||||
import { Switch } from "@/components/ui/switch.tsx";
|
||||
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import type { ShellFormSchema } from "@/types/schema.ts";
|
||||
import { type MainConfig, type ServerConfig, ShellToolType } from "@/types/shell.ts";
|
||||
import {Label} from "@/components/ui/label.tsx";
|
||||
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select.tsx";
|
||||
import {Switch} from "@/components/ui/switch.tsx";
|
||||
import {Tabs, TabsList, TabsTrigger} from "@/components/ui/tabs";
|
||||
import {type MainConfig, type ServerConfig, ShellToolType} from "@/types/memshell";
|
||||
import type {MemShellFormSchema} from "@/types/schema.ts";
|
||||
|
||||
const shellToolIcons: Record<ShellToolType, JSX.Element> = {
|
||||
[ShellToolType.Behinder]: <ShieldOffIcon className="h-4 w-4" />,
|
||||
@@ -60,7 +60,7 @@ export default function MainConfigCard({
|
||||
servers,
|
||||
}: Readonly<{
|
||||
mainConfig: MainConfig | undefined;
|
||||
form: UseFormReturn<ShellFormSchema>;
|
||||
form: UseFormReturn<MemShellFormSchema>;
|
||||
servers?: ServerConfig;
|
||||
}>) {
|
||||
const [shellToolMap, setShellToolMap] = useState<{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { PackageIcon } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card.tsx";
|
||||
import { FormControl, FormField, FormItem, FormLabel } from "@/components/ui/form.tsx";
|
||||
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group.tsx";
|
||||
import type { ShellFormSchema } from "@/types/schema.ts";
|
||||
import type { PackerConfig } from "@/types/shell.ts";
|
||||
import {PackageIcon} from "lucide-react";
|
||||
import {useEffect, useState} from "react";
|
||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card.tsx";
|
||||
import {FormControl, FormField, FormItem, FormLabel} from "@/components/ui/form.tsx";
|
||||
import {RadioGroup, RadioGroupItem} from "@/components/ui/radio-group.tsx";
|
||||
import type {PackerConfig} from "@/types/memshell";
|
||||
import type {MemShellFormSchema} from "@/types/schema.ts";
|
||||
|
||||
type Option = {
|
||||
name: string;
|
||||
@@ -18,7 +18,7 @@ export default function PackageConfigCard({
|
||||
form,
|
||||
}: Readonly<{
|
||||
packerConfig: PackerConfig | undefined;
|
||||
form: UseFormReturn<ShellFormSchema>;
|
||||
form: UseFormReturn<MemShellFormSchema>;
|
||||
}>) {
|
||||
const [options, setOptions] = useState<Array<Option>>([]);
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { ScrollTextIcon } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { downloadBytes, formatBytes } from "@/lib/utils";
|
||||
import type { GenerateResult } from "@/types/shell";
|
||||
import {ScrollTextIcon} from "lucide-react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card";
|
||||
import {Separator} from "@/components/ui/separator";
|
||||
import {downloadBytes, formatBytes} from "@/lib/utils";
|
||||
import type {MemShellResult} from "@/types/memshell";
|
||||
|
||||
export function AgentResult({
|
||||
packMethod,
|
||||
packResult,
|
||||
generateResult,
|
||||
}: Readonly<{ packMethod: string; packResult: string; generateResult?: GenerateResult }>) {
|
||||
}: Readonly<{ packMethod: string; packResult: string; generateResult?: MemShellResult }>) {
|
||||
const { t } = useTranslation();
|
||||
const isPureAgent = packMethod === "AgentJar";
|
||||
return (
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import { FileTextIcon } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { shouldHidden } from "@/lib/utils";
|
||||
import {FileTextIcon} from "lucide-react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card";
|
||||
import {Separator} from "@/components/ui/separator";
|
||||
import {shouldHidden} from "@/lib/utils";
|
||||
import {
|
||||
type AntSwordShellToolConfig,
|
||||
type BehinderShellToolConfig,
|
||||
type CommandShellToolConfig,
|
||||
type GenerateResult,
|
||||
type GodzillaShellToolConfig,
|
||||
type NeoreGeorgShellToolConfig,
|
||||
ShellToolType,
|
||||
type Suo5ShellToolConfig,
|
||||
} from "@/types/shell";
|
||||
import { CopyableField } from "../../copyable-field";
|
||||
import { FeedbackAlert } from "./feedback-alert";
|
||||
type AntSwordShellToolConfig,
|
||||
type BehinderShellToolConfig,
|
||||
type CommandShellToolConfig,
|
||||
type GodzillaShellToolConfig,
|
||||
type MemShellResult,
|
||||
type NeoreGeorgShellToolConfig,
|
||||
ShellToolType,
|
||||
type Suo5ShellToolConfig,
|
||||
} from "@/types/memshell";
|
||||
import {CopyableField} from "../../copyable-field";
|
||||
import {FeedbackAlert} from "./feedback-alert";
|
||||
|
||||
export function BasicInfo({ generateResult }: Readonly<{ generateResult?: GenerateResult }>) {
|
||||
export function BasicInfo({ generateResult }: Readonly<{ generateResult?: MemShellResult }>) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Card>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { downloadBytes } from "@/lib/utils";
|
||||
import type { GenerateResult } from "@/types/shell";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {downloadBytes} from "@/lib/utils";
|
||||
import type {MemShellResult} from "@/types/memshell";
|
||||
|
||||
export function JarResult({
|
||||
packResult,
|
||||
generateResult,
|
||||
}: Readonly<{ packResult: string; generateResult?: GenerateResult }>) {
|
||||
}: Readonly<{ packResult: string; generateResult?: MemShellResult }>) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex items-center justify-center">
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import CodeViewer from "@/components/code-viewer";
|
||||
import type { GenerateResult } from "@/types/shell";
|
||||
import { AgentResult } from "./agent";
|
||||
import { JarResult } from "./jar-result";
|
||||
import { MultiPackResult } from "./multi-packer";
|
||||
import type {MemShellResult} from "@/types/memshell";
|
||||
import {AgentResult} from "./agent";
|
||||
import {JarResult} from "./jar-result";
|
||||
import {MultiPackResult} from "./multi-packer";
|
||||
|
||||
export function ResultComponent({
|
||||
packResult,
|
||||
@@ -14,7 +14,7 @@ export function ResultComponent({
|
||||
packResult: string | undefined;
|
||||
allPackResults: Map<string, string> | undefined;
|
||||
packMethod: string;
|
||||
generateResult?: GenerateResult;
|
||||
generateResult?: MemShellResult;
|
||||
}>) {
|
||||
const showCode = packMethod === "JSP";
|
||||
const isAgent = packMethod.startsWith("Agent");
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { DownloadIcon } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
import {DownloadIcon} from "lucide-react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {toast} from "sonner";
|
||||
|
||||
import { QuickUsage } from "@/components/memshell/quick-usage";
|
||||
import { Button } from "@/components/ui/button.tsx";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs.tsx";
|
||||
import { downloadBytes } from "@/lib/utils.ts";
|
||||
import type { GenerateResult } from "@/types/shell.ts";
|
||||
import {QuickUsage} from "@/components/memshell/quick-usage";
|
||||
import {Button} from "@/components/ui/button.tsx";
|
||||
import {Tabs, TabsContent, TabsList, TabsTrigger} from "@/components/ui/tabs.tsx";
|
||||
import {downloadBytes} from "@/lib/utils.ts";
|
||||
import type {MemShellResult} from "@/types/memshell";
|
||||
import CodeViewer from "../code-viewer";
|
||||
import { BasicInfo } from "./results/basic-info";
|
||||
import { ResultComponent } from "./results/result-component";
|
||||
import {BasicInfo} from "./results/basic-info";
|
||||
import {ResultComponent} from "./results/result-component";
|
||||
|
||||
export default function ShellResult({
|
||||
packResult,
|
||||
@@ -20,7 +20,7 @@ export default function ShellResult({
|
||||
packResult: string | undefined;
|
||||
allPackResults: Map<string, string> | undefined;
|
||||
packMethod: string;
|
||||
generateResult?: GenerateResult;
|
||||
generateResult?: MemShellResult;
|
||||
}>) {
|
||||
const { t } = useTranslation();
|
||||
if (!generateResult) {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { FormControl, FormField, FormFieldItem, FormFieldLabel } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { TabsContent } from "@/components/ui/tabs";
|
||||
import type { ShellFormSchema } from "@/types/schema";
|
||||
import { OptionalClassFormField } from "./classname-field";
|
||||
import { ShellTypeFormField } from "./shelltype-field";
|
||||
import { UrlPatternFormField } from "./urlpattern-field";
|
||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Card, CardContent} from "@/components/ui/card";
|
||||
import {FormControl, FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {TabsContent} from "@/components/ui/tabs";
|
||||
import type {MemShellFormSchema} from "@/types/schema";
|
||||
import {OptionalClassFormField} from "./classname-field";
|
||||
import {ShellTypeFormField} from "./shelltype-field";
|
||||
import {UrlPatternFormField} from "./urlpattern-field";
|
||||
|
||||
export function AntSwordTabContent({
|
||||
form,
|
||||
shellTypes,
|
||||
}: Readonly<{ form: UseFormReturn<ShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
}: Readonly<{ form: UseFormReturn<MemShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { FormField, FormFieldItem, FormFieldLabel } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { TabsContent } from "@/components/ui/tabs";
|
||||
import type { ShellFormSchema } from "@/types/schema";
|
||||
import { OptionalClassFormField } from "./classname-field";
|
||||
import { ShellTypeFormField } from "./shelltype-field";
|
||||
import { UrlPatternFormField } from "./urlpattern-field";
|
||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Card, CardContent} from "@/components/ui/card";
|
||||
import {FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {TabsContent} from "@/components/ui/tabs";
|
||||
import type {MemShellFormSchema} from "@/types/schema";
|
||||
import {OptionalClassFormField} from "./classname-field";
|
||||
import {ShellTypeFormField} from "./shelltype-field";
|
||||
import {UrlPatternFormField} from "./urlpattern-field";
|
||||
|
||||
export function BehinderTabContent({
|
||||
form,
|
||||
shellTypes,
|
||||
}: Readonly<{ form: UseFormReturn<ShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
}: Readonly<{ form: UseFormReturn<MemShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { ChevronDown, ChevronUp, Settings } from "lucide-react";
|
||||
import { Fragment, useId, useState } from "react";
|
||||
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { FormField, FormFieldItem, FormFieldLabel } from "@/components/ui/form.tsx";
|
||||
import { Input } from "@/components/ui/input.tsx";
|
||||
import type { ShellFormSchema } from "@/types/schema.ts";
|
||||
import {ChevronDown, ChevronUp, Settings} from "lucide-react";
|
||||
import {Fragment, useId, useState} from "react";
|
||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form.tsx";
|
||||
import {Input} from "@/components/ui/input.tsx";
|
||||
import type {MemShellFormSchema} from "@/types/schema.ts";
|
||||
|
||||
export function OptionalClassFormField({ form }: Readonly<{ form: UseFormReturn<ShellFormSchema> }>) {
|
||||
export function OptionalClassFormField({ form }: Readonly<{ form: UseFormReturn<MemShellFormSchema> }>) {
|
||||
const { t } = useTranslation();
|
||||
const [showAdvanced, setShowAdvanced] = useState(false);
|
||||
const shellClassNameId = useId();
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { FormControl, FormField, FormFieldItem, FormFieldLabel } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { TabsContent } from "@/components/ui/tabs";
|
||||
import { env } from "@/config";
|
||||
import type { ShellFormSchema } from "@/types/schema";
|
||||
import { OptionalClassFormField } from "./classname-field";
|
||||
import { ShellTypeFormField } from "./shelltype-field";
|
||||
import { UrlPatternFormField } from "./urlpattern-field";
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Card, CardContent} from "@/components/ui/card";
|
||||
import {FormControl, FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select";
|
||||
import {TabsContent} from "@/components/ui/tabs";
|
||||
import {env} from "@/config";
|
||||
import type {MemShellFormSchema} from "@/types/schema";
|
||||
import {OptionalClassFormField} from "./classname-field";
|
||||
import {ShellTypeFormField} from "./shelltype-field";
|
||||
import {UrlPatternFormField} from "./urlpattern-field";
|
||||
|
||||
export function CommandTabContent({
|
||||
form,
|
||||
shellTypes,
|
||||
}: Readonly<{ form: UseFormReturn<ShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
}: Readonly<{ form: UseFormReturn<MemShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
const { t } = useTranslation();
|
||||
const { data } = useQuery<{ encryptors: Array<string>; implementationClasses: Array<string> }>({
|
||||
queryKey: ["commandConfigs"],
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import { t } from "i18next";
|
||||
import { useId, useState } from "react";
|
||||
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { FormControl, FormField, FormFieldItem, FormFieldLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
||||
import { TabsContent } from "@/components/ui/tabs";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import type { ShellFormSchema } from "@/types/schema";
|
||||
import { OptionalClassFormField } from "./classname-field";
|
||||
import { ShellTypeFormField } from "./shelltype-field";
|
||||
import { UrlPatternFormField } from "./urlpattern-field";
|
||||
import {t} from "i18next";
|
||||
import {useId, useState} from "react";
|
||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
||||
import {Card, CardContent} from "@/components/ui/card";
|
||||
import {FormControl, FormField, FormFieldItem, FormFieldLabel, FormMessage} from "@/components/ui/form";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {Label} from "@/components/ui/label";
|
||||
import {RadioGroup, RadioGroupItem} from "@/components/ui/radio-group";
|
||||
import {TabsContent} from "@/components/ui/tabs";
|
||||
import {Textarea} from "@/components/ui/textarea";
|
||||
import type {MemShellFormSchema} from "@/types/schema";
|
||||
import {OptionalClassFormField} from "./classname-field";
|
||||
import {ShellTypeFormField} from "./shelltype-field";
|
||||
import {UrlPatternFormField} from "./urlpattern-field";
|
||||
|
||||
export default function CustomTabContent({
|
||||
form,
|
||||
shellTypes,
|
||||
}: Readonly<{ form: UseFormReturn<ShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
}: Readonly<{ form: UseFormReturn<MemShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
const [isFile, setIsFile] = useState(false);
|
||||
const optionOneId = useId();
|
||||
const optionTwoId = useId();
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { FormField, FormFieldItem, FormFieldLabel } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { TabsContent } from "@/components/ui/tabs";
|
||||
import type { ShellFormSchema } from "@/types/schema";
|
||||
import { OptionalClassFormField } from "./classname-field";
|
||||
import { ShellTypeFormField } from "./shelltype-field";
|
||||
import { UrlPatternFormField } from "./urlpattern-field";
|
||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Card, CardContent} from "@/components/ui/card";
|
||||
import {FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {TabsContent} from "@/components/ui/tabs";
|
||||
import type {MemShellFormSchema} from "@/types/schema";
|
||||
import {OptionalClassFormField} from "./classname-field";
|
||||
import {ShellTypeFormField} from "./shelltype-field";
|
||||
import {UrlPatternFormField} from "./urlpattern-field";
|
||||
|
||||
export function GodzillaTabContent({
|
||||
form,
|
||||
shellTypes,
|
||||
}: Readonly<{ form: UseFormReturn<ShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
}: Readonly<{ form: UseFormReturn<MemShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { FormField, FormFieldItem, FormFieldLabel } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { TabsContent } from "@/components/ui/tabs";
|
||||
import type { ShellFormSchema } from "@/types/schema";
|
||||
import { OptionalClassFormField } from "./classname-field";
|
||||
import { ShellTypeFormField } from "./shelltype-field";
|
||||
import { UrlPatternFormField } from "./urlpattern-field";
|
||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Card, CardContent} from "@/components/ui/card";
|
||||
import {FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {TabsContent} from "@/components/ui/tabs";
|
||||
import type {MemShellFormSchema} from "@/types/schema";
|
||||
import {OptionalClassFormField} from "./classname-field";
|
||||
import {ShellTypeFormField} from "./shelltype-field";
|
||||
import {UrlPatternFormField} from "./urlpattern-field";
|
||||
|
||||
export function NeoRegTabContent({
|
||||
form,
|
||||
shellTypes,
|
||||
}: Readonly<{ form: UseFormReturn<ShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
}: Readonly<{ form: UseFormReturn<MemShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FormControl, FormField, FormFieldItem, FormFieldLabel } from "@/components/ui/form.tsx";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select.tsx";
|
||||
import type { ShellFormSchema } from "@/types/schema.ts";
|
||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {FormControl, FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form.tsx";
|
||||
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select.tsx";
|
||||
import type {MemShellFormSchema} from "@/types/schema.ts";
|
||||
|
||||
export function ShellTypeFormField({
|
||||
form,
|
||||
shellTypes,
|
||||
}: Readonly<{ form: UseFormReturn<ShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
}: Readonly<{ form: UseFormReturn<MemShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { FormField, FormFieldItem, FormFieldLabel } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { TabsContent } from "@/components/ui/tabs";
|
||||
import type { ShellFormSchema } from "@/types/schema";
|
||||
import { OptionalClassFormField } from "./classname-field";
|
||||
import { ShellTypeFormField } from "./shelltype-field";
|
||||
import { UrlPatternFormField } from "./urlpattern-field";
|
||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Card, CardContent} from "@/components/ui/card";
|
||||
import {FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {TabsContent} from "@/components/ui/tabs";
|
||||
import type {MemShellFormSchema} from "@/types/schema";
|
||||
import {OptionalClassFormField} from "./classname-field";
|
||||
import {ShellTypeFormField} from "./shelltype-field";
|
||||
import {UrlPatternFormField} from "./urlpattern-field";
|
||||
|
||||
export function Suo5TabContent({
|
||||
form,
|
||||
shellTypes,
|
||||
}: Readonly<{ form: UseFormReturn<ShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
}: Readonly<{ form: UseFormReturn<MemShellFormSchema>; shellTypes: Array<string> }>) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FormField, FormFieldItem, FormFieldLabel, FormMessage } from "@/components/ui/form.tsx";
|
||||
import { Input } from "@/components/ui/input.tsx";
|
||||
import { shouldHidden } from "@/lib/utils";
|
||||
import type { ShellFormSchema } from "@/types/schema.ts";
|
||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {FormField, FormFieldItem, FormFieldLabel, FormMessage} from "@/components/ui/form.tsx";
|
||||
import {Input} from "@/components/ui/input.tsx";
|
||||
import {shouldHidden} from "@/lib/utils";
|
||||
import type {MemShellFormSchema} from "@/types/schema.ts";
|
||||
|
||||
export function UrlPatternFormField({ form }: Readonly<{ form: UseFormReturn<ShellFormSchema> }>) {
|
||||
export function UrlPatternFormField({ form }: Readonly<{ form: UseFormReturn<MemShellFormSchema> }>) {
|
||||
const { t } = useTranslation();
|
||||
const shellType = form.watch("shellType");
|
||||
return (
|
||||
|
||||
+3
-3
@@ -3,9 +3,9 @@ import { useTranslation } from "react-i18next";
|
||||
import { CopyableField } from "@/components/copyable-field";
|
||||
import { FeedbackAlert } from "@/components/memshell/results/feedback-alert";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import type { ProbeGenerateResult } from "@/types/probe";
|
||||
import type { ProbeShellResult } from "@/types/probeshell";
|
||||
|
||||
export function BasicInfo({ generateResult }: Readonly<{ generateResult?: ProbeGenerateResult }>) {
|
||||
export function BasicInfo({ generateResult }: Readonly<{ generateResult?: ProbeShellResult }>) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Card>
|
||||
@@ -19,7 +19,7 @@ export function BasicInfo({ generateResult }: Readonly<{ generateResult?: ProbeG
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||
<div className="grid grid-cols-1 gap-2">
|
||||
<CopyableField
|
||||
label={t("mainConfig.shellClassName")}
|
||||
value={generateResult?.shellClassName}
|
||||
+3
-3
@@ -16,8 +16,8 @@ import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import type { ProbeFormSchema } from "@/types/schema";
|
||||
import type { ServerConfig } from "@/types/shell";
|
||||
import type { ServerConfig } from "@/types/memshell";
|
||||
import type { ProbeShellFormSchema } from "@/types/schema";
|
||||
import { Separator } from "../ui/separator";
|
||||
|
||||
// 常量提取到组件外部
|
||||
@@ -59,7 +59,7 @@ const DEFAULT_FORM_VALUES = {
|
||||
} as const;
|
||||
|
||||
interface MainConfigCardProps {
|
||||
readonly form: UseFormReturn<ProbeFormSchema>;
|
||||
readonly form: UseFormReturn<ProbeShellFormSchema>;
|
||||
readonly servers?: ServerConfig;
|
||||
}
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@ import { useTranslation } from "react-i18next";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card.tsx";
|
||||
import { FormControl, FormField, FormItem, FormLabel } from "@/components/ui/form.tsx";
|
||||
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group.tsx";
|
||||
import type { ProbeFormSchema } from "@/types/schema";
|
||||
import type { PackerConfig } from "@/types/shell.ts";
|
||||
import type { PackerConfig } from "@/types/memshell";
|
||||
import type { ProbeShellFormSchema } from "@/types/schema";
|
||||
|
||||
type Option = {
|
||||
name: string;
|
||||
@@ -18,7 +18,7 @@ export default function PackageConfigCard({
|
||||
form,
|
||||
}: Readonly<{
|
||||
packerConfig: PackerConfig | undefined;
|
||||
form: UseFormReturn<ProbeFormSchema>;
|
||||
form: UseFormReturn<ProbeShellFormSchema>;
|
||||
}>) {
|
||||
const [options, setOptions] = useState<Array<Option>>([]);
|
||||
const { t } = useTranslation();
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { QuickUsage } from "@/components/probe/quick-usage";
|
||||
import { QuickUsage } from "@/components/probeshell/quick-usage";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs.tsx";
|
||||
import type { ProbeGenerateResult } from "@/types/probe";
|
||||
import type { ProbeShellResult } from "@/types/probeshell";
|
||||
import CodeViewer from "../code-viewer";
|
||||
import { MultiPackResult } from "../memshell/results/multi-packer";
|
||||
import { BasicInfo } from "./basic-info";
|
||||
@@ -15,7 +15,7 @@ export default function ShellResult({
|
||||
packResult: string | undefined;
|
||||
allPackResults: Map<string, string> | undefined;
|
||||
packMethod: string;
|
||||
generateResult?: ProbeGenerateResult;
|
||||
generateResult?: ProbeShellResult;
|
||||
}>) {
|
||||
const { t } = useTranslation();
|
||||
if (!generateResult) {
|
||||
Reference in New Issue
Block a user