feat: support xxl-job executor NettyHandler (#30)

Only support jdk8, in jdk11 or jdk17 env, you should use file write and use urlClassLoader to load injectorClass or else.
This commit is contained in:
ReaJason
2025-01-22 18:36:19 +08:00
parent 08ffa47531
commit f9eb9dafa4
51 changed files with 1042 additions and 335 deletions
BIN
View File
Binary file not shown.
+4 -4
View File
@@ -13,7 +13,7 @@
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@tanstack/router-plugin": "^1.97.3",
"@tanstack/router-plugin": "^1.97.8",
"@types/node": "^22.10.7",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
@@ -24,7 +24,7 @@
"postcss": "^8.5.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"vite": "^6.0.7"
"vite": "^6.0.11"
},
"dependencies": {
"@hookform/resolvers": "^3.10.0",
@@ -40,8 +40,8 @@
"@radix-ui/react-tabs": "^1.1.2",
"@radix-ui/react-tooltip": "^1.1.6",
"@tanstack/react-query": "^5.64.2",
"@tanstack/react-router": "^1.97.3",
"@tanstack/router-devtools": "^1.97.3",
"@tanstack/react-router": "^1.97.8",
"@tanstack/router-devtools": "^1.97.8",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"i18next": "^24.2.1",
+10
View File
@@ -60,6 +60,16 @@ export function MainConfigCard({
} else {
setShellTypes([]);
}
if (
(value === "SpringWebFlux" || value === "XXLJOB") &&
Number.parseInt(form.getValues("targetJdkVersion") as string) < 52
) {
form.setValue("targetJdkVersion", "52");
} else {
form.resetField("targetJdkVersion");
}
form.resetField("bypassJavaModule");
form.resetField("shellTool");
form.resetField("shellType");
}
+6 -2
View File
@@ -23,6 +23,7 @@ export function PackageConfigCard({
const [options, setOptions] = useState<Array<Option>>([]);
const shellType = form.watch("shellType");
const server = form.watch("server");
const { t } = useTranslation();
useEffect(() => {
@@ -33,7 +34,10 @@ export function PackageConfigCard({
if (shellType.startsWith("Agent")) {
return name.startsWith("Agent");
}
return !name.startsWith("Agent");
if (server.startsWith("XXL")) {
return !name.startsWith("Agent");
}
return !name.startsWith("Agent") && !name.toLowerCase().startsWith("xxl");
});
setOptions(
filteredOptions.map((name) => {
@@ -46,7 +50,7 @@ export function PackageConfigCard({
if (filteredOptions.length > 0) {
form.setValue("packingMethod", filteredOptions[0]);
}
}, [form, packerConfig, shellType, t]);
}, [form, packerConfig, server, shellType, t]);
return (
<Card className="w-full">
+33 -8
View File
@@ -78,6 +78,26 @@ function AgentResult({ packResult, generateResult }: { packResult: string; gener
);
}
function JarResult({ packResult, generateResult }: { packResult: string; generateResult?: GenerateResult }) {
const { t } = useTranslation();
return (
<div className="flex items-center justify-center">
<Button
type="button"
onClick={() =>
downloadBytes(
packResult,
undefined,
`${generateResult?.shellConfig.server}${generateResult?.shellConfig.shellTool}MemShell`,
)
}
>
{t("download")} Jar
</Button>
</div>
);
}
function FeedbackAlert() {
const { t } = useTranslation();
return (
@@ -206,6 +226,7 @@ export function ShellResult({
}: { packResult: string; packMethod: string; generateResult?: GenerateResult }) {
const showCode = packMethod === "JSP";
const isAgent = packMethod.startsWith("Agent");
const isJar = packMethod === "Jar";
const { t } = useTranslation();
return (
<Fragment>
@@ -220,16 +241,20 @@ export function ShellResult({
<div className="mb-4">
<BasicInfo generateResult={generateResult} />
</div>
{!isAgent && (
<CodeViewer
code={packResult}
wrapLongLines={!showCode}
showLineNumbers={showCode}
language={showCode ? "java" : "text"}
height={400}
/>
{!isAgent && !isJar && (
<Fragment>
<div className="flex items-center justify-end text-sm text-muted-foreground">({packResult.length})</div>
<CodeViewer
code={packResult}
wrapLongLines={!showCode}
showLineNumbers={showCode}
language={showCode ? "java" : "text"}
height={400}
/>
</Fragment>
)}
{isAgent && <AgentResult packResult={packResult} generateResult={generateResult} />}
{isJar && <JarResult packResult={packResult} generateResult={generateResult} />}
</TabsContent>
<TabsContent value="shell" className="mt-4">
<Alert>
+4 -9
View File
@@ -46,9 +46,10 @@ export const resources = {
title: "Package Method",
packer: {
Base64: "Base64",
GzipBase64: "GzipBase64",
BCEL: "BCEL",
JSP: "JSP",
JAR: "JAR",
Jar: "Jar",
EL: "EL",
SpEL: "SpEL",
OGNL: "OGNL",
@@ -59,6 +60,8 @@ export const resources = {
AgentJar: "AgentJar",
Deserialize: "Deserialize(Only CB4, 1.9.x)",
ScriptEngine: "ScriptEngine",
XxlJob: "XXL-JOB Executor",
XxlJob230: "XXL-JOB (2.3.0+) Executor",
},
},
tips: {
@@ -154,18 +157,10 @@ export const resources = {
packageConfig: {
title: "打包方式",
packer: {
Base64: "Base64",
BCEL: "BCEL",
JSP: "JSP",
JAR: "JAR",
EL: "EL 表达式",
SpEL: "SpEL 表达式",
OGNL: "OGNL 表达式",
MVEL: "MVEL 表达式",
Freemarker: "Freemarker",
Velocity: "Velocity",
Groovy: "Groovy",
AgentJar: "AgentJar",
Deserialize: "反序列化(仅支持 CB4, 1.9.x)",
ScriptEngine: "脚本引擎",
},