diff --git a/web/app/components/code-viewer.tsx b/web/app/components/code-viewer.tsx index 74304e69..dffb4a94 100644 --- a/web/app/components/code-viewer.tsx +++ b/web/app/components/code-viewer.tsx @@ -1,18 +1,14 @@ import type { VariantProps } from "class-variance-authority"; + import { Check, Copy } from "lucide-react"; -import { - type HTMLProps, - type ReactNode, - useCallback, - useEffect, - useState, -} from "react"; +import { type HTMLProps, type ReactNode, 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 materialDark from "react-syntax-highlighter/dist/esm/styles/prism/material-dark"; import { toast } from "sonner"; + import { Button, type buttonVariants } from "@/components/ui/button"; import { cn } from "@/lib/utils"; @@ -68,17 +64,13 @@ export default function CodeViewer({ showLineNumbers = true, wrapLongLines = true, }: Readonly) { - const lineProps: lineTagPropsFunction | HTMLProps | undefined = - wrapLongLines - ? { style: { overflowWrap: "break-word", whiteSpace: "pre-wrap" } } - : undefined; + const lineProps: lineTagPropsFunction | HTMLProps | undefined = wrapLongLines + ? { style: { overflowWrap: "break-word", whiteSpace: "pre-wrap" } } + : undefined; return (
{header}
@@ -86,7 +78,7 @@ export default function CodeViewer({
-
+
-
+
{value && ( @@ -59,11 +55,7 @@ export function CopyableField({ className="h-8 w-8" disabled={hasCopied} > - {hasCopied ? ( - - ) : ( - - )} + {hasCopied ? : } )} diff --git a/web/app/components/image-zoom.tsx b/web/app/components/image-zoom.tsx index 6f15872e..1cb1f7b6 100644 --- a/web/app/components/image-zoom.tsx +++ b/web/app/components/image-zoom.tsx @@ -1,8 +1,10 @@ "use client"; -import { Image, type ImageProps } from "fumadocs-core/framework"; import type { ComponentProps } from "react"; + +import { Image, type ImageProps } from "fumadocs-core/framework"; import Zoom, { type UncontrolledProps } from "react-medium-image-zoom"; + import "@/components/image-zoom.css"; export type ImageZoomProps = ImageProps & { @@ -22,20 +24,14 @@ function getImageSrc(src: ImageProps["src"]): string { if (typeof src === "object") { // Next.js - if ("default" in src) - return (src as { default: { src: string } }).default.src; + if ("default" in src) return (src as { default: { src: string } }).default.src; return src.src; } return ""; } -export function ImageZoom({ - zoomInProps, - children, - rmiz, - ...props -}: ImageZoomProps) { +export function ImageZoom({ zoomInProps, children, rmiz, ...props }: ImageZoomProps) { return ( {children ?? ( - + )} ); diff --git a/web/app/components/language-switcher.tsx b/web/app/components/language-switcher.tsx index cd5332a2..296cc8e1 100644 --- a/web/app/components/language-switcher.tsx +++ b/web/app/components/language-switcher.tsx @@ -1,5 +1,6 @@ import { LanguagesIcon } from "lucide-react"; import { useTranslation } from "react-i18next"; + import { Button } from "./ui/button"; export function LanguageSwitcher() { diff --git a/web/app/components/magicui/line-shadow-text.tsx b/web/app/components/magicui/line-shadow-text.tsx index c8618d47..74866190 100644 --- a/web/app/components/magicui/line-shadow-text.tsx +++ b/web/app/components/magicui/line-shadow-text.tsx @@ -1,9 +1,9 @@ import { type MotionProps, motion } from "motion/react"; + import { cn } from "@/lib/utils"; interface LineShadowTextProps - extends Omit, keyof MotionProps>, - MotionProps { + extends Omit, keyof MotionProps>, MotionProps { shadowColor?: string; as?: React.ElementType; } @@ -27,7 +27,7 @@ export function LineShadowText({ style={{ "--shadow-color": shadowColor } as React.CSSProperties} className={cn( "relative z-0 inline-flex", - "after:absolute after:left-[0.04em] after:top-[0.04em] after:content-[attr(data-text)]", + "after:absolute after:top-[0.04em] after:left-[0.04em] after:content-[attr(data-text)]", "after:bg-[linear-gradient(45deg,transparent_45%,var(--shadow-color)_45%,var(--shadow-color)_55%,transparent_0)]", "after:-z-10 after:bg-[length:0.06em_0.06em] after:bg-clip-text after:text-transparent", "after:animate-line-shadow", diff --git a/web/app/components/mdx.tsx b/web/app/components/mdx.tsx index 62ce6e51..84d65bc5 100644 --- a/web/app/components/mdx.tsx +++ b/web/app/components/mdx.tsx @@ -1,6 +1,7 @@ -import defaultMdxComponents from "fumadocs-ui/mdx"; import type { MDXComponents } from "mdx/types"; +import defaultMdxComponents from "fumadocs-ui/mdx"; + export function getMDXComponents(components?: MDXComponents) { return { ...defaultMdxComponents, diff --git a/web/app/components/memshell/jreversion-field.tsx b/web/app/components/memshell/jreversion-field.tsx index dc875777..cb9566fe 100644 --- a/web/app/components/memshell/jreversion-field.tsx +++ b/web/app/components/memshell/jreversion-field.tsx @@ -1,11 +1,9 @@ +import type { MemShellFormSchema } from "@/types/schema"; + import { Controller, type UseFormReturn } from "react-hook-form"; import { useTranslation } from "react-i18next"; -import { - Field, - FieldContent, - FieldError, - FieldLabel, -} from "@/components/ui/field"; + +import { Field, FieldContent, FieldError, FieldLabel } from "@/components/ui/field"; import { Select, SelectContent, @@ -13,7 +11,6 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select"; -import type { MemShellFormSchema } from "@/types/schema"; const JDKVersion = [ { name: "Java6", value: "50" }, @@ -37,9 +34,7 @@ export function JREVersionFormField({ render={({ field, fieldState }) => ( - - {t("common:targetJdkVersion")} - + {t("common:targetJdkVersion")} + {t("common:server")} + - handleShellToolChange(v as string) - } + onValueChange={(v) => handleShellToolChange(v as string)} > - + {shellTools.map((tool) => ( @@ -338,21 +306,17 @@ export default function MainConfigCard({ />
-
+
(
- + - +

{t("common:debug.description")}

@@ -366,15 +330,11 @@ export default function MainConfigCard({ name="probe" render={({ field }) => (
- + - +

{t("common:probe.description")}

@@ -388,17 +348,11 @@ export default function MainConfigCard({ name="byPassJavaModule" render={({ field }) => (
- - + + - +

{t("common:byPassJavaModule.description")}

@@ -417,12 +371,10 @@ export default function MainConfigCard({ checked={field.value} onCheckedChange={field.onChange} /> - + - +

{t("common:lambdaSuffix.description")}

@@ -436,15 +388,11 @@ export default function MainConfigCard({ name="shrink" render={({ field }) => (
- + - +

{t("common:shrink.description")}

@@ -463,12 +411,10 @@ export default function MainConfigCard({ checked={field.value} onCheckedChange={field.onChange} /> - + - +

{t("common:staticInitialize.description")}

@@ -489,11 +435,7 @@ export default function MainConfigCard({ - + diff --git a/web/app/components/memshell/package-config-card.tsx b/web/app/components/memshell/package-config-card.tsx index 43b0ee90..a86ad746 100644 --- a/web/app/components/memshell/package-config-card.tsx +++ b/web/app/components/memshell/package-config-card.tsx @@ -1,13 +1,15 @@ +import type { PackerConfig } from "@/types/memshell"; +import type { MemShellFormSchema } from "@/types/schema"; + import { PackageIcon } from "lucide-react"; import { useMemo } from "react"; import { Controller, type UseFormReturn, useWatch } from "react-hook-form"; import { useTranslation } from "react-i18next"; + import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { FieldLabel, FieldSet } from "@/components/ui/field"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { Spinner } from "@/components/ui/spinner"; -import type { PackerConfig } from "@/types/memshell"; -import type { MemShellFormSchema } from "@/types/schema"; export default function PackageConfigCard({ packerConfig, @@ -84,11 +86,9 @@ export default function PackageConfigCard({ )} /> ) : ( -
+
- - {t("loading")} - + {t("loading")}
)} diff --git a/web/app/components/memshell/quick-usage.tsx b/web/app/components/memshell/quick-usage.tsx index 72b1cd00..a9385d9c 100644 --- a/web/app/components/memshell/quick-usage.tsx +++ b/web/app/components/memshell/quick-usage.tsx @@ -1,5 +1,6 @@ import { ScrollTextIcon } from "lucide-react"; import { useTranslation } from "react-i18next"; + import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; export function QuickUsage() { @@ -13,7 +14,7 @@ export function QuickUsage() { -
    +
    1. {t("memshell:quickUsage.step1")}
    2. {t("memshell:quickUsage.step2")}
    3. {t("memshell:quickUsage.step3")}
    4. diff --git a/web/app/components/memshell/results/agent.tsx b/web/app/components/memshell/results/agent.tsx index 69161150..b62ec3a3 100644 --- a/web/app/components/memshell/results/agent.tsx +++ b/web/app/components/memshell/results/agent.tsx @@ -1,10 +1,12 @@ +import type { MemShellResult } from "@/types/memshell"; + 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, @@ -26,11 +28,10 @@ export function AgentResult({ -
        +
        1. - {t("common:download")} MemShellAgent.jar ( - {formatBytes(atob(packResult).length)}) + {t("common:download")} MemShellAgent.jar ({formatBytes(atob(packResult).length)}) @@ -72,9 +71,7 @@ export function AgentResult({
        2. {t("memshell:tips.get-pid")}
        3. - {isPureAgent - ? t("memshell:tips.execute-command") - : t("memshell:tips.execute-command1")} + {isPureAgent ? t("memshell:tips.execute-command") : t("memshell:tips.execute-command1")}
        4. {t("memshell:tips.try-to-use-shell")}
        diff --git a/web/app/components/memshell/results/basic-info.tsx b/web/app/components/memshell/results/basic-info.tsx index f29e8dbc..d53ff17d 100644 --- a/web/app/components/memshell/results/basic-info.tsx +++ b/web/app/components/memshell/results/basic-info.tsx @@ -1,6 +1,7 @@ import { FileTextIcon } from "lucide-react"; -import { Fragment } from "react/jsx-runtime"; import { useTranslation } from "react-i18next"; +import { Fragment } from "react/jsx-runtime"; + import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Separator } from "@/components/ui/separator"; import { notNeedUrlPattern } from "@/lib/utils"; @@ -15,12 +16,11 @@ import { ShellToolType, type Suo5ShellToolConfig, } from "@/types/memshell"; + import { CopyableField } from "../../copyable-field"; import { FeedbackAlert } from "./feedback-alert"; -export function BasicInfo({ - generateResult, -}: Readonly<{ generateResult?: MemShellResult }>) { +export function BasicInfo({ generateResult }: Readonly<{ generateResult?: MemShellResult }>) { const { t } = useTranslation(["memshell", "common"]); const isDubbo = generateResult?.shellConfig.server === "Dubbo"; return ( @@ -35,11 +35,8 @@ export function BasicInfo({ -
        - +
        +
        - {generateResult?.shellConfig.shellTool !== ShellToolType.Custom && - !isDubbo && } -
        + {generateResult?.shellConfig.shellTool !== ShellToolType.Custom && !isDubbo && ( + + )} +
        {generateResult?.shellConfig.shellTool === ShellToolType.Behinder && ( <> - + )} - {generateResult?.shellConfig.shellTool === ShellToolType.Command && - !isDubbo && ( - - - )} + {generateResult?.shellConfig.shellTool === ShellToolType.Command && !isDubbo && ( + + + )} {(generateResult?.shellConfig.shellTool === ShellToolType.Suo5 || generateResult?.shellConfig.shellTool === ShellToolType.Suo5v2) && ( )} - {generateResult?.shellConfig.shellTool === - ShellToolType.NeoreGeorg && ( + {generateResult?.shellConfig.shellTool === ShellToolType.NeoreGeorg && ( <> - + -
        +
        -
          +
          1. - {t("common:download")} {packMethod}Shell.jar ( - {formatBytes(atob(packResult).length)}) + {t("common:download")} {packMethod}Shell.jar ({formatBytes(atob(packResult).length)})
        - } + header={
        {generateResult?.injectorClassName}
        } button={