From db13e10e9fa476b3f3d09b2f50d1411fefb68bbc Mon Sep 17 00:00:00 2001 From: Alexis Tyler Date: Fri, 30 Apr 2021 07:38:47 +0930 Subject: [PATCH] fix: ensure regTy is always uppercase --- app/core/states/var.ts | 2 +- app/core/types/states/var.ts | 2 +- app/graphql/schema/types/vars/vars.graphql | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/core/states/var.ts b/app/core/states/var.ts index c957755b6..ee59e9bd4 100644 --- a/app/core/states/var.ts +++ b/app/core/states/var.ts @@ -261,7 +261,7 @@ const parse = (state: VarIni): Var => { portssl: toNumber(state.portssl), porttelnet: toNumber(state.porttelnet), regCheck: state.regCheck === '' ? 'Valid' : 'Error', - regTy: ['Basic', 'Plus', 'Pro'].includes(state.regTy) ? state.regTy : 'Invalid', + regTy: (['Basic', 'Plus', 'Pro'].includes(state.regTy) ? state.regTy : 'Invalid').toUpperCase(), // Make sure to use a || not a ?? as regCheck can be an empty string regState: (state.regCheck || state.regTy).toUpperCase(), safeMode: iniBooleanToJsBoolean(state.safeMode), diff --git a/app/core/types/states/var.ts b/app/core/types/states/var.ts index 0c5a9672e..1a1459d36 100644 --- a/app/core/types/states/var.ts +++ b/app/core/types/states/var.ts @@ -6,7 +6,7 @@ // @todo: remove string and add rest of the options type FsType = 'xfs' | string; type RegistrationCheck = 'Error' | 'Valid'; -type RegistrationType = 'Invalid' | 'Basic' | 'Plus' | 'Pro' | string; +type RegistrationType = 'INVALID' | 'BASIC' | 'PLUS' | 'PRO' | string; /** * Global vars diff --git a/app/graphql/schema/types/vars/vars.graphql b/app/graphql/schema/types/vars/vars.graphql index 821e758ec..50014722d 100644 --- a/app/graphql/schema/types/vars/vars.graphql +++ b/app/graphql/schema/types/vars/vars.graphql @@ -176,13 +176,13 @@ enum mdState { enum registrationType { """Basic""" - Basic + BASIC """Plus""" - Plus + PLUS """Pro""" - Pro - """Invalid""" - Invalid + PRO + """nvalid""" + INVALID } enum registrationState {