From 75d7e3d284c73e783de187d6786726e5e4eabd69 Mon Sep 17 00:00:00 2001 From: GZTime Date: Mon, 25 Nov 2024 18:25:05 +0800 Subject: [PATCH] feat(scoreboard): export user email in scoreboard table --- src/GZCTF.Test/GZCTF.Test.csproj | 62 ++++++++++++------------------ src/GZCTF/ClientApp/package.json | 4 +- src/GZCTF/ClientApp/pnpm-lock.yaml | 16 ++++---- src/GZCTF/GZCTF.csproj | 20 ++-------- src/GZCTF/Program.cs | 1 + src/GZCTF/Utils/ExcelHelper.cs | 18 +++++---- 6 files changed, 50 insertions(+), 71 deletions(-) diff --git a/src/GZCTF.Test/GZCTF.Test.csproj b/src/GZCTF.Test/GZCTF.Test.csproj index 8ec3a4412..2a1cf1436 100644 --- a/src/GZCTF.Test/GZCTF.Test.csproj +++ b/src/GZCTF.Test/GZCTF.Test.csproj @@ -1,42 +1,28 @@  + + net9.0 + enable + false + true + Debug;Release;GenAPI + 1.0.2 + True + 4 + - - net9.0 - enable - false - true - Debug;Release;GenAPI - 1.0.2 - True - 4 - - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - + + + + + + + + + + + + + + diff --git a/src/GZCTF/ClientApp/package.json b/src/GZCTF/ClientApp/package.json index 07af23da8..3d6e7a418 100644 --- a/src/GZCTF/ClientApp/package.json +++ b/src/GZCTF/ClientApp/package.json @@ -9,7 +9,7 @@ "build": "tsc && vite build", "preview": "vite preview", "prettier": "prettier --write src", - "genapi": "swagger-typescript-api -p http://localhost:55000/swagger/v1/swagger.json -t template -o src --module-name-first-tag --sort-routes" + "genapi": "swagger-typescript-api -p http://localhost:55000/openapi/v1.json -t template -o src --module-name-first-tag --sort-routes" }, "dependencies": { "@babel/core": "^7.26.0", @@ -36,7 +36,7 @@ "embla-carousel": "^8.5.1", "embla-carousel-autoplay": "^8.5.1", "embla-carousel-react": "^8.5.1", - "i18next": "^24.0.0", + "i18next": "^24.0.1", "i18next-browser-languagedetector": "^8.0.0", "katex": "^0.16.11", "lz-string": "^1.5.0", diff --git a/src/GZCTF/ClientApp/pnpm-lock.yaml b/src/GZCTF/ClientApp/pnpm-lock.yaml index 9abde31c5..dcd037eea 100644 --- a/src/GZCTF/ClientApp/pnpm-lock.yaml +++ b/src/GZCTF/ClientApp/pnpm-lock.yaml @@ -84,8 +84,8 @@ importers: specifier: ^8.5.1 version: 8.5.1(react@18.3.1) i18next: - specifier: ^24.0.0 - version: 24.0.0(typescript@5.7.2) + specifier: ^24.0.1 + version: 24.0.1(typescript@5.7.2) i18next-browser-languagedetector: specifier: ^8.0.0 version: 8.0.0 @@ -121,7 +121,7 @@ importers: version: 1.10.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-i18next: specifier: ^15.1.1 - version: 15.1.1(i18next@24.0.0(typescript@5.7.2))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 15.1.1(i18next@24.0.1(typescript@5.7.2))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-pdf: specifier: ^9.1.1 version: 9.1.1(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -1723,8 +1723,8 @@ packages: i18next-browser-languagedetector@8.0.0: resolution: {integrity: sha512-zhXdJXTTCoG39QsrOCiOabnWj2jecouOqbchu3EfhtSHxIB5Uugnm9JaizenOy39h7ne3+fLikIjeW88+rgszw==} - i18next@24.0.0: - resolution: {integrity: sha512-ORGCwMrXxpmB/AljFbGEe0UK/9Pz6umb9aZgLZ9qJGE+kjKhlnLj423WX2mt+N0MlEJ78pQXFMBmeMzrkLxriQ==} + i18next@24.0.1: + resolution: {integrity: sha512-cB/kMidgV6sZ3+vfsUaPOgMWAFJ0kEIeMZZYqUMNtbpXx9E4Nrn+nkkeeSOBk5iZYvjsz8+ZOX39msw19b9klQ==} peerDependencies: typescript: ^5 peerDependenciesMeta: @@ -4609,7 +4609,7 @@ snapshots: dependencies: '@babel/runtime': 7.26.0 - i18next@24.0.0(typescript@5.7.2): + i18next@24.0.1(typescript@5.7.2): dependencies: '@babel/runtime': 7.26.0 optionalDependencies: @@ -5109,11 +5109,11 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - react-i18next@15.1.1(i18next@24.0.0(typescript@5.7.2))(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + react-i18next@15.1.1(i18next@24.0.1(typescript@5.7.2))(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@babel/runtime': 7.26.0 html-parse-stringify: 3.0.1 - i18next: 24.0.0(typescript@5.7.2) + i18next: 24.0.1(typescript@5.7.2) react: 18.3.1 optionalDependencies: react-dom: 18.3.1(react@18.3.1) diff --git a/src/GZCTF/GZCTF.csproj b/src/GZCTF/GZCTF.csproj index 7dba5634f..bd1ac7bc7 100644 --- a/src/GZCTF/GZCTF.csproj +++ b/src/GZCTF/GZCTF.csproj @@ -28,10 +28,7 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + @@ -43,22 +40,13 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/GZCTF/Program.cs b/src/GZCTF/Program.cs index fd59a4b67..5f20a8012 100644 --- a/src/GZCTF/Program.cs +++ b/src/GZCTF/Program.cs @@ -345,6 +345,7 @@ options.PostProcess += (document, _) => document.Servers.Clear(); options.Path = "/openapi/{documentName}.json"; }); + // open ui in `/scalar/v1` app.MapScalarApiReference(); } else diff --git a/src/GZCTF/Utils/ExcelHelper.cs b/src/GZCTF/Utils/ExcelHelper.cs index 2665ad4cd..6dac31334 100644 --- a/src/GZCTF/Utils/ExcelHelper.cs +++ b/src/GZCTF/Utils/ExcelHelper.cs @@ -13,6 +13,7 @@ public class ExcelHelper(IStringLocalizer localizer) localizer[nameof(Resources.Program.Header_Team)], localizer[nameof(Resources.Program.Header_Captain)], localizer[nameof(Resources.Program.Header_Member)], + localizer[nameof(Resources.Program.Header_Email)], localizer[nameof(Resources.Program.Header_StdNumber)], localizer[nameof(Resources.Program.Header_PhoneNumber)], localizer[nameof(Resources.Program.Header_SolvedNumber)], @@ -93,14 +94,15 @@ void WriteSubmissionContent(ISheet sheet, IEnumerable submissions) foreach (Submission item in submissions) { + var colIndex = 0; IRow? row = sheet.CreateRow(rowIndex); - row.CreateCell(0).SetCellValue(item.Status.ToShortString(localizer)); - row.CreateCell(1).SetCellValue(item.SubmitTimeUtc.ToString("u")); - row.CreateCell(2).SetCellValue(item.TeamName); - row.CreateCell(3).SetCellValue(item.UserName); - row.CreateCell(4).SetCellValue(item.ChallengeName); - row.CreateCell(5).SetCellValue(item.Answer); - row.CreateCell(6).SetCellValue(item.User?.Email ?? string.Empty); + row.CreateCell(colIndex++).SetCellValue(item.Status.ToShortString(localizer)); + row.CreateCell(colIndex++).SetCellValue(item.SubmitTimeUtc.ToString("u")); + row.CreateCell(colIndex++).SetCellValue(item.TeamName); + row.CreateCell(colIndex++).SetCellValue(item.UserName); + row.CreateCell(colIndex++).SetCellValue(item.ChallengeName); + row.CreateCell(colIndex++).SetCellValue(item.Answer); + row.CreateCell(colIndex).SetCellValue(item.User?.Email ?? string.Empty); rowIndex++; } @@ -160,6 +162,8 @@ static void WriteBoardContent(ISheet sheet, ScoreboardModel scoreboard, int[] ch row.CreateCell(colIndex++) .SetCellValue(string.Join(Split, members.Select(m => TakeIfNotEmpty(m.RealName)))); + row.CreateCell(colIndex++) + .SetCellValue(string.Join(Split, members.Select(m => TakeIfNotEmpty(m.Email)))); row.CreateCell(colIndex++) .SetCellValue(string.Join(Split, members.Select(m => TakeIfNotEmpty(m.StdNumber)))); row.CreateCell(colIndex++)