mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-24 07:51:52 +08:00
style(web): format code
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@
|
|||||||
"formatter": {
|
"formatter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"indentStyle": "space",
|
"indentStyle": "space",
|
||||||
"includes": ["!**/test/snapshots/**/*"]
|
"indentWidth": 2
|
||||||
},
|
},
|
||||||
"linter": {
|
"linter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|||||||
Binary file not shown.
+11
-2
@@ -1,4 +1,11 @@
|
|||||||
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
import {
|
||||||
|
existsSync,
|
||||||
|
mkdirSync,
|
||||||
|
readdirSync,
|
||||||
|
readFileSync,
|
||||||
|
rmSync,
|
||||||
|
writeFileSync,
|
||||||
|
} from "node:fs";
|
||||||
import { cp } from "node:fs/promises";
|
import { cp } from "node:fs/promises";
|
||||||
import { join, resolve } from "node:path";
|
import { join, resolve } from "node:path";
|
||||||
|
|
||||||
@@ -44,7 +51,9 @@ async function main() {
|
|||||||
const INDEX_DEST = join(TEMPLATES_DIR, "index.html");
|
const INDEX_DEST = join(TEMPLATES_DIR, "index.html");
|
||||||
|
|
||||||
if (!existsSync(INDEX_SRC)) {
|
if (!existsSync(INDEX_SRC)) {
|
||||||
console.error(`Error: ${INDEX_SRC} does not exist. Make sure you built the frontend project first.`);
|
console.error(
|
||||||
|
`Error: ${INDEX_SRC} does not exist. Make sure you built the frontend project first.`,
|
||||||
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
import type {VariantProps} from "class-variance-authority";
|
import type { VariantProps } from "class-variance-authority";
|
||||||
import {Check, Copy} from "lucide-react";
|
import { Check, Copy } from "lucide-react";
|
||||||
import {type HTMLProps, type ReactNode, useCallback, useEffect, useState} from "react";
|
import {
|
||||||
import {CopyToClipboard} from "react-copy-to-clipboard";
|
type HTMLProps,
|
||||||
import {useTranslation} from "react-i18next";
|
type ReactNode,
|
||||||
import {PrismLight as SyntaxHighlighter} from "react-syntax-highlighter";
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useState,
|
||||||
|
} from "react";
|
||||||
|
import { CopyToClipboard } from "react-copy-to-clipboard";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { PrismLight as SyntaxHighlighter } from "react-syntax-highlighter";
|
||||||
import java from "react-syntax-highlighter/dist/esm/languages/prism/java";
|
import java from "react-syntax-highlighter/dist/esm/languages/prism/java";
|
||||||
import {materialDark} from "react-syntax-highlighter/dist/esm/styles/prism";
|
import { materialDark } from "react-syntax-highlighter/dist/esm/styles/prism";
|
||||||
import {toast} from "sonner";
|
import { toast } from "sonner";
|
||||||
import {Button, type buttonVariants} from "@/components/ui/button";
|
import { Button, type buttonVariants } from "@/components/ui/button";
|
||||||
import {cn} from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
SyntaxHighlighter.registerLanguage("java", java);
|
SyntaxHighlighter.registerLanguage("java", java);
|
||||||
interface CopyButtonProps extends React.ComponentProps<"button"> {
|
interface CopyButtonProps extends React.ComponentProps<"button"> {
|
||||||
@@ -16,7 +22,9 @@ interface CopyButtonProps extends React.ComponentProps<"button"> {
|
|||||||
src?: string;
|
src?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CopyButton({ value }: Readonly<CopyButtonProps & VariantProps<typeof buttonVariants>>) {
|
export function CopyButton({
|
||||||
|
value,
|
||||||
|
}: Readonly<CopyButtonProps & VariantProps<typeof buttonVariants>>) {
|
||||||
const [hasCopied, setHasCopied] = useState(false);
|
const [hasCopied, setHasCopied] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -60,12 +68,18 @@ export default function CodeViewer({
|
|||||||
showLineNumbers = true,
|
showLineNumbers = true,
|
||||||
wrapLongLines = true,
|
wrapLongLines = true,
|
||||||
}: Readonly<CodeViewerProps>) {
|
}: Readonly<CodeViewerProps>) {
|
||||||
const lineProps: lineTagPropsFunction | HTMLProps<HTMLElement> | undefined = wrapLongLines
|
const lineProps: lineTagPropsFunction | HTMLProps<HTMLElement> | undefined =
|
||||||
? { style: { overflowWrap: "break-word", whiteSpace: "pre-wrap" } }
|
wrapLongLines
|
||||||
: undefined;
|
? { style: { overflowWrap: "break-word", whiteSpace: "pre-wrap" } }
|
||||||
|
: undefined;
|
||||||
return (
|
return (
|
||||||
<div className="rounded-lg border">
|
<div className="rounded-lg border">
|
||||||
<div className={cn("flex items-center border-b p-2 justify-end", header && "justify-between")}>
|
<div
|
||||||
|
className={cn(
|
||||||
|
"flex items-center border-b p-2 justify-end",
|
||||||
|
header && "justify-between",
|
||||||
|
)}
|
||||||
|
>
|
||||||
{header}
|
{header}
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{button}
|
{button}
|
||||||
|
|||||||
@@ -12,7 +12,11 @@ interface CopyableFieldProps {
|
|||||||
text?: string;
|
text?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CopyableField({ label, value, text }: Readonly<CopyableFieldProps>) {
|
export function CopyableField({
|
||||||
|
label,
|
||||||
|
value,
|
||||||
|
text,
|
||||||
|
}: Readonly<CopyableFieldProps>) {
|
||||||
const [hasCopied, setHasCopied] = useState(false);
|
const [hasCopied, setHasCopied] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -40,8 +44,18 @@ export function CopyableField({ label, value, text }: Readonly<CopyableFieldProp
|
|||||||
<Label className="text-sm text-muted-foreground">{label}:</Label>
|
<Label className="text-sm text-muted-foreground">{label}:</Label>
|
||||||
{value && (
|
{value && (
|
||||||
<CopyToClipboard text={value} onCopy={handleCopy}>
|
<CopyToClipboard text={value} onCopy={handleCopy}>
|
||||||
<Button variant="ghost" size="icon" type="button" className="h-8 w-8" disabled={hasCopied}>
|
<Button
|
||||||
{hasCopied ? <Check className="h-4 w-4" /> : <Copy className="h-4 w-4" />}
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
type="button"
|
||||||
|
className="h-8 w-8"
|
||||||
|
disabled={hasCopied}
|
||||||
|
>
|
||||||
|
{hasCopied ? (
|
||||||
|
<Check className="h-4 w-4" />
|
||||||
|
) : (
|
||||||
|
<Copy className="h-4 w-4" />
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</CopyToClipboard>
|
</CopyToClipboard>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import {type MotionProps, motion } from "motion/react";
|
import { type MotionProps, motion } from "motion/react";
|
||||||
import {cn} from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
interface LineShadowTextProps extends Omit<React.HTMLAttributes<HTMLElement>, keyof MotionProps>, MotionProps {
|
interface LineShadowTextProps
|
||||||
|
extends Omit<React.HTMLAttributes<HTMLElement>, keyof MotionProps>,
|
||||||
|
MotionProps {
|
||||||
shadowColor?: string;
|
shadowColor?: string;
|
||||||
as?: React.ElementType;
|
as?: React.ElementType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {Slot} from "@radix-ui/react-slot";
|
import { Slot } from "@radix-ui/react-slot";
|
||||||
import {cva, type VariantProps} from "class-variance-authority";
|
import { cva, type VariantProps } from "class-variance-authority";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {cn} from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
const rainbowButtonVariants = cva(
|
const rainbowButtonVariants = cva(
|
||||||
cn(
|
cn(
|
||||||
|
|||||||
@@ -1,41 +1,56 @@
|
|||||||
import {
|
import {
|
||||||
ArrowUpRightIcon,
|
ArrowUpRightIcon,
|
||||||
AxeIcon,
|
AxeIcon,
|
||||||
CommandIcon,
|
CommandIcon,
|
||||||
NetworkIcon,
|
NetworkIcon,
|
||||||
ServerIcon,
|
ServerIcon,
|
||||||
ShieldOffIcon,
|
ShieldOffIcon,
|
||||||
SwordIcon,
|
SwordIcon,
|
||||||
WaypointsIcon,
|
WaypointsIcon,
|
||||||
ZapIcon,
|
ZapIcon,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import {type JSX, useCallback, useEffect, useId, useState} from "react";
|
import { type JSX, useCallback, useEffect, useState } from "react";
|
||||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {AntSwordTabContent} from "@/components/memshell/tabs/antsword-tab";
|
import { AntSwordTabContent } from "@/components/memshell/tabs/antsword-tab";
|
||||||
import {BehinderTabContent} from "@/components/memshell/tabs/behinder-tab";
|
import { BehinderTabContent } from "@/components/memshell/tabs/behinder-tab";
|
||||||
import {CommandTabContent} from "@/components/memshell/tabs/command-tab";
|
import { CommandTabContent } from "@/components/memshell/tabs/command-tab";
|
||||||
import CustomTabContent from "@/components/memshell/tabs/custom-tab";
|
import CustomTabContent from "@/components/memshell/tabs/custom-tab";
|
||||||
import {GodzillaTabContent} from "@/components/memshell/tabs/godzilla-tab";
|
import { GodzillaTabContent } from "@/components/memshell/tabs/godzilla-tab";
|
||||||
import {NeoRegTabContent} from "@/components/memshell/tabs/neoreg-tab";
|
import { NeoRegTabContent } from "@/components/memshell/tabs/neoreg-tab";
|
||||||
import {Suo5TabContent} from "@/components/memshell/tabs/suo5-tab";
|
import { Suo5TabContent } from "@/components/memshell/tabs/suo5-tab";
|
||||||
import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card.tsx";
|
|
||||||
import {
|
import {
|
||||||
FormControl,
|
Card,
|
||||||
FormDescription,
|
CardContent,
|
||||||
FormField,
|
CardHeader,
|
||||||
FormFieldItem,
|
CardTitle,
|
||||||
FormFieldLabel,
|
} from "@/components/ui/card.tsx";
|
||||||
FormItem,
|
import {
|
||||||
FormLabel,
|
FormControl,
|
||||||
FormMessage,
|
FormDescription,
|
||||||
|
FormField,
|
||||||
|
FormFieldItem,
|
||||||
|
FormFieldLabel,
|
||||||
|
FormItem,
|
||||||
|
FormLabel,
|
||||||
|
FormMessage,
|
||||||
} from "@/components/ui/form.tsx";
|
} from "@/components/ui/form.tsx";
|
||||||
import {Label} from "@/components/ui/label.tsx";
|
import { Label } from "@/components/ui/label.tsx";
|
||||||
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select.tsx";
|
import {
|
||||||
import {Switch} from "@/components/ui/switch.tsx";
|
Select,
|
||||||
import {Tabs, TabsList, TabsTrigger} from "@/components/ui/tabs";
|
SelectContent,
|
||||||
import {type MainConfig, type ServerConfig, ShellToolType} from "@/types/memshell";
|
SelectItem,
|
||||||
import type {MemShellFormSchema} from "@/types/schema.ts";
|
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> = {
|
const shellToolIcons: Record<ShellToolType, JSX.Element> = {
|
||||||
[ShellToolType.Behinder]: <ShieldOffIcon className="h-4 w-4" />,
|
[ShellToolType.Behinder]: <ShieldOffIcon className="h-4 w-4" />,
|
||||||
@@ -79,7 +94,9 @@ export default function MainConfigCard({
|
|||||||
const shellTool = form.watch("shellTool");
|
const shellTool = form.watch("shellTool");
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [serverVersionOptions, setServerVersionOptions] = useState(defaultServerVersionOptions);
|
const [serverVersionOptions, setServerVersionOptions] = useState(
|
||||||
|
defaultServerVersionOptions,
|
||||||
|
);
|
||||||
|
|
||||||
// 处理一下 shellTypes 由于 server 或 shellTool 变更时无法正常为 form.shellType 赋值的问题
|
// 处理一下 shellTypes 由于 server 或 shellTool 变更时无法正常为 form.shellType 赋值的问题
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -95,7 +112,10 @@ export default function MainConfigCard({
|
|||||||
setShellToolMap(newShellToolMap);
|
setShellToolMap(newShellToolMap);
|
||||||
|
|
||||||
const newShellTools = Object.keys(newShellToolMap);
|
const newShellTools = Object.keys(newShellToolMap);
|
||||||
setShellTools([...newShellTools.map((tool) => tool as ShellToolType), ShellToolType.Custom]);
|
setShellTools([
|
||||||
|
...newShellTools.map((tool) => tool as ShellToolType),
|
||||||
|
ShellToolType.Custom,
|
||||||
|
]);
|
||||||
|
|
||||||
const currentShellTool = form.getValues("shellTool");
|
const currentShellTool = form.getValues("shellTool");
|
||||||
|
|
||||||
@@ -233,10 +253,6 @@ export default function MainConfigCard({
|
|||||||
[form, servers, shellToolMap],
|
[form, servers, shellToolMap],
|
||||||
);
|
);
|
||||||
|
|
||||||
const debugId = useId();
|
|
||||||
const bypassId = useId();
|
|
||||||
const shrinkId = useId();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
<Card>
|
<Card>
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
import {PackageIcon} from "lucide-react";
|
import { PackageIcon } from "lucide-react";
|
||||||
import {useEffect, useState} from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card.tsx";
|
import {
|
||||||
import {FormControl, FormField, FormItem, FormLabel} from "@/components/ui/form.tsx";
|
Card,
|
||||||
import {RadioGroup, RadioGroupItem} from "@/components/ui/radio-group.tsx";
|
CardContent,
|
||||||
import type {PackerConfig} from "@/types/memshell";
|
CardHeader,
|
||||||
import type {MemShellFormSchema} from "@/types/schema.ts";
|
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 = {
|
type Option = {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -49,7 +59,10 @@ export default function PackageConfigCard({
|
|||||||
|
|
||||||
setOptions(mappedOptions);
|
setOptions(mappedOptions);
|
||||||
const currentValue = form.getValues("packingMethod");
|
const currentValue = form.getValues("packingMethod");
|
||||||
if (filteredOptions.length > 0 && (!currentValue || !filteredOptions.includes(currentValue))) {
|
if (
|
||||||
|
filteredOptions.length > 0 &&
|
||||||
|
(!currentValue || !filteredOptions.includes(currentValue))
|
||||||
|
) {
|
||||||
form.setValue("packingMethod", filteredOptions[0]);
|
form.setValue("packingMethod", filteredOptions[0]);
|
||||||
}
|
}
|
||||||
}, [form, packerConfig, server, shellType, t]);
|
}, [form, packerConfig, server, shellType, t]);
|
||||||
@@ -78,7 +91,10 @@ export default function PackageConfigCard({
|
|||||||
className="grid grid-cols-2 md:grid-cols-3"
|
className="grid grid-cols-2 md:grid-cols-3"
|
||||||
>
|
>
|
||||||
{options.map(({ name, value }) => (
|
{options.map(({ name, value }) => (
|
||||||
<FormItem key={value} className="flex items-center space-x-3 space-y-0">
|
<FormItem
|
||||||
|
key={value}
|
||||||
|
className="flex items-center space-x-3 space-y-0"
|
||||||
|
>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<RadioGroupItem value={value} id={value} />
|
<RadioGroupItem value={value} id={value} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@@ -96,7 +112,9 @@ export default function PackageConfigCard({
|
|||||||
) : (
|
) : (
|
||||||
<div className="flex items-center justify-center p-4 space-x-2">
|
<div className="flex items-center justify-center p-4 space-x-2">
|
||||||
<div className="h-4 w-4 animate-spin rounded-full border-2 border-primary border-t-transparent" />
|
<div className="h-4 w-4 animate-spin rounded-full border-2 border-primary border-t-transparent" />
|
||||||
<span className="text-sm text-muted-foreground">{t("loading")}</span>
|
<span className="text-sm text-muted-foreground">
|
||||||
|
{t("loading")}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
import { ScrollTextIcon } from "lucide-react";
|
import { ScrollTextIcon } from "lucide-react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card.tsx";
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
CardHeader,
|
||||||
|
CardTitle,
|
||||||
|
} from "@/components/ui/card.tsx";
|
||||||
|
|
||||||
export function QuickUsage() {
|
export function QuickUsage() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import {ScrollTextIcon} from "lucide-react";
|
import { ScrollTextIcon } from "lucide-react";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {Button} from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
import {Separator} from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import {downloadBytes, formatBytes} from "@/lib/utils";
|
import { downloadBytes, formatBytes } from "@/lib/utils";
|
||||||
import type {MemShellResult} from "@/types/memshell";
|
import type { MemShellResult } from "@/types/memshell";
|
||||||
|
|
||||||
export function AgentResult({
|
export function AgentResult({
|
||||||
packMethod,
|
packMethod,
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import {FileTextIcon} from "lucide-react";
|
import { FileTextIcon } from "lucide-react";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
import {Separator} from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import {shouldHidden} from "@/lib/utils";
|
import { shouldHidden } from "@/lib/utils";
|
||||||
import {
|
import {
|
||||||
type AntSwordShellToolConfig,
|
type AntSwordShellToolConfig,
|
||||||
type BehinderShellToolConfig,
|
type BehinderShellToolConfig,
|
||||||
type CommandShellToolConfig,
|
type CommandShellToolConfig,
|
||||||
type GodzillaShellToolConfig,
|
type GodzillaShellToolConfig,
|
||||||
type MemShellResult,
|
type MemShellResult,
|
||||||
type NeoreGeorgShellToolConfig,
|
type NeoreGeorgShellToolConfig,
|
||||||
ShellToolType,
|
ShellToolType,
|
||||||
type Suo5ShellToolConfig,
|
type Suo5ShellToolConfig,
|
||||||
} from "@/types/memshell";
|
} from "@/types/memshell";
|
||||||
import {CopyableField} from "../../copyable-field";
|
import { CopyableField } from "../../copyable-field";
|
||||||
import {FeedbackAlert} from "./feedback-alert";
|
import { FeedbackAlert } from "./feedback-alert";
|
||||||
|
|
||||||
export function BasicInfo({ generateResult }: Readonly<{ generateResult?: MemShellResult }>) {
|
export function BasicInfo({ generateResult }: Readonly<{ generateResult?: MemShellResult }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {Button} from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {downloadBytes} from "@/lib/utils";
|
import { downloadBytes } from "@/lib/utils";
|
||||||
import type {MemShellResult} from "@/types/memshell";
|
import type { MemShellResult } from "@/types/memshell";
|
||||||
|
|
||||||
export function JarResult({
|
export function JarResult({
|
||||||
packResult,
|
packResult,
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import CodeViewer from "@/components/code-viewer";
|
import CodeViewer from "@/components/code-viewer";
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
import {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectItem,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from "@/components/ui/select";
|
||||||
|
|
||||||
export function MultiPackResult({
|
export function MultiPackResult({
|
||||||
allPackResults,
|
allPackResults,
|
||||||
packMethod,
|
packMethod,
|
||||||
@@ -30,7 +37,9 @@ export function MultiPackResult({
|
|||||||
<Select
|
<Select
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
setSelectedMethod(value);
|
setSelectedMethod(value);
|
||||||
setPackResult(allPackResults?.[value as keyof typeof allPackResults] ?? "");
|
setPackResult(
|
||||||
|
allPackResults?.[value as keyof typeof allPackResults] ?? "",
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
value={selectedMethod}
|
value={selectedMethod}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import CodeViewer from "@/components/code-viewer";
|
import CodeViewer from "@/components/code-viewer";
|
||||||
import type {MemShellResult} from "@/types/memshell";
|
import type { MemShellResult } from "@/types/memshell";
|
||||||
import {AgentResult} from "./agent";
|
import { AgentResult } from "./agent";
|
||||||
import {JarResult} from "./jar-result";
|
import { JarResult } from "./jar-result";
|
||||||
import {MultiPackResult} from "./multi-packer";
|
import { MultiPackResult } from "./multi-packer";
|
||||||
|
|
||||||
export function ResultComponent({
|
export function ResultComponent({
|
||||||
packResult,
|
packResult,
|
||||||
@@ -19,16 +19,32 @@ export function ResultComponent({
|
|||||||
const showCode = packMethod === "JSP";
|
const showCode = packMethod === "JSP";
|
||||||
const isAgent = packMethod.startsWith("Agent");
|
const isAgent = packMethod.startsWith("Agent");
|
||||||
const isJar = packMethod === "Jar";
|
const isJar = packMethod === "Jar";
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
if (allPackResults) {
|
if (allPackResults) {
|
||||||
return <MultiPackResult allPackResults={allPackResults} packMethod={packMethod} />;
|
return (
|
||||||
|
<MultiPackResult
|
||||||
|
allPackResults={allPackResults}
|
||||||
|
packMethod={packMethod}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAgent) {
|
if (isAgent) {
|
||||||
return <AgentResult packMethod={packMethod} packResult={packResult ?? ""} generateResult={generateResult} />;
|
return (
|
||||||
|
<AgentResult
|
||||||
|
packMethod={packMethod}
|
||||||
|
packResult={packResult ?? ""}
|
||||||
|
generateResult={generateResult}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (isJar) {
|
if (isJar) {
|
||||||
return <JarResult packResult={packResult ?? ""} generateResult={generateResult} />;
|
return (
|
||||||
|
<JarResult
|
||||||
|
packResult={packResult ?? ""}
|
||||||
|
generateResult={generateResult}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!isAgent && !isJar) {
|
if (!isAgent && !isJar) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
import {DownloadIcon} from "lucide-react";
|
import { DownloadIcon } from "lucide-react";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {toast} from "sonner";
|
import { toast } from "sonner";
|
||||||
|
|
||||||
import {QuickUsage} from "@/components/memshell/quick-usage";
|
import { QuickUsage } from "@/components/memshell/quick-usage";
|
||||||
import {Button} from "@/components/ui/button.tsx";
|
import { Button } from "@/components/ui/button.tsx";
|
||||||
import {Tabs, TabsContent, TabsList, TabsTrigger} from "@/components/ui/tabs.tsx";
|
import {
|
||||||
import {downloadBytes} from "@/lib/utils.ts";
|
Tabs,
|
||||||
import type {MemShellResult} from "@/types/memshell";
|
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 CodeViewer from "../code-viewer";
|
||||||
import {BasicInfo} from "./results/basic-info";
|
import { BasicInfo } from "./results/basic-info";
|
||||||
import {ResultComponent} from "./results/result-component";
|
import { ResultComponent } from "./results/result-component";
|
||||||
|
|
||||||
export default function ShellResult({
|
export default function ShellResult({
|
||||||
packResult,
|
packResult,
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {Card, CardContent} from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import {FormControl, FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form";
|
import {
|
||||||
import {Input} from "@/components/ui/input";
|
FormControl,
|
||||||
import {TabsContent} from "@/components/ui/tabs";
|
FormField,
|
||||||
import type {MemShellFormSchema} from "@/types/schema";
|
FormFieldItem,
|
||||||
import {OptionalClassFormField} from "./classname-field";
|
FormFieldLabel,
|
||||||
import {ShellTypeFormField} from "./shelltype-field";
|
} from "@/components/ui/form";
|
||||||
import {UrlPatternFormField} from "./urlpattern-field";
|
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({
|
export function AntSwordTabContent({
|
||||||
form,
|
form,
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {Card, CardContent} from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import {FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form";
|
import { FormField, FormFieldItem, FormFieldLabel } from "@/components/ui/form";
|
||||||
import {Input} from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import {TabsContent} from "@/components/ui/tabs";
|
import { TabsContent } from "@/components/ui/tabs";
|
||||||
import type {MemShellFormSchema} from "@/types/schema";
|
import type { MemShellFormSchema } from "@/types/schema";
|
||||||
import {OptionalClassFormField} from "./classname-field";
|
import { OptionalClassFormField } from "./classname-field";
|
||||||
import {ShellTypeFormField} from "./shelltype-field";
|
import { ShellTypeFormField } from "./shelltype-field";
|
||||||
import {UrlPatternFormField} from "./urlpattern-field";
|
import { UrlPatternFormField } from "./urlpattern-field";
|
||||||
|
|
||||||
export function BehinderTabContent({
|
export function BehinderTabContent({
|
||||||
form,
|
form,
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
import {ChevronDown, ChevronUp, Settings} from "lucide-react";
|
import { ChevronDown, ChevronUp, Settings } from "lucide-react";
|
||||||
import {Fragment, useId, useState} from "react";
|
import { Fragment, useState } from "react";
|
||||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {Button} from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form.tsx";
|
import {
|
||||||
import {Input} from "@/components/ui/input.tsx";
|
FormField,
|
||||||
import type {MemShellFormSchema} from "@/types/schema.ts";
|
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<MemShellFormSchema> }>) {
|
export function OptionalClassFormField({ form }: Readonly<{ form: UseFormReturn<MemShellFormSchema> }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|||||||
@@ -1,16 +1,27 @@
|
|||||||
import {useQuery} from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {Card, CardContent} from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import {FormControl, FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form";
|
import {
|
||||||
import {Input} from "@/components/ui/input";
|
FormControl,
|
||||||
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select";
|
FormField,
|
||||||
import {TabsContent} from "@/components/ui/tabs";
|
FormFieldItem,
|
||||||
import {env} from "@/config";
|
FormFieldLabel,
|
||||||
import type {MemShellFormSchema} from "@/types/schema";
|
} from "@/components/ui/form";
|
||||||
import {OptionalClassFormField} from "./classname-field";
|
import { Input } from "@/components/ui/input";
|
||||||
import {ShellTypeFormField} from "./shelltype-field";
|
import {
|
||||||
import {UrlPatternFormField} from "./urlpattern-field";
|
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({
|
export function CommandTabContent({
|
||||||
form,
|
form,
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
import {t} from "i18next";
|
import { useState } from "react";
|
||||||
import {useId, useState} from "react";
|
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
import { useTranslation } from "react-i18next";
|
||||||
import {Card, CardContent} from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import {FormControl, FormField, FormFieldItem, FormFieldLabel, FormMessage} from "@/components/ui/form";
|
import {
|
||||||
import {Input} from "@/components/ui/input";
|
FormControl,
|
||||||
import {Label} from "@/components/ui/label";
|
FormField,
|
||||||
import {RadioGroup, RadioGroupItem} from "@/components/ui/radio-group";
|
FormFieldItem,
|
||||||
import {TabsContent} from "@/components/ui/tabs";
|
FormFieldLabel,
|
||||||
import {Textarea} from "@/components/ui/textarea";
|
FormMessage,
|
||||||
import type {MemShellFormSchema} from "@/types/schema";
|
} from "@/components/ui/form";
|
||||||
import {OptionalClassFormField} from "./classname-field";
|
import { Input } from "@/components/ui/input";
|
||||||
import {ShellTypeFormField} from "./shelltype-field";
|
import { Label } from "@/components/ui/label";
|
||||||
import {UrlPatternFormField} from "./urlpattern-field";
|
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({
|
export default function CustomTabContent({
|
||||||
form,
|
form,
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {Card, CardContent} from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import {FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form";
|
import { FormField, FormFieldItem, FormFieldLabel } from "@/components/ui/form";
|
||||||
import {Input} from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import {TabsContent} from "@/components/ui/tabs";
|
import { TabsContent } from "@/components/ui/tabs";
|
||||||
import type {MemShellFormSchema} from "@/types/schema";
|
import type { MemShellFormSchema } from "@/types/schema";
|
||||||
import {OptionalClassFormField} from "./classname-field";
|
import { OptionalClassFormField } from "./classname-field";
|
||||||
import {ShellTypeFormField} from "./shelltype-field";
|
import { ShellTypeFormField } from "./shelltype-field";
|
||||||
import {UrlPatternFormField} from "./urlpattern-field";
|
import { UrlPatternFormField } from "./urlpattern-field";
|
||||||
|
|
||||||
export function GodzillaTabContent({
|
export function GodzillaTabContent({
|
||||||
form,
|
form,
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {Card, CardContent} from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import {FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form";
|
import { FormField, FormFieldItem, FormFieldLabel } from "@/components/ui/form";
|
||||||
import {Input} from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import {TabsContent} from "@/components/ui/tabs";
|
import { TabsContent } from "@/components/ui/tabs";
|
||||||
import type {MemShellFormSchema} from "@/types/schema";
|
import type { MemShellFormSchema } from "@/types/schema";
|
||||||
import {OptionalClassFormField} from "./classname-field";
|
import { OptionalClassFormField } from "./classname-field";
|
||||||
import {ShellTypeFormField} from "./shelltype-field";
|
import { ShellTypeFormField } from "./shelltype-field";
|
||||||
import {UrlPatternFormField} from "./urlpattern-field";
|
import { UrlPatternFormField } from "./urlpattern-field";
|
||||||
|
|
||||||
export function NeoRegTabContent({
|
export function NeoRegTabContent({
|
||||||
form,
|
form,
|
||||||
|
|||||||
@@ -1,8 +1,19 @@
|
|||||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {FormControl, FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form.tsx";
|
import {
|
||||||
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select.tsx";
|
FormControl,
|
||||||
import type {MemShellFormSchema} from "@/types/schema.ts";
|
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({
|
export function ShellTypeFormField({
|
||||||
form,
|
form,
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {Card, CardContent} from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import {FormField, FormFieldItem, FormFieldLabel} from "@/components/ui/form";
|
import { FormField, FormFieldItem, FormFieldLabel } from "@/components/ui/form";
|
||||||
import {Input} from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import {TabsContent} from "@/components/ui/tabs";
|
import { TabsContent } from "@/components/ui/tabs";
|
||||||
import type {MemShellFormSchema} from "@/types/schema";
|
import type { MemShellFormSchema } from "@/types/schema";
|
||||||
import {OptionalClassFormField} from "./classname-field";
|
import { OptionalClassFormField } from "./classname-field";
|
||||||
import {ShellTypeFormField} from "./shelltype-field";
|
import { ShellTypeFormField } from "./shelltype-field";
|
||||||
import {UrlPatternFormField} from "./urlpattern-field";
|
import { UrlPatternFormField } from "./urlpattern-field";
|
||||||
|
|
||||||
export function Suo5TabContent({
|
export function Suo5TabContent({
|
||||||
form,
|
form,
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
import {FormProvider, type UseFormReturn} from "react-hook-form";
|
import { FormProvider, type UseFormReturn } from "react-hook-form";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {FormField, FormFieldItem, FormFieldLabel, FormMessage} from "@/components/ui/form.tsx";
|
import {
|
||||||
import {Input} from "@/components/ui/input.tsx";
|
FormField,
|
||||||
import {shouldHidden} from "@/lib/utils";
|
FormFieldItem,
|
||||||
import type {MemShellFormSchema} from "@/types/schema.ts";
|
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<MemShellFormSchema> }>) {
|
export function UrlPatternFormField({ form }: Readonly<{ form: UseFormReturn<MemShellFormSchema> }>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|||||||
@@ -22,9 +22,15 @@ export function ModeToggle() {
|
|||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="end">
|
<DropdownMenuContent align="end">
|
||||||
<DropdownMenuItem onClick={() => setTheme("light")}>Light</DropdownMenuItem>
|
<DropdownMenuItem onClick={() => setTheme("light")}>
|
||||||
<DropdownMenuItem onClick={() => setTheme("dark")}>Dark</DropdownMenuItem>
|
Light
|
||||||
<DropdownMenuItem onClick={() => setTheme("system")}>System</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem onClick={() => setTheme("dark")}>
|
||||||
|
Dark
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem onClick={() => setTheme("system")}>
|
||||||
|
System
|
||||||
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { NavLink } from "react-router";
|
import { NavLink } from "react-router";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
import {
|
||||||
|
Popover,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverTrigger,
|
||||||
|
} from "@/components/ui/popover";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
export function MobileNav({
|
export function MobileNav({
|
||||||
@@ -40,7 +44,9 @@ export function MobileNav({
|
|||||||
</div>
|
</div>
|
||||||
<span className="sr-only">Toggle Menu</span>
|
<span className="sr-only">Toggle Menu</span>
|
||||||
</div>
|
</div>
|
||||||
<span className="flex h-8 items-center text-lg leading-none font-medium">Menu</span>
|
<span className="flex h-8 items-center text-lg leading-none font-medium">
|
||||||
|
Menu
|
||||||
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent
|
<PopoverContent
|
||||||
@@ -52,13 +58,19 @@ export function MobileNav({
|
|||||||
>
|
>
|
||||||
<div className="flex flex-col gap-12 overflow-auto px-6 py-6">
|
<div className="flex flex-col gap-12 overflow-auto px-6 py-6">
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
<div className="text-muted-foreground text-sm font-medium">Menu</div>
|
<div className="text-muted-foreground text-sm font-medium">
|
||||||
|
Menu
|
||||||
|
</div>
|
||||||
<div className="flex flex-col gap-3">
|
<div className="flex flex-col gap-3">
|
||||||
<MobileLink href="/" onOpenChange={setOpen}>
|
<MobileLink href="/" onOpenChange={setOpen}>
|
||||||
Home
|
Home
|
||||||
</MobileLink>
|
</MobileLink>
|
||||||
{items.map((item) => (
|
{items.map((item) => (
|
||||||
<MobileLink key={item.href} href={item.href} onOpenChange={setOpen}>
|
<MobileLink
|
||||||
|
key={item.href}
|
||||||
|
href={item.href}
|
||||||
|
onOpenChange={setOpen}
|
||||||
|
>
|
||||||
{item.label}
|
{item.label}
|
||||||
</MobileLink>
|
</MobileLink>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ export function TailwindIndicator() {
|
|||||||
return (
|
return (
|
||||||
<div className="fixed bottom-1 right-1 z-50 flex size-6 items-center justify-center rounded-full bg-gray-800 p-3 font-mono text-xs text-white">
|
<div className="fixed bottom-1 right-1 z-50 flex size-6 items-center justify-center rounded-full bg-gray-800 p-3 font-mono text-xs text-white">
|
||||||
<div className="block sm:hidden">xs</div>
|
<div className="block sm:hidden">xs</div>
|
||||||
<div className="hidden sm:block md:hidden lg:hidden xl:hidden 2xl:hidden">sm</div>
|
<div className="hidden sm:block md:hidden lg:hidden xl:hidden 2xl:hidden">
|
||||||
|
sm
|
||||||
|
</div>
|
||||||
<div className="hidden md:block lg:hidden xl:hidden 2xl:hidden">md</div>
|
<div className="hidden md:block lg:hidden xl:hidden 2xl:hidden">md</div>
|
||||||
<div className="hidden lg:block xl:hidden 2xl:hidden">lg</div>
|
<div className="hidden lg:block xl:hidden 2xl:hidden">lg</div>
|
||||||
<div className="hidden xl:block 2xl:hidden">xl</div>
|
<div className="hidden xl:block 2xl:hidden">xl</div>
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ export function ThemeProvider({
|
|||||||
storageKey = "vite-ui-theme",
|
storageKey = "vite-ui-theme",
|
||||||
...props
|
...props
|
||||||
}: Readonly<ThemeProviderProps>) {
|
}: Readonly<ThemeProviderProps>) {
|
||||||
const [theme, setTheme] = useState<Theme>(() => (localStorage.getItem(storageKey) as Theme) || defaultTheme);
|
const [theme, setTheme] = useState<Theme>(
|
||||||
|
() => (localStorage.getItem(storageKey) as Theme) || defaultTheme,
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const root = window.document.documentElement;
|
const root = window.document.documentElement;
|
||||||
@@ -35,7 +37,10 @@ export function ThemeProvider({
|
|||||||
|
|
||||||
root.removeAttribute(mode);
|
root.removeAttribute(mode);
|
||||||
if (theme === "system") {
|
if (theme === "system") {
|
||||||
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)")
|
||||||
|
.matches
|
||||||
|
? "dark"
|
||||||
|
: "light";
|
||||||
|
|
||||||
root.classList.add(systemTheme);
|
root.classList.add(systemTheme);
|
||||||
root.setAttribute(mode, systemTheme);
|
root.setAttribute(mode, systemTheme);
|
||||||
@@ -66,7 +71,8 @@ export function ThemeProvider({
|
|||||||
export const useTheme = () => {
|
export const useTheme = () => {
|
||||||
const context = useContext(ThemeProviderContext);
|
const context = useContext(ThemeProviderContext);
|
||||||
|
|
||||||
if (context === undefined) throw new Error("useTheme must be used within a ThemeProvider");
|
if (context === undefined)
|
||||||
|
throw new Error("useTheme must be used within a ThemeProvider");
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
};
|
};
|
||||||
|
|||||||
+3
-1
@@ -48,7 +48,9 @@ function safeParseYup<T>(schema: yup.ObjectSchema<any>, data: unknown) {
|
|||||||
|
|
||||||
const createEnv = () => {
|
const createEnv = () => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const envVars = Object.entries(import.meta.env).reduce<Record<string, string>>((acc, curr) => {
|
const envVars = Object.entries(import.meta.env).reduce<
|
||||||
|
Record<string, string>
|
||||||
|
>((acc, curr) => {
|
||||||
const [key, value] = curr;
|
const [key, value] = curr;
|
||||||
if (typeof value === "string") {
|
if (typeof value === "string") {
|
||||||
if (key.startsWith("VITE_APP_")) {
|
if (key.startsWith("VITE_APP_")) {
|
||||||
|
|||||||
+11
-3
@@ -5,7 +5,11 @@ export function cn(...inputs: ClassValue[]) {
|
|||||||
return twMerge(clsx(inputs));
|
return twMerge(clsx(inputs));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function downloadBytes(base64String: string, className?: string, jarName?: string) {
|
export function downloadBytes(
|
||||||
|
base64String: string,
|
||||||
|
className?: string,
|
||||||
|
jarName?: string,
|
||||||
|
) {
|
||||||
const byteCharacters = atob(base64String);
|
const byteCharacters = atob(base64String);
|
||||||
const byteNumbers = new Array(byteCharacters.length);
|
const byteNumbers = new Array(byteCharacters.length);
|
||||||
for (let i = 0; i < byteCharacters.length; i++) {
|
for (let i = 0; i < byteCharacters.length; i++) {
|
||||||
@@ -14,12 +18,16 @@ export function downloadBytes(base64String: string, className?: string, jarName?
|
|||||||
const byteArray = new Uint8Array(byteNumbers);
|
const byteArray = new Uint8Array(byteNumbers);
|
||||||
|
|
||||||
// Create a Blob from the byte array
|
// Create a Blob from the byte array
|
||||||
const blob = new Blob([byteArray], { type: className ? "application/java-vm" : "application/java-archive" });
|
const blob = new Blob([byteArray], {
|
||||||
|
type: className ? "application/java-vm" : "application/java-archive",
|
||||||
|
});
|
||||||
|
|
||||||
// Create a download link
|
// Create a download link
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.href = window.URL.createObjectURL(blob);
|
link.href = window.URL.createObjectURL(blob);
|
||||||
link.download = className ? `${className.substring(className.lastIndexOf("."))}.class` : `${jarName}.jar`;
|
link.download = className
|
||||||
|
? `${className.substring(className.lastIndexOf("."))}.class`
|
||||||
|
: `${jarName}.jar`;
|
||||||
|
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
|
|||||||
+26
-20
@@ -1,27 +1,31 @@
|
|||||||
import {useQuery} from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import {LoaderCircle, WandSparklesIcon} from "lucide-react";
|
import { LoaderCircle, WandSparklesIcon } from "lucide-react";
|
||||||
import {useState, useTransition} from "react";
|
import { useState, useTransition } from "react";
|
||||||
import {useForm} from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {useLoaderData} from "react-router-dom";
|
import { useLoaderData } from "react-router-dom";
|
||||||
import {toast} from "sonner";
|
import { toast } from "sonner";
|
||||||
import MainConfigCard from "@/components/memshell/main-config-card";
|
import MainConfigCard from "@/components/memshell/main-config-card";
|
||||||
import PackageConfigCard from "@/components/memshell/package-config-card";
|
import PackageConfigCard from "@/components/memshell/package-config-card";
|
||||||
import ShellResult from "@/components/memshell/shell-result";
|
import ShellResult from "@/components/memshell/shell-result";
|
||||||
import {Button} from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {Form} from "@/components/ui/form.tsx";
|
import { Form } from "@/components/ui/form.tsx";
|
||||||
import {env} from "@/config.ts";
|
import { env } from "@/config.ts";
|
||||||
import {
|
import {
|
||||||
type APIErrorResponse,
|
type APIErrorResponse,
|
||||||
type MainConfig,
|
type MainConfig,
|
||||||
type MemShellGenerateResponse,
|
type MemShellGenerateResponse,
|
||||||
type MemShellResult,
|
type MemShellResult,
|
||||||
type PackerConfig,
|
type PackerConfig,
|
||||||
type ServerConfig,
|
type ServerConfig,
|
||||||
ShellToolType,
|
ShellToolType,
|
||||||
} from "@/types/memshell";
|
} from "@/types/memshell";
|
||||||
import {type MemShellFormSchema, memShellFormSchema, useYupValidationResolver} from "@/types/schema.ts";
|
import {
|
||||||
import {transformToPostData} from "@/utils/transformer.ts";
|
type MemShellFormSchema,
|
||||||
|
memShellFormSchema,
|
||||||
|
useYupValidationResolver,
|
||||||
|
} from "@/types/schema.ts";
|
||||||
|
import { transformToPostData } from "@/utils/transformer.ts";
|
||||||
|
|
||||||
export default function MemShellPage() {
|
export default function MemShellPage() {
|
||||||
const urlParams = useLoaderData();
|
const urlParams = useLoaderData();
|
||||||
@@ -78,7 +82,9 @@ export default function MemShellPage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const [packResult, setPackResult] = useState<string | undefined>();
|
const [packResult, setPackResult] = useState<string | undefined>();
|
||||||
const [allPackResults, setAllPackResults] = useState<Map<string, string> | undefined>();
|
const [allPackResults, setAllPackResults] = useState<
|
||||||
|
Map<string, string> | undefined
|
||||||
|
>();
|
||||||
const [generateResult, setGenerateResult] = useState<MemShellResult>();
|
const [generateResult, setGenerateResult] = useState<MemShellResult>();
|
||||||
const [packMethod, setPackMethod] = useState<string>("");
|
const [packMethod, setPackMethod] = useState<string>("");
|
||||||
const [isActionPending, startTransition] = useTransition();
|
const [isActionPending, startTransition] = useTransition();
|
||||||
|
|||||||
@@ -8,13 +8,22 @@ import MainConfigCard from "@/components/probeshell/main-config-card";
|
|||||||
import PackageConfigCard from "@/components/probeshell/package-config-card";
|
import PackageConfigCard from "@/components/probeshell/package-config-card";
|
||||||
import ShellResult from "@/components/probeshell/shell-result";
|
import ShellResult from "@/components/probeshell/shell-result";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import { Form } from "@/components/ui/form";
|
||||||
Form,
|
|
||||||
} from "@/components/ui/form";
|
|
||||||
import { env } from "@/config";
|
import { env } from "@/config";
|
||||||
import type { APIErrorResponse, PackerConfig, ServerConfig } from "@/types/memshell";
|
import type {
|
||||||
import type { ProbeShellGenerateResponse, ProbeShellResult } from "@/types/probeshell";
|
APIErrorResponse,
|
||||||
import { type ProbeShellFormSchema, probeShellFormSchema, useYupValidationProbeResolver } from "@/types/schema";
|
PackerConfig,
|
||||||
|
ServerConfig,
|
||||||
|
} from "@/types/memshell";
|
||||||
|
import type {
|
||||||
|
ProbeShellGenerateResponse,
|
||||||
|
ProbeShellResult,
|
||||||
|
} from "@/types/probeshell";
|
||||||
|
import {
|
||||||
|
type ProbeShellFormSchema,
|
||||||
|
probeShellFormSchema,
|
||||||
|
useYupValidationProbeResolver,
|
||||||
|
} from "@/types/schema";
|
||||||
import { transformToProbePostData } from "@/utils/transformer";
|
import { transformToProbePostData } from "@/utils/transformer";
|
||||||
|
|
||||||
export default function ProbeShellGenerator() {
|
export default function ProbeShellGenerator() {
|
||||||
@@ -46,18 +55,21 @@ export default function ProbeShellGenerator() {
|
|||||||
reqParamName: "payload",
|
reqParamName: "payload",
|
||||||
reqHeaderName: "X-PAYLOAD",
|
reqHeaderName: "X-PAYLOAD",
|
||||||
seconds: 5,
|
seconds: 5,
|
||||||
sleepServer: "Tomcat"
|
sleepServer: "Tomcat",
|
||||||
|
shrink: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const [packResult, setPackResult] = useState<string | undefined>();
|
const [packResult, setPackResult] = useState<string | undefined>();
|
||||||
const [allPackResults, setAllPackResults] = useState<Map<string, string> | undefined>();
|
const [allPackResults, setAllPackResults] = useState<
|
||||||
|
Map<string, string> | undefined
|
||||||
|
>();
|
||||||
const [generateResult, setGenerateResult] = useState<ProbeShellResult>();
|
const [generateResult, setGenerateResult] = useState<ProbeShellResult>();
|
||||||
const [packMethod, setPackMethod] = useState<string>("");
|
const [packMethod, setPackMethod] = useState<string>("");
|
||||||
const [isActionPending, startTransition] = useTransition();
|
const [isActionPending, startTransition] = useTransition();
|
||||||
|
|
||||||
const onSubmit = async (data: ProbeShellFormSchema) => {
|
const onSubmit = async (data: ProbeShellFormSchema) => {
|
||||||
startTransition(async () => {
|
startTransition(async () => {
|
||||||
try {
|
try {
|
||||||
const postData = transformToProbePostData(data);
|
const postData = transformToProbePostData(data);
|
||||||
const response = await fetch(`${env.API_URL}/probe/generate`, {
|
const response = await fetch(`${env.API_URL}/probe/generate`, {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {QueryClient, QueryClientProvider} from "@tanstack/react-query";
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
import type {ReactNode} from "react";
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
const queryClient = new QueryClient({
|
const queryClient = new QueryClient({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
@@ -11,5 +11,7 @@ const queryClient = new QueryClient({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export function QueryProvider({ children }: Readonly<{ children: ReactNode }>) {
|
export function QueryProvider({ children }: Readonly<{ children: ReactNode }>) {
|
||||||
return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>;
|
return (
|
||||||
|
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+45
-23
@@ -1,12 +1,14 @@
|
|||||||
import {createHashRouter} from "react-router-dom";
|
import { createHashRouter } from "react-router-dom";
|
||||||
import RootLayout from "@/components/layouts/root-layout";
|
import RootLayout from "@/components/layouts/root-layout";
|
||||||
import {env} from "@/config";
|
import { env } from "@/config";
|
||||||
import MemShellPage from "@/pages/memshell";
|
import MemShellPage from "@/pages/memshell";
|
||||||
import ProbeShellPage from "@/pages/probeshell";
|
import ProbeShellPage from "@/pages/probeshell";
|
||||||
import type {MemShellFormSchema} from "@/types/schema";
|
import type { MemShellFormSchema } from "@/types/schema";
|
||||||
|
|
||||||
// Function to parse URL parameters into form default values
|
// Function to parse URL parameters into form default values
|
||||||
const parseUrlParams = (searchParams: URLSearchParams): Partial<MemShellFormSchema> => {
|
const parseUrlParams = (
|
||||||
|
searchParams: URLSearchParams,
|
||||||
|
): Partial<MemShellFormSchema> => {
|
||||||
const result: Partial<MemShellFormSchema> = {};
|
const result: Partial<MemShellFormSchema> = {};
|
||||||
|
|
||||||
// Helper function to parse boolean values
|
// Helper function to parse boolean values
|
||||||
@@ -16,27 +18,47 @@ const parseUrlParams = (searchParams: URLSearchParams): Partial<MemShellFormSche
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Map URL parameters to form fields
|
// Map URL parameters to form fields
|
||||||
if (searchParams.has("server")) result.server = searchParams.get("server") ?? undefined;
|
if (searchParams.has("server"))
|
||||||
if (searchParams.has("targetJdkVersion")) result.targetJdkVersion = searchParams.get("targetJdkVersion") ?? undefined;
|
result.server = searchParams.get("server") ?? undefined;
|
||||||
if (searchParams.has("debug")) result.debug = parseBoolean(searchParams.get("debug"));
|
if (searchParams.has("targetJdkVersion"))
|
||||||
|
result.targetJdkVersion = searchParams.get("targetJdkVersion") ?? undefined;
|
||||||
|
if (searchParams.has("debug"))
|
||||||
|
result.debug = parseBoolean(searchParams.get("debug"));
|
||||||
if (searchParams.has("byPassJavaModule"))
|
if (searchParams.has("byPassJavaModule"))
|
||||||
result.byPassJavaModule = parseBoolean(searchParams.get("byPassJavaModule"));
|
result.byPassJavaModule = parseBoolean(
|
||||||
if (searchParams.has("shellClassName")) result.shellClassName = searchParams.get("shellClassName") ?? undefined;
|
searchParams.get("byPassJavaModule"),
|
||||||
if (searchParams.has("shellTool")) result.shellTool = searchParams.get("shellTool") ?? undefined;
|
);
|
||||||
if (searchParams.has("shellType")) result.shellType = searchParams.get("shellType") ?? undefined;
|
if (searchParams.has("shellClassName"))
|
||||||
if (searchParams.has("urlPattern")) result.urlPattern = searchParams.get("urlPattern") ?? undefined;
|
result.shellClassName = searchParams.get("shellClassName") ?? undefined;
|
||||||
if (searchParams.has("godzillaPass")) result.godzillaPass = searchParams.get("godzillaPass") ?? undefined;
|
if (searchParams.has("shellTool"))
|
||||||
if (searchParams.has("godzillaKey")) result.godzillaKey = searchParams.get("godzillaKey") ?? undefined;
|
result.shellTool = searchParams.get("shellTool") ?? undefined;
|
||||||
if (searchParams.has("behinderPass")) result.behinderPass = searchParams.get("behinderPass") ?? undefined;
|
if (searchParams.has("shellType"))
|
||||||
if (searchParams.has("antSwordPass")) result.antSwordPass = searchParams.get("antSwordPass") ?? undefined;
|
result.shellType = searchParams.get("shellType") ?? undefined;
|
||||||
if (searchParams.has("commandParamName")) result.commandParamName = searchParams.get("commandParamName") ?? undefined;
|
if (searchParams.has("urlPattern"))
|
||||||
if (searchParams.has("headerName")) result.headerName = searchParams.get("headerName") ?? undefined;
|
result.urlPattern = searchParams.get("urlPattern") ?? undefined;
|
||||||
if (searchParams.has("headerValue")) result.headerValue = searchParams.get("headerValue") ?? undefined;
|
if (searchParams.has("godzillaPass"))
|
||||||
|
result.godzillaPass = searchParams.get("godzillaPass") ?? undefined;
|
||||||
|
if (searchParams.has("godzillaKey"))
|
||||||
|
result.godzillaKey = searchParams.get("godzillaKey") ?? undefined;
|
||||||
|
if (searchParams.has("behinderPass"))
|
||||||
|
result.behinderPass = searchParams.get("behinderPass") ?? undefined;
|
||||||
|
if (searchParams.has("antSwordPass"))
|
||||||
|
result.antSwordPass = searchParams.get("antSwordPass") ?? undefined;
|
||||||
|
if (searchParams.has("commandParamName"))
|
||||||
|
result.commandParamName = searchParams.get("commandParamName") ?? undefined;
|
||||||
|
if (searchParams.has("headerName"))
|
||||||
|
result.headerName = searchParams.get("headerName") ?? undefined;
|
||||||
|
if (searchParams.has("headerValue"))
|
||||||
|
result.headerValue = searchParams.get("headerValue") ?? undefined;
|
||||||
if (searchParams.has("injectorClassName"))
|
if (searchParams.has("injectorClassName"))
|
||||||
result.injectorClassName = searchParams.get("injectorClassName") ?? undefined;
|
result.injectorClassName =
|
||||||
if (searchParams.has("packingMethod")) result.packingMethod = searchParams.get("packingMethod") ?? undefined;
|
searchParams.get("injectorClassName") ?? undefined;
|
||||||
if (searchParams.has("shrink")) result.shrink = parseBoolean(searchParams.get("shrink"));
|
if (searchParams.has("packingMethod"))
|
||||||
if (searchParams.has("shellClassBase64")) result.shellClassBase64 = searchParams.get("shellClassBase64") ?? undefined;
|
result.packingMethod = searchParams.get("packingMethod") ?? undefined;
|
||||||
|
if (searchParams.has("shrink"))
|
||||||
|
result.shrink = parseBoolean(searchParams.get("shrink"));
|
||||||
|
if (searchParams.has("shellClassBase64"))
|
||||||
|
result.shellClassBase64 = searchParams.get("shellClassBase64") ?? undefined;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -105,7 +105,11 @@ export interface MemShellResult {
|
|||||||
injectorSize: number;
|
injectorSize: number;
|
||||||
injectorBytesBase64Str: string;
|
injectorBytesBase64Str: string;
|
||||||
shellConfig: ShellConfig;
|
shellConfig: ShellConfig;
|
||||||
shellToolConfig: CommandShellToolConfig | GodzillaShellToolConfig | BehinderShellToolConfig | AntSwordShellToolConfig;
|
shellToolConfig:
|
||||||
|
| CommandShellToolConfig
|
||||||
|
| GodzillaShellToolConfig
|
||||||
|
| BehinderShellToolConfig
|
||||||
|
| AntSwordShellToolConfig;
|
||||||
injectorConfig: InjectorConfig;
|
injectorConfig: InjectorConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
export type ProbeMethod = "ResponseBody" | "DNSLog" | "Sleep";
|
export type ProbeMethod = "ResponseBody" | "DNSLog" | "Sleep";
|
||||||
|
|
||||||
export type ProbeContent = "BasicInfo" | "Server" | "OS" | "JDK" | "Bytecode" | "Command";
|
export type ProbeContent =
|
||||||
|
| "BasicInfo"
|
||||||
|
| "Server"
|
||||||
|
| "OS"
|
||||||
|
| "JDK"
|
||||||
|
| "Bytecode"
|
||||||
|
| "Command";
|
||||||
|
|
||||||
export interface ProbeConfig {
|
export interface ProbeConfig {
|
||||||
probeMethod: string;
|
probeMethod: string;
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
import type {InjectorConfig, ShellConfig, ShellToolConfig} from "@/types/memshell";
|
import type {
|
||||||
import type {ProbeConfig, ProbeContentConfig} from "@/types/probeshell";
|
InjectorConfig,
|
||||||
import type {MemShellFormSchema, ProbeShellFormSchema} from "@/types/schema.ts";
|
ShellConfig,
|
||||||
|
ShellToolConfig,
|
||||||
|
} from "@/types/memshell";
|
||||||
|
import type { ProbeConfig, ProbeContentConfig } from "@/types/probeshell";
|
||||||
|
import type {
|
||||||
|
MemShellFormSchema,
|
||||||
|
ProbeShellFormSchema,
|
||||||
|
} from "@/types/schema.ts";
|
||||||
|
|
||||||
export function transformToPostData(formValue: MemShellFormSchema) {
|
export function transformToPostData(formValue: MemShellFormSchema) {
|
||||||
const shellConfig: ShellConfig = {
|
const shellConfig: ShellConfig = {
|
||||||
@@ -46,22 +53,22 @@ export function transformToProbePostData(formValue: ProbeShellFormSchema) {
|
|||||||
shellClassName: formValue.shellClassName,
|
shellClassName: formValue.shellClassName,
|
||||||
shrink: formValue.shrink,
|
shrink: formValue.shrink,
|
||||||
debug: formValue.debug,
|
debug: formValue.debug,
|
||||||
byPassJavaModule: formValue.byPassJavaModule
|
byPassJavaModule: formValue.byPassJavaModule,
|
||||||
}
|
};
|
||||||
const probeContentConfig: ProbeContentConfig = {
|
const probeContentConfig: ProbeContentConfig = {
|
||||||
host: formValue.host,
|
host: formValue.host,
|
||||||
seconds: formValue.seconds,
|
seconds: formValue.seconds,
|
||||||
sleepServer: formValue.sleepServer,
|
sleepServer: formValue.sleepServer,
|
||||||
server: formValue.server,
|
server: formValue.server,
|
||||||
reqParamName: formValue.reqParamName,
|
reqParamName: formValue.reqParamName,
|
||||||
reqHeaderName: formValue.reqHeaderName
|
reqHeaderName: formValue.reqHeaderName,
|
||||||
}
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
probeConfig,
|
probeConfig,
|
||||||
probeContentConfig,
|
probeContentConfig,
|
||||||
packer: formValue.packingMethod
|
packer: formValue.packingMethod,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-3
@@ -11,9 +11,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": ["./src/*"]
|
||||||
"./src/*"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user