mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 23:11:52 +08:00
refactor: simplify server options
This commit is contained in:
@@ -6,6 +6,7 @@ import { ShellToolType } from "./shell";
|
||||
|
||||
export const formSchema = yup.object({
|
||||
server: yup.string().required().min(1),
|
||||
serverVersion: yup.string().required().min(1),
|
||||
targetJdkVersion: yup.string().optional(),
|
||||
debug: yup.boolean().optional(),
|
||||
bypassJavaModule: yup.boolean().optional(),
|
||||
@@ -59,6 +60,7 @@ export const useYupValidationResolver = (validationSchema: yup.ObjectSchema<any>
|
||||
|
||||
const urlPattern: keyof FormSchema = "urlPattern";
|
||||
const shellClassBase64: keyof FormSchema = "shellClassBase64";
|
||||
const serverVersion: keyof FormSchema = "serverVersion";
|
||||
const errors = {} as any;
|
||||
|
||||
if (urlPatternIsNeeded(values?.shellType) && isInvalidUrl(values?.urlPattern)) {
|
||||
@@ -73,6 +75,12 @@ export const useYupValidationResolver = (validationSchema: yup.ObjectSchema<any>
|
||||
message: t("tips.customShellClass"),
|
||||
};
|
||||
}
|
||||
if (values.server === "TongWeb" && values.shellType === "Valve" && values.serverVersion === "unknown") {
|
||||
errors[serverVersion] = {
|
||||
type: "custom",
|
||||
message: t("tips.serverVersion"),
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
values,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export interface ShellConfig {
|
||||
server: string;
|
||||
serverVersion: string;
|
||||
shellTool: string;
|
||||
shellType: string;
|
||||
targetJreVersion?: string;
|
||||
|
||||
Reference in New Issue
Block a user