From e00349c73e2a9db848883c9722dfa992507c4458 Mon Sep 17 00:00:00 2001 From: GZTime Date: Thu, 11 May 2023 18:59:26 +0800 Subject: [PATCH] fix: global config can not be updated --- src/GZCTF/ClientApp/package.json | 6 +- src/GZCTF/ClientApp/pnpm-lock.yaml | 104 +++++++++--------- .../ClientApp/src/pages/admin/Configs.tsx | 5 +- src/GZCTF/ClientApp/src/utils/useConfig.ts | 1 - src/GZCTF/ClientApp/src/utils/useRecaptcha.ts | 1 - 5 files changed, 58 insertions(+), 59 deletions(-) diff --git a/src/GZCTF/ClientApp/package.json b/src/GZCTF/ClientApp/package.json index 3b1422678..f5a1ea567 100644 --- a/src/GZCTF/ClientApp/package.json +++ b/src/GZCTF/ClientApp/package.json @@ -53,8 +53,8 @@ "@types/react": "^18.2.6", "@types/react-dom": "^18.2.4", "@types/react-pdf": "^6.2.0", - "@typescript-eslint/eslint-plugin": "^5.59.2", - "@typescript-eslint/parser": "^5.59.2", + "@typescript-eslint/eslint-plugin": "^5.59.5", + "@typescript-eslint/parser": "^5.59.5", "@vitejs/plugin-react": "^3.1.0", "axios": "^1.4.0", "babel-plugin-prismjs": "^2.1.0", @@ -62,7 +62,7 @@ "form-data": "~4.0.0", "lodash": "^4.17.21", "prettier": "~2.8.8", - "rollup": "^3.21.5", + "rollup": "^3.21.6", "swagger-typescript-api": "^12.0.4", "tslib": "^2.5.0", "typescript": "5.0.3", diff --git a/src/GZCTF/ClientApp/pnpm-lock.yaml b/src/GZCTF/ClientApp/pnpm-lock.yaml index e5c0be719..261a4ad23 100644 --- a/src/GZCTF/ClientApp/pnpm-lock.yaml +++ b/src/GZCTF/ClientApp/pnpm-lock.yaml @@ -127,11 +127,11 @@ devDependencies: specifier: ^6.2.0 version: 6.2.0 '@typescript-eslint/eslint-plugin': - specifier: ^5.59.2 - version: 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.37.0)(typescript@5.0.3) + specifier: ^5.59.5 + version: 5.59.5(@typescript-eslint/parser@5.59.5)(eslint@8.37.0)(typescript@5.0.3) '@typescript-eslint/parser': - specifier: ^5.59.2 - version: 5.59.2(eslint@8.37.0)(typescript@5.0.3) + specifier: ^5.59.5 + version: 5.59.5(eslint@8.37.0)(typescript@5.0.3) '@vitejs/plugin-react': specifier: ^3.1.0 version: 3.1.0(vite@4.3.5) @@ -154,8 +154,8 @@ devDependencies: specifier: ~2.8.8 version: 2.8.8 rollup: - specifier: ^3.21.5 - version: 3.21.5 + specifier: ^3.21.6 + version: 3.21.6 swagger-typescript-api: specifier: ^12.0.4 version: 12.0.4 @@ -983,7 +983,7 @@ packages: abort-controller: 3.0.0 eventsource: 2.0.2 fetch-cookie: 2.1.0 - node-fetch: 2.6.9 + node-fetch: 2.6.11 ws: 7.5.9 transitivePeerDependencies: - bufferutil @@ -1238,16 +1238,16 @@ packages: /@types/scheduler@0.16.3: resolution: {integrity: sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==} - /@types/semver@7.3.13: - resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==} + /@types/semver@7.5.0: + resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==} dev: true /@types/swagger-schema-official@2.0.22: resolution: {integrity: sha512-7yQiX6MWSFSvc/1wW5smJMZTZ4fHOd+hqLr3qr/HONDxHEa2bnYAsOcGBOEqFIjd4yetwMOdEDdeW+udRAQnHA==} dev: true - /@typescript-eslint/eslint-plugin@5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.37.0)(typescript@5.0.3): - resolution: {integrity: sha512-yVrXupeHjRxLDcPKL10sGQ/QlVrA8J5IYOEWVqk0lJaSZP7X5DfnP7Ns3cc74/blmbipQ1htFNVGsHX6wsYm0A==} + /@typescript-eslint/eslint-plugin@5.59.5(@typescript-eslint/parser@5.59.5)(eslint@8.37.0)(typescript@5.0.3): + resolution: {integrity: sha512-feA9xbVRWJZor+AnLNAr7A8JRWeZqHUf4T9tlP+TN04b05pFVhO5eN7/O93Y/1OUlLMHKbnJisgDURs/qvtqdg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -1258,10 +1258,10 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.5.1 - '@typescript-eslint/parser': 5.59.2(eslint@8.37.0)(typescript@5.0.3) - '@typescript-eslint/scope-manager': 5.59.2 - '@typescript-eslint/type-utils': 5.59.2(eslint@8.37.0)(typescript@5.0.3) - '@typescript-eslint/utils': 5.59.2(eslint@8.37.0)(typescript@5.0.3) + '@typescript-eslint/parser': 5.59.5(eslint@8.37.0)(typescript@5.0.3) + '@typescript-eslint/scope-manager': 5.59.5 + '@typescript-eslint/type-utils': 5.59.5(eslint@8.37.0)(typescript@5.0.3) + '@typescript-eslint/utils': 5.59.5(eslint@8.37.0)(typescript@5.0.3) debug: 4.3.4 eslint: 8.37.0 grapheme-splitter: 1.0.4 @@ -1274,8 +1274,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@5.59.2(eslint@8.37.0)(typescript@5.0.3): - resolution: {integrity: sha512-uq0sKyw6ao1iFOZZGk9F8Nro/8+gfB5ezl1cA06SrqbgJAt0SRoFhb9pXaHvkrxUpZaoLxt8KlovHNk8Gp6/HQ==} + /@typescript-eslint/parser@5.59.5(eslint@8.37.0)(typescript@5.0.3): + resolution: {integrity: sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -1284,9 +1284,9 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.59.2 - '@typescript-eslint/types': 5.59.2 - '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.0.3) + '@typescript-eslint/scope-manager': 5.59.5 + '@typescript-eslint/types': 5.59.5 + '@typescript-eslint/typescript-estree': 5.59.5(typescript@5.0.3) debug: 4.3.4 eslint: 8.37.0 typescript: 5.0.3 @@ -1294,16 +1294,16 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager@5.59.2: - resolution: {integrity: sha512-dB1v7ROySwQWKqQ8rEWcdbTsFjh2G0vn8KUyvTXdPoyzSL6lLGkiXEV5CvpJsEe9xIdKV+8Zqb7wif2issoOFA==} + /@typescript-eslint/scope-manager@5.59.5: + resolution: {integrity: sha512-jVecWwnkX6ZgutF+DovbBJirZcAxgxC0EOHYt/niMROf8p4PwxxG32Qdhj/iIQQIuOflLjNkxoXyArkcIP7C3A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.59.2 - '@typescript-eslint/visitor-keys': 5.59.2 + '@typescript-eslint/types': 5.59.5 + '@typescript-eslint/visitor-keys': 5.59.5 dev: true - /@typescript-eslint/type-utils@5.59.2(eslint@8.37.0)(typescript@5.0.3): - resolution: {integrity: sha512-b1LS2phBOsEy/T381bxkkywfQXkV1dWda/z0PhnIy3bC5+rQWQDS7fk9CSpcXBccPY27Z6vBEuaPBCKCgYezyQ==} + /@typescript-eslint/type-utils@5.59.5(eslint@8.37.0)(typescript@5.0.3): + resolution: {integrity: sha512-4eyhS7oGym67/pSxA2mmNq7X164oqDYNnZCUayBwJZIRVvKpBCMBzFnFxjeoDeShjtO6RQBHBuwybuX3POnDqg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -1312,8 +1312,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.0.3) - '@typescript-eslint/utils': 5.59.2(eslint@8.37.0)(typescript@5.0.3) + '@typescript-eslint/typescript-estree': 5.59.5(typescript@5.0.3) + '@typescript-eslint/utils': 5.59.5(eslint@8.37.0)(typescript@5.0.3) debug: 4.3.4 eslint: 8.37.0 tsutils: 3.21.0(typescript@5.0.3) @@ -1322,13 +1322,13 @@ packages: - supports-color dev: true - /@typescript-eslint/types@5.59.2: - resolution: {integrity: sha512-LbJ/HqoVs2XTGq5shkiKaNTuVv5tTejdHgfdjqRUGdYhjW1crm/M7og2jhVskMt8/4wS3T1+PfFvL1K3wqYj4w==} + /@typescript-eslint/types@5.59.5: + resolution: {integrity: sha512-xkfRPHbqSH4Ggx4eHRIO/eGL8XL4Ysb4woL8c87YuAo8Md7AUjyWKa9YMwTL519SyDPrfEgKdewjkxNCVeJW7w==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree@5.59.2(typescript@5.0.3): - resolution: {integrity: sha512-+j4SmbwVmZsQ9jEyBMgpuBD0rKwi9RxRpjX71Brr73RsYnEr3Lt5QZ624Bxphp8HUkSKfqGnPJp1kA5nl0Sh7Q==} + /@typescript-eslint/typescript-estree@5.59.5(typescript@5.0.3): + resolution: {integrity: sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -1336,8 +1336,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.59.2 - '@typescript-eslint/visitor-keys': 5.59.2 + '@typescript-eslint/types': 5.59.5 + '@typescript-eslint/visitor-keys': 5.59.5 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -1348,18 +1348,18 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@5.59.2(eslint@8.37.0)(typescript@5.0.3): - resolution: {integrity: sha512-kSuF6/77TZzyGPhGO4uVp+f0SBoYxCDf+lW3GKhtKru/L8k/Hd7NFQxyWUeY7Z/KGB2C6Fe3yf2vVi4V9TsCSQ==} + /@typescript-eslint/utils@5.59.5(eslint@8.37.0)(typescript@5.0.3): + resolution: {integrity: sha512-sCEHOiw+RbyTii9c3/qN74hYDPNORb8yWCoPLmB7BIflhplJ65u2PBpdRla12e3SSTJ2erRkPjz7ngLHhUegxA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.37.0) '@types/json-schema': 7.0.11 - '@types/semver': 7.3.13 - '@typescript-eslint/scope-manager': 5.59.2 - '@typescript-eslint/types': 5.59.2 - '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.0.3) + '@types/semver': 7.5.0 + '@typescript-eslint/scope-manager': 5.59.5 + '@typescript-eslint/types': 5.59.5 + '@typescript-eslint/typescript-estree': 5.59.5(typescript@5.0.3) eslint: 8.37.0 eslint-scope: 5.1.1 semver: 7.5.0 @@ -1368,11 +1368,11 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys@5.59.2: - resolution: {integrity: sha512-EEpsO8m3RASrKAHI9jpavNv9NlEUebV4qmF1OWxSTtKSFBpC1NCmWazDQHFivRf0O1DV11BA645yrLEVQ0/Lig==} + /@typescript-eslint/visitor-keys@5.59.5: + resolution: {integrity: sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.59.2 + '@typescript-eslint/types': 5.59.5 eslint-visitor-keys: 3.4.1 dev: true @@ -1528,7 +1528,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001486 - electron-to-chromium: 1.4.385 + electron-to-chromium: 1.4.391 node-releases: 2.0.10 update-browserslist-db: 1.0.11(browserslist@4.21.5) @@ -1780,8 +1780,8 @@ packages: zrender: 5.4.3 dev: false - /electron-to-chromium@1.4.385: - resolution: {integrity: sha512-L9zlje9bIw0h+CwPQumiuVlfMcV4boxRjFIWDcLfFqTZNbkwOExBzfmswytHawObQX4OUhtNv8gIiB21kOurIg==} + /electron-to-chromium@1.4.391: + resolution: {integrity: sha512-GqydVV1+kUWY5qlEzaw34/hyWTApuQrHiGrcGA2Kk/56nEK44i+YUW45VH43JuZT0Oo7uY8aVtpPhBBZXEWtSA==} /embla-carousel-autoplay@7.1.0(embla-carousel@7.1.0): resolution: {integrity: sha512-nYfgSGn3ek44OzwO0t/Ptuxq4PNPD5l7Y9X7JjLYI/DN1uGjqxz9L73YYqR6YCRDnTYJ88s9fep48dzBnSG4vQ==} @@ -2699,8 +2699,8 @@ packages: http2-client: 1.3.5 dev: true - /node-fetch@2.6.9: - resolution: {integrity: sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==} + /node-fetch@2.6.11: + resolution: {integrity: sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==} engines: {node: 4.x || >=6.0.0} peerDependencies: encoding: ^0.1.0 @@ -3170,8 +3170,8 @@ packages: glob: 7.2.3 dev: true - /rollup@3.21.5: - resolution: {integrity: sha512-a4NTKS4u9PusbUJcfF4IMxuqjFzjm6ifj76P54a7cKnvVzJaG12BLVR+hgU2YDGHzyMMQNxLAZWuALsn8q2oQg==} + /rollup@3.21.6: + resolution: {integrity: sha512-SXIICxvxQxR3D4dp/3LDHZIJPC8a4anKMHd4E3Jiz2/JnY+2bEjqrOokAauc5ShGVNFHlEFjBXAXlaxkJqIqSg==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: @@ -3366,7 +3366,7 @@ packages: hasBin: true dependencies: call-me-maybe: 1.0.2 - node-fetch: 2.6.9 + node-fetch: 2.6.11 node-fetch-h2: 2.3.0 node-readfiles: 0.2.0 oas-kit-common: 1.0.8 @@ -3681,7 +3681,7 @@ packages: '@types/node': 18.15.11 esbuild: 0.17.18 postcss: 8.4.23 - rollup: 3.21.5 + rollup: 3.21.6 optionalDependencies: fsevents: 2.3.2 diff --git a/src/GZCTF/ClientApp/src/pages/admin/Configs.tsx b/src/GZCTF/ClientApp/src/pages/admin/Configs.tsx index 70defab0f..391be5172 100644 --- a/src/GZCTF/ClientApp/src/pages/admin/Configs.tsx +++ b/src/GZCTF/ClientApp/src/pages/admin/Configs.tsx @@ -6,15 +6,16 @@ import AdminPage from '@Components/admin/AdminPage' import { SwitchLabel } from '@Components/admin/SwitchLabel' import { showErrorNotification } from '@Utils/ApiErrorHandler' import { useFixedButtonStyles } from '@Utils/ThemeOverride' +import { useConfig } from '@Utils/useConfig' import api, { AccountPolicy, ConfigEditModel, GlobalConfig } from '@Api' const Configs: FC = () => { const { data: configs, mutate } = api.admin.useAdminGetConfigs({ refreshInterval: 0, - revalidateIfStale: false, revalidateOnFocus: false, }) + const { mutate: mutateConfig } = useConfig() const [disabled, setDisabled] = useState(false) const [globalConfig, setGlobalConfig] = useState() const [accountPolicy, setAccountPolicy] = useState() @@ -40,7 +41,7 @@ const Configs: FC = () => { }) .catch(showErrorNotification) .finally(() => { - api.info.mutateInfoGetGlobalConfig() + mutateConfig({ ...conf.globalConfig }) setDisabled(false) }) } diff --git a/src/GZCTF/ClientApp/src/utils/useConfig.ts b/src/GZCTF/ClientApp/src/utils/useConfig.ts index 0e89ac6a1..8070997ff 100644 --- a/src/GZCTF/ClientApp/src/utils/useConfig.ts +++ b/src/GZCTF/ClientApp/src/utils/useConfig.ts @@ -18,7 +18,6 @@ export const useConfig = () => { mutate, } = api.info.useInfoGetGlobalConfig({ refreshInterval: 0, - revalidateIfStale: false, revalidateOnFocus: false, revalidateOnReconnect: false, refreshWhenHidden: false, diff --git a/src/GZCTF/ClientApp/src/utils/useRecaptcha.ts b/src/GZCTF/ClientApp/src/utils/useRecaptcha.ts index 6af027f19..3aa4771e7 100644 --- a/src/GZCTF/ClientApp/src/utils/useRecaptcha.ts +++ b/src/GZCTF/ClientApp/src/utils/useRecaptcha.ts @@ -52,7 +52,6 @@ const loadReCaptcha = (siteKey: string) => { export const useReCaptcha = (action: string) => { const { data: sitekey, error } = api.info.useInfoGetRecaptchaSiteKey({ refreshInterval: 0, - revalidateIfStale: false, revalidateOnFocus: false, revalidateOnReconnect: false, refreshWhenHidden: false,