From fe589ad6a1cfcc50f13d42478731287710e72973 Mon Sep 17 00:00:00 2001 From: GZTime Date: Tue, 23 Apr 2024 03:13:23 +0800 Subject: [PATCH] fix(mail): DO NOT use `IStringLocalizer` after construction --- src/GZCTF/ClientApp/package.json | 8 +- src/GZCTF/ClientApp/pnpm-lock.yaml | 280 ++++++++++++++--------------- src/GZCTF/Resources/Program.resx | 2 +- src/GZCTF/Services/MailSender.cs | 93 +++++----- 4 files changed, 193 insertions(+), 190 deletions(-) diff --git a/src/GZCTF/ClientApp/package.json b/src/GZCTF/ClientApp/package.json index 18fe66fc6..3a3541795 100644 --- a/src/GZCTF/ClientApp/package.json +++ b/src/GZCTF/ClientApp/package.json @@ -60,8 +60,8 @@ "@types/prismjs": "^1.26.3", "@types/react": "^18.2.79", "@types/react-dom": "^18.2.25", - "@typescript-eslint/eslint-plugin": "^7.7.0", - "@typescript-eslint/parser": "^7.7.0", + "@typescript-eslint/eslint-plugin": "^7.7.1", + "@typescript-eslint/parser": "^7.7.1", "@vitejs/plugin-react": "^4.2.1", "axios": "^1.6.8", "babel-plugin-prismjs": "^2.1.0", @@ -70,11 +70,11 @@ "form-data": "~4.0.0", "lodash": "^4.17.21", "prettier": "~3.2.5", - "rollup": "=4.14.3", + "rollup": "^4.16.2", "swagger-typescript-api": "^13.0.3", "tslib": "^2.6.2", "typescript": "5.4.5", - "vite": "=5.2.9", + "vite": "^5.2.10", "vite-plugin-pages": "^0.32.1", "vite-plugin-prismjs": "^0.0.11", "vite-plugin-webfont-dl": "^3.9.3", diff --git a/src/GZCTF/ClientApp/pnpm-lock.yaml b/src/GZCTF/ClientApp/pnpm-lock.yaml index 6d84b3ec7..e8d1931cb 100644 --- a/src/GZCTF/ClientApp/pnpm-lock.yaml +++ b/src/GZCTF/ClientApp/pnpm-lock.yaml @@ -125,10 +125,10 @@ importers: version: 7.24.1(@babel/core@7.24.4)(eslint@8.57.0) '@kainstar/vite-plugin-i18next-loader': specifier: ^1.0.3 - version: 1.0.3(vite@5.2.9(@types/node@20.12.7)) + version: 1.0.3(vite@5.2.10(@types/node@20.12.7)) '@nabla/vite-plugin-eslint': specifier: ^2.0.4 - version: 2.0.4(eslint@8.57.0)(vite@5.2.9(@types/node@20.12.7)) + version: 2.0.4(eslint@8.57.0)(vite@5.2.10(@types/node@20.12.7)) '@trivago/prettier-plugin-sort-imports': specifier: ^4.3.0 version: 4.3.0(prettier@3.2.5) @@ -148,14 +148,14 @@ importers: specifier: ^18.2.25 version: 18.2.25 '@typescript-eslint/eslint-plugin': - specifier: ^7.7.0 - version: 7.7.0(@typescript-eslint/parser@7.7.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5) + specifier: ^7.7.1 + version: 7.7.1(@typescript-eslint/parser@7.7.1(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5) '@typescript-eslint/parser': - specifier: ^7.7.0 - version: 7.7.0(eslint@8.57.0)(typescript@5.4.5) + specifier: ^7.7.1 + version: 7.7.1(eslint@8.57.0)(typescript@5.4.5) '@vitejs/plugin-react': specifier: ^4.2.1 - version: 4.2.1(vite@5.2.9(@types/node@20.12.7)) + version: 4.2.1(vite@5.2.10(@types/node@20.12.7)) axios: specifier: ^1.6.8 version: 1.6.8 @@ -178,8 +178,8 @@ importers: specifier: ~3.2.5 version: 3.2.5 rollup: - specifier: '=4.14.3' - version: 4.14.3 + specifier: ^4.16.2 + version: 4.16.2 swagger-typescript-api: specifier: ^13.0.3 version: 13.0.3 @@ -190,20 +190,20 @@ importers: specifier: 5.4.5 version: 5.4.5 vite: - specifier: '=5.2.9' - version: 5.2.9(@types/node@20.12.7) + specifier: ^5.2.10 + version: 5.2.10(@types/node@20.12.7) vite-plugin-pages: specifier: ^0.32.1 - version: 0.32.1(vite@5.2.9(@types/node@20.12.7)) + version: 0.32.1(vite@5.2.10(@types/node@20.12.7)) vite-plugin-prismjs: specifier: ^0.0.11 version: 0.0.11(prismjs@1.29.0) vite-plugin-webfont-dl: specifier: ^3.9.3 - version: 3.9.3(vite@5.2.9(@types/node@20.12.7)) + version: 3.9.3(vite@5.2.10(@types/node@20.12.7)) vite-tsconfig-paths: specifier: ^4.3.2 - version: 4.3.2(typescript@5.4.5)(vite@5.2.9(@types/node@20.12.7)) + version: 4.3.2(typescript@5.4.5)(vite@5.2.10(@types/node@20.12.7)) packages: @@ -819,83 +819,83 @@ packages: resolution: {integrity: sha512-Oy8rmScVrVxWZVOpEF57ovlnhpZ8CCPlnIIumVcV9nFdiSIrus99+Lw78ekXyGvVDlIsFJbSfmSovJUhCWYV3w==} engines: {node: '>=14.0.0'} - '@rollup/rollup-android-arm-eabi@4.14.3': - resolution: {integrity: sha512-X9alQ3XM6I9IlSlmC8ddAvMSyG1WuHk5oUnXGw+yUBs3BFoTizmG1La/Gr8fVJvDWAq+zlYTZ9DBgrlKRVY06g==} + '@rollup/rollup-android-arm-eabi@4.16.2': + resolution: {integrity: sha512-VGodkwtEuZ+ENPz/CpDSl091koMv8ao5jHVMbG1vNK+sbx/48/wVzP84M5xSfDAC69mAKKoEkSo+ym9bXYRK9w==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.14.3': - resolution: {integrity: sha512-eQK5JIi+POhFpzk+LnjKIy4Ks+pwJ+NXmPxOCSvOKSNRPONzKuUvWE+P9JxGZVxrtzm6BAYMaL50FFuPe0oWMQ==} + '@rollup/rollup-android-arm64@4.16.2': + resolution: {integrity: sha512-5/W1xyIdc7jw6c/f1KEtg1vYDBWnWCsLiipK41NiaWGLG93eH2edgE6EgQJ3AGiPERhiOLUqlDSfjRK08C9xFg==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.14.3': - resolution: {integrity: sha512-Od4vE6f6CTT53yM1jgcLqNfItTsLt5zE46fdPaEmeFHvPs5SjZYlLpHrSiHEKR1+HdRfxuzXHjDOIxQyC3ptBA==} + '@rollup/rollup-darwin-arm64@4.16.2': + resolution: {integrity: sha512-vOAKMqZSTbPfyPVu1jBiy+YniIQd3MG7LUnqV0dA6Q5tyhdqYtxacTHP1+S/ksKl6qCtMG1qQ0grcIgk/19JEA==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.14.3': - resolution: {integrity: sha512-0IMAO21axJeNIrvS9lSe/PGthc8ZUS+zC53O0VhF5gMxfmcKAP4ESkKOCwEi6u2asUrt4mQv2rjY8QseIEb1aw==} + '@rollup/rollup-darwin-x64@4.16.2': + resolution: {integrity: sha512-aIJVRUS3Dnj6MqocBMrcXlatKm64O3ITeQAdAxVSE9swyhNyV1dwnRgw7IGKIkDQofatd8UqMSyUxuFEa42EcA==} cpu: [x64] os: [darwin] - '@rollup/rollup-linux-arm-gnueabihf@4.14.3': - resolution: {integrity: sha512-ge2DC7tHRHa3caVEoSbPRJpq7azhG+xYsd6u2MEnJ6XzPSzQsTKyXvh6iWjXRf7Rt9ykIUWHtl0Uz3T6yXPpKw==} + '@rollup/rollup-linux-arm-gnueabihf@4.16.2': + resolution: {integrity: sha512-/bjfUiXwy3P5vYr6/ezv//Yle2Y0ak3a+Av/BKoi76nFryjWCkki8AuVoPR7ZU/ckcvAWFo77OnFK14B9B5JsA==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.14.3': - resolution: {integrity: sha512-ljcuiDI4V3ySuc7eSk4lQ9wU8J8r8KrOUvB2U+TtK0TiW6OFDmJ+DdIjjwZHIw9CNxzbmXY39wwpzYuFDwNXuw==} + '@rollup/rollup-linux-arm-musleabihf@4.16.2': + resolution: {integrity: sha512-S24b+tJHwpq2TNRz9T+r71FjMvyBBApY8EkYxz8Cwi/rhH6h+lu/iDUxyc9PuHf9UvyeBFYkWWcrDahai/NCGw==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.14.3': - resolution: {integrity: sha512-Eci2us9VTHm1eSyn5/eEpaC7eP/mp5n46gTRB3Aar3BgSvDQGJZuicyq6TsH4HngNBgVqC5sDYxOzTExSU+NjA==} + '@rollup/rollup-linux-arm64-gnu@4.16.2': + resolution: {integrity: sha512-UN7VAXLyeyGbCQWiOtQN7BqmjTDw1ON2Oos4lfk0YR7yNhFEJWZiwGtvj9Ay4lsT/ueT04sh80Sg2MlWVVZ+Ug==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.14.3': - resolution: {integrity: sha512-UrBoMLCq4E92/LCqlh+blpqMz5h1tJttPIniwUgOFJyjWI1qrtrDhhpHPuFxULlUmjFHfloWdixtDhSxJt5iKw==} + '@rollup/rollup-linux-arm64-musl@4.16.2': + resolution: {integrity: sha512-ZBKvz3+rIhQjusKMccuJiPsStCrPOtejCHxTe+yWp3tNnuPWtyCh9QLGPKz6bFNFbwbw28E2T6zDgzJZ05F1JQ==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-powerpc64le-gnu@4.14.3': - resolution: {integrity: sha512-5aRjvsS8q1nWN8AoRfrq5+9IflC3P1leMoy4r2WjXyFqf3qcqsxRCfxtZIV58tCxd+Yv7WELPcO9mY9aeQyAmw==} + '@rollup/rollup-linux-powerpc64le-gnu@4.16.2': + resolution: {integrity: sha512-LjMMFiVBRL3wOe095vHAekL4b7nQqf4KZEpdMWd3/W+nIy5o9q/8tlVKiqMbfieDypNXLsxM9fexOxd9Qcklyg==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.14.3': - resolution: {integrity: sha512-sk/Qh1j2/RJSX7FhEpJn8n0ndxy/uf0kI/9Zc4b1ELhqULVdTfN6HL31CDaTChiBAOgLcsJ1sgVZjWv8XNEsAQ==} + '@rollup/rollup-linux-riscv64-gnu@4.16.2': + resolution: {integrity: sha512-ohkPt0lKoCU0s4B6twro2aft+QROPdUiWwOjPNTzwTsBK5w+2+iT9kySdtOdq0gzWJAdiqsV4NFtXOwGZmIsHA==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.14.3': - resolution: {integrity: sha512-jOO/PEaDitOmY9TgkxF/TQIjXySQe5KVYB57H/8LRP/ux0ZoO8cSHCX17asMSv3ruwslXW/TLBcxyaUzGRHcqg==} + '@rollup/rollup-linux-s390x-gnu@4.16.2': + resolution: {integrity: sha512-jm2lvLc+/gqXfndlpDw05jKvsl/HKYxUEAt1h5UXcMFVpO4vGpoWmJVUfKDtTqSaHcCNw1his1XjkgR9aort3w==} cpu: [s390x] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.14.3': - resolution: {integrity: sha512-8ybV4Xjy59xLMyWo3GCfEGqtKV5M5gCSrZlxkPGvEPCGDLNla7v48S662HSGwRd6/2cSneMQWiv+QzcttLrrOA==} + '@rollup/rollup-linux-x64-gnu@4.16.2': + resolution: {integrity: sha512-oc5/SlITI/Vj/qL4UM+lXN7MERpiy1HEOnrE+SegXwzf7WP9bzmZd6+MDljCEZTdSY84CpvUv9Rq7bCaftn1+g==} cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.14.3': - resolution: {integrity: sha512-s+xf1I46trOY10OqAtZ5Rm6lzHre/UiLA1J2uOhCFXWkbZrJRkYBPO6FhvGfHmdtQ3Bx793MNa7LvoWFAm93bg==} + '@rollup/rollup-linux-x64-musl@4.16.2': + resolution: {integrity: sha512-/2VWEBG6mKbS2itm7hzPwhIPaxfZh/KLWrYg20pCRLHhNFtF+epLgcBtwy3m07bl/k86Q3PFRAf2cX+VbZbwzQ==} cpu: [x64] os: [linux] - '@rollup/rollup-win32-arm64-msvc@4.14.3': - resolution: {integrity: sha512-+4h2WrGOYsOumDQ5S2sYNyhVfrue+9tc9XcLWLh+Kw3UOxAvrfOrSMFon60KspcDdytkNDh7K2Vs6eMaYImAZg==} + '@rollup/rollup-win32-arm64-msvc@4.16.2': + resolution: {integrity: sha512-Wg7ANh7+hSilF0lG3e/0Oy8GtfTIfEk1327Bw8juZOMOoKmJLs3R+a4JDa/4cHJp2Gs7QfCDTepXXcyFD0ubBg==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.14.3': - resolution: {integrity: sha512-T1l7y/bCeL/kUwh9OD4PQT4aM7Bq43vX05htPJJ46RTI4r5KNt6qJRzAfNfM+OYMNEVBWQzR2Gyk+FXLZfogGw==} + '@rollup/rollup-win32-ia32-msvc@4.16.2': + resolution: {integrity: sha512-J/jCDKVMWp0Y2ELnTjpQFYUCUWv1Jr+LdFrJVZtdqGyjDo0PHPa7pCamjHvJel6zBFM3doFFqAr7cmXYWBAbfw==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.14.3': - resolution: {integrity: sha512-/BypzV0H1y1HzgYpxqRaXGBRqfodgoBBCcsrujT6QRcakDQdfU+Lq9PENPh5jB4I44YWq+0C2eHsHya+nZY1sA==} + '@rollup/rollup-win32-x64-msvc@4.16.2': + resolution: {integrity: sha512-3nIf+SJMs2ZzrCh+SKNqgLVV9hS/UY0UjT1YU8XQYFGLiUfmHYJ/5trOU1XSvmHjV5gTF/K3DjrWxtyzKKcAHA==} cpu: [x64] os: [win32] @@ -970,8 +970,8 @@ packages: '@types/swagger-schema-official@2.0.22': resolution: {integrity: sha512-7yQiX6MWSFSvc/1wW5smJMZTZ4fHOd+hqLr3qr/HONDxHEa2bnYAsOcGBOEqFIjd4yetwMOdEDdeW+udRAQnHA==} - '@typescript-eslint/eslint-plugin@7.7.0': - resolution: {integrity: sha512-GJWR0YnfrKnsRoluVO3PRb9r5aMZriiMMM/RHj5nnTrBy1/wIgk76XCtCKcnXGjpZQJQRFtGV9/0JJ6n30uwpQ==} + '@typescript-eslint/eslint-plugin@7.7.1': + resolution: {integrity: sha512-KwfdWXJBOviaBVhxO3p5TJiLpNuh2iyXyjmWN0f1nU87pwyvfS0EmjC6ukQVYVFJd/K1+0NWGPDXiyEyQorn0Q==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: '@typescript-eslint/parser': ^7.0.0 @@ -981,8 +981,8 @@ packages: typescript: optional: true - '@typescript-eslint/parser@7.7.0': - resolution: {integrity: sha512-fNcDm3wSwVM8QYL4HKVBggdIPAy9Q41vcvC/GtDobw3c4ndVT3K6cqudUmjHPw8EAp4ufax0o58/xvWaP2FmTg==} + '@typescript-eslint/parser@7.7.1': + resolution: {integrity: sha512-vmPzBOOtz48F6JAGVS/kZYk4EkXao6iGrD838sp1w3NQQC0W8ry/q641KU4PrG7AKNAf56NOcR8GOpH8l9FPCw==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 @@ -991,12 +991,12 @@ packages: typescript: optional: true - '@typescript-eslint/scope-manager@7.7.0': - resolution: {integrity: sha512-/8INDn0YLInbe9Wt7dK4cXLDYp0fNHP5xKLHvZl3mOT5X17rK/YShXaiNmorl+/U4VKCVIjJnx4Ri5b0y+HClw==} + '@typescript-eslint/scope-manager@7.7.1': + resolution: {integrity: sha512-PytBif2SF+9SpEUKynYn5g1RHFddJUcyynGpztX3l/ik7KmZEv19WCMhUBkHXPU9es/VWGD3/zg3wg90+Dh2rA==} engines: {node: ^18.18.0 || >=20.0.0} - '@typescript-eslint/type-utils@7.7.0': - resolution: {integrity: sha512-bOp3ejoRYrhAlnT/bozNQi3nio9tIgv3U5C0mVDdZC7cpcQEDZXvq8inrHYghLVwuNABRqrMW5tzAv88Vy77Sg==} + '@typescript-eslint/type-utils@7.7.1': + resolution: {integrity: sha512-ZksJLW3WF7o75zaBPScdW1Gbkwhd/lyeXGf1kQCxJaOeITscoSl0MjynVvCzuV5boUz/3fOI06Lz8La55mu29Q==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 @@ -1005,12 +1005,12 @@ packages: typescript: optional: true - '@typescript-eslint/types@7.7.0': - resolution: {integrity: sha512-G01YPZ1Bd2hn+KPpIbrAhEWOn5lQBrjxkzHkWvP6NucMXFtfXoevK82hzQdpfuQYuhkvFDeQYbzXCjR1z9Z03w==} + '@typescript-eslint/types@7.7.1': + resolution: {integrity: sha512-AmPmnGW1ZLTpWa+/2omPrPfR7BcbUU4oha5VIbSbS1a1Tv966bklvLNXxp3mrbc+P2j4MNOTfDffNsk4o0c6/w==} engines: {node: ^18.18.0 || >=20.0.0} - '@typescript-eslint/typescript-estree@7.7.0': - resolution: {integrity: sha512-8p71HQPE6CbxIBy2kWHqM1KGrC07pk6RJn40n0DSc6bMOBBREZxSDJ+BmRzc8B5OdaMh1ty3mkuWRg4sCFiDQQ==} + '@typescript-eslint/typescript-estree@7.7.1': + resolution: {integrity: sha512-CXe0JHCXru8Fa36dteXqmH2YxngKJjkQLjxzoj6LYwzZ7qZvgsLSc+eqItCrqIop8Vl2UKoAi0StVWu97FQZIQ==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: typescript: '*' @@ -1018,14 +1018,14 @@ packages: typescript: optional: true - '@typescript-eslint/utils@7.7.0': - resolution: {integrity: sha512-LKGAXMPQs8U/zMRFXDZOzmMKgFv3COlxUQ+2NMPhbqgVm6R1w+nU1i4836Pmxu9jZAuIeyySNrN/6Rc657ggig==} + '@typescript-eslint/utils@7.7.1': + resolution: {integrity: sha512-QUvBxPEaBXf41ZBbaidKICgVL8Hin0p6prQDu6bbetWo39BKbWJxRsErOzMNT1rXvTll+J7ChrbmMCXM9rsvOQ==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 - '@typescript-eslint/visitor-keys@7.7.0': - resolution: {integrity: sha512-h0WHOj8MhdhY8YWkzIF30R379y0NqyOHExI9N9KCzvmu05EgG4FumeYa3ccfKUSphyWkWQE1ybVrgz/Pbam6YA==} + '@typescript-eslint/visitor-keys@7.7.1': + resolution: {integrity: sha512-gBL3Eq25uADw1LQ9kVpf3hRM+DWzs0uZknHYK3hq4jcTPqVCClHGDnB6UUUV2SFeBeA4KWHWbbLqmbGcZ4FYbw==} engines: {node: ^18.18.0 || >=20.0.0} '@ungap/structured-clone@1.2.0': @@ -2291,8 +2291,8 @@ packages: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} hasBin: true - rollup@4.14.3: - resolution: {integrity: sha512-ag5tTQKYsj1bhrFC9+OEWqb5O6VYgtQDO9hPDBMmIbePwhfSr+ExlcU741t8Dhw5DkPCQf6noz0jb36D6W9/hw==} + rollup@4.16.2: + resolution: {integrity: sha512-sxDP0+pya/Yi5ZtptF4p3avI+uWCIf/OdrfdH2Gbv1kWddLKk0U7WE3PmQokhi5JrektxsK3sK8s4hzAmjqahw==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true @@ -2623,8 +2623,8 @@ packages: vite: optional: true - vite@5.2.9: - resolution: {integrity: sha512-uOQWfuZBlc6Y3W/DTuQ1Sr+oIXWvqljLvS881SVmAj00d5RdgShLcuXWxseWPd4HXwiYBFW/vXHfKFeqj9uQnw==} + vite@5.2.10: + resolution: {integrity: sha512-PAzgUZbP7msvQvqdSD+ErD5qGnSFiGOoWmV5yAKUEI0kdhjbH6nMWVyZQC/hSc4aXwc0oJ9aEdIiF9Oje0JFCw==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -3198,12 +3198,12 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.4.15 - '@kainstar/vite-plugin-i18next-loader@1.0.3(vite@5.2.9(@types/node@20.12.7))': + '@kainstar/vite-plugin-i18next-loader@1.0.3(vite@5.2.10(@types/node@20.12.7))': dependencies: dot-prop: 8.0.2 globby: 14.0.1 js-yaml: 4.1.0 - vite: 5.2.9(@types/node@20.12.7) + vite: 5.2.10(@types/node@20.12.7) '@mantine/carousel@6.0.21(@mantine/core@6.0.21(@emotion/react@11.11.4(@types/react@18.2.79)(react@18.2.0))(@mantine/hooks@6.0.21(react@18.2.0))(@types/react@18.2.79)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@mantine/hooks@6.0.21(react@18.2.0))(embla-carousel-react@7.1.0(react@18.2.0))(react@18.2.0)': dependencies: @@ -3323,13 +3323,13 @@ snapshots: - encoding - utf-8-validate - '@nabla/vite-plugin-eslint@2.0.4(eslint@8.57.0)(vite@5.2.9(@types/node@20.12.7))': + '@nabla/vite-plugin-eslint@2.0.4(eslint@8.57.0)(vite@5.2.10(@types/node@20.12.7))': dependencies: '@types/eslint': 8.56.9 chalk: 4.1.2 debug: 4.3.4 eslint: 8.57.0 - vite: 5.2.9(@types/node@20.12.7) + vite: 5.2.10(@types/node@20.12.7) transitivePeerDependencies: - supports-color @@ -3420,52 +3420,52 @@ snapshots: '@remix-run/router@1.15.3': {} - '@rollup/rollup-android-arm-eabi@4.14.3': + '@rollup/rollup-android-arm-eabi@4.16.2': optional: true - '@rollup/rollup-android-arm64@4.14.3': + '@rollup/rollup-android-arm64@4.16.2': optional: true - '@rollup/rollup-darwin-arm64@4.14.3': + '@rollup/rollup-darwin-arm64@4.16.2': optional: true - '@rollup/rollup-darwin-x64@4.14.3': + '@rollup/rollup-darwin-x64@4.16.2': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.14.3': + '@rollup/rollup-linux-arm-gnueabihf@4.16.2': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.14.3': + '@rollup/rollup-linux-arm-musleabihf@4.16.2': optional: true - '@rollup/rollup-linux-arm64-gnu@4.14.3': + '@rollup/rollup-linux-arm64-gnu@4.16.2': optional: true - '@rollup/rollup-linux-arm64-musl@4.14.3': + '@rollup/rollup-linux-arm64-musl@4.16.2': optional: true - '@rollup/rollup-linux-powerpc64le-gnu@4.14.3': + '@rollup/rollup-linux-powerpc64le-gnu@4.16.2': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.14.3': + '@rollup/rollup-linux-riscv64-gnu@4.16.2': optional: true - '@rollup/rollup-linux-s390x-gnu@4.14.3': + '@rollup/rollup-linux-s390x-gnu@4.16.2': optional: true - '@rollup/rollup-linux-x64-gnu@4.14.3': + '@rollup/rollup-linux-x64-gnu@4.16.2': optional: true - '@rollup/rollup-linux-x64-musl@4.14.3': + '@rollup/rollup-linux-x64-musl@4.16.2': optional: true - '@rollup/rollup-win32-arm64-msvc@4.14.3': + '@rollup/rollup-win32-arm64-msvc@4.16.2': optional: true - '@rollup/rollup-win32-ia32-msvc@4.14.3': + '@rollup/rollup-win32-ia32-msvc@4.16.2': optional: true - '@rollup/rollup-win32-x64-msvc@4.14.3': + '@rollup/rollup-win32-x64-msvc@4.16.2': optional: true '@sindresorhus/is@3.1.2': {} @@ -3545,14 +3545,14 @@ snapshots: '@types/swagger-schema-official@2.0.22': {} - '@typescript-eslint/eslint-plugin@7.7.0(@typescript-eslint/parser@7.7.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5)': + '@typescript-eslint/eslint-plugin@7.7.1(@typescript-eslint/parser@7.7.1(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5)': dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 7.7.0(eslint@8.57.0)(typescript@5.4.5) - '@typescript-eslint/scope-manager': 7.7.0 - '@typescript-eslint/type-utils': 7.7.0(eslint@8.57.0)(typescript@5.4.5) - '@typescript-eslint/utils': 7.7.0(eslint@8.57.0)(typescript@5.4.5) - '@typescript-eslint/visitor-keys': 7.7.0 + '@typescript-eslint/parser': 7.7.1(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.7.1 + '@typescript-eslint/type-utils': 7.7.1(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/utils': 7.7.1(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/visitor-keys': 7.7.1 debug: 4.3.4 eslint: 8.57.0 graphemer: 1.4.0 @@ -3565,12 +3565,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@7.7.0(eslint@8.57.0)(typescript@5.4.5)': + '@typescript-eslint/parser@7.7.1(eslint@8.57.0)(typescript@5.4.5)': dependencies: - '@typescript-eslint/scope-manager': 7.7.0 - '@typescript-eslint/types': 7.7.0 - '@typescript-eslint/typescript-estree': 7.7.0(typescript@5.4.5) - '@typescript-eslint/visitor-keys': 7.7.0 + '@typescript-eslint/scope-manager': 7.7.1 + '@typescript-eslint/types': 7.7.1 + '@typescript-eslint/typescript-estree': 7.7.1(typescript@5.4.5) + '@typescript-eslint/visitor-keys': 7.7.1 debug: 4.3.4 eslint: 8.57.0 optionalDependencies: @@ -3578,15 +3578,15 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@7.7.0': + '@typescript-eslint/scope-manager@7.7.1': dependencies: - '@typescript-eslint/types': 7.7.0 - '@typescript-eslint/visitor-keys': 7.7.0 + '@typescript-eslint/types': 7.7.1 + '@typescript-eslint/visitor-keys': 7.7.1 - '@typescript-eslint/type-utils@7.7.0(eslint@8.57.0)(typescript@5.4.5)': + '@typescript-eslint/type-utils@7.7.1(eslint@8.57.0)(typescript@5.4.5)': dependencies: - '@typescript-eslint/typescript-estree': 7.7.0(typescript@5.4.5) - '@typescript-eslint/utils': 7.7.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/typescript-estree': 7.7.1(typescript@5.4.5) + '@typescript-eslint/utils': 7.7.1(eslint@8.57.0)(typescript@5.4.5) debug: 4.3.4 eslint: 8.57.0 ts-api-utils: 1.3.0(typescript@5.4.5) @@ -3595,12 +3595,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/types@7.7.0': {} + '@typescript-eslint/types@7.7.1': {} - '@typescript-eslint/typescript-estree@7.7.0(typescript@5.4.5)': + '@typescript-eslint/typescript-estree@7.7.1(typescript@5.4.5)': dependencies: - '@typescript-eslint/types': 7.7.0 - '@typescript-eslint/visitor-keys': 7.7.0 + '@typescript-eslint/types': 7.7.1 + '@typescript-eslint/visitor-keys': 7.7.1 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -3612,35 +3612,35 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@7.7.0(eslint@8.57.0)(typescript@5.4.5)': + '@typescript-eslint/utils@7.7.1(eslint@8.57.0)(typescript@5.4.5)': dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.8 - '@typescript-eslint/scope-manager': 7.7.0 - '@typescript-eslint/types': 7.7.0 - '@typescript-eslint/typescript-estree': 7.7.0(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.7.1 + '@typescript-eslint/types': 7.7.1 + '@typescript-eslint/typescript-estree': 7.7.1(typescript@5.4.5) eslint: 8.57.0 semver: 7.6.0 transitivePeerDependencies: - supports-color - typescript - '@typescript-eslint/visitor-keys@7.7.0': + '@typescript-eslint/visitor-keys@7.7.1': dependencies: - '@typescript-eslint/types': 7.7.0 + '@typescript-eslint/types': 7.7.1 eslint-visitor-keys: 3.4.3 '@ungap/structured-clone@1.2.0': {} - '@vitejs/plugin-react@4.2.1(vite@5.2.9(@types/node@20.12.7))': + '@vitejs/plugin-react@4.2.1(vite@5.2.10(@types/node@20.12.7))': dependencies: '@babel/core': 7.24.4 '@babel/plugin-transform-react-jsx-self': 7.23.3(@babel/core@7.24.4) '@babel/plugin-transform-react-jsx-source': 7.23.3(@babel/core@7.24.4) '@types/babel__core': 7.20.5 react-refresh: 0.14.0 - vite: 5.2.9(@types/node@20.12.7) + vite: 5.2.10(@types/node@20.12.7) transitivePeerDependencies: - supports-color @@ -4941,26 +4941,26 @@ snapshots: dependencies: glob: 7.2.3 - rollup@4.14.3: + rollup@4.16.2: dependencies: '@types/estree': 1.0.5 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.14.3 - '@rollup/rollup-android-arm64': 4.14.3 - '@rollup/rollup-darwin-arm64': 4.14.3 - '@rollup/rollup-darwin-x64': 4.14.3 - '@rollup/rollup-linux-arm-gnueabihf': 4.14.3 - '@rollup/rollup-linux-arm-musleabihf': 4.14.3 - '@rollup/rollup-linux-arm64-gnu': 4.14.3 - '@rollup/rollup-linux-arm64-musl': 4.14.3 - '@rollup/rollup-linux-powerpc64le-gnu': 4.14.3 - '@rollup/rollup-linux-riscv64-gnu': 4.14.3 - '@rollup/rollup-linux-s390x-gnu': 4.14.3 - '@rollup/rollup-linux-x64-gnu': 4.14.3 - '@rollup/rollup-linux-x64-musl': 4.14.3 - '@rollup/rollup-win32-arm64-msvc': 4.14.3 - '@rollup/rollup-win32-ia32-msvc': 4.14.3 - '@rollup/rollup-win32-x64-msvc': 4.14.3 + '@rollup/rollup-android-arm-eabi': 4.16.2 + '@rollup/rollup-android-arm64': 4.16.2 + '@rollup/rollup-darwin-arm64': 4.16.2 + '@rollup/rollup-darwin-x64': 4.16.2 + '@rollup/rollup-linux-arm-gnueabihf': 4.16.2 + '@rollup/rollup-linux-arm-musleabihf': 4.16.2 + '@rollup/rollup-linux-arm64-gnu': 4.16.2 + '@rollup/rollup-linux-arm64-musl': 4.16.2 + '@rollup/rollup-linux-powerpc64le-gnu': 4.16.2 + '@rollup/rollup-linux-riscv64-gnu': 4.16.2 + '@rollup/rollup-linux-s390x-gnu': 4.16.2 + '@rollup/rollup-linux-x64-gnu': 4.16.2 + '@rollup/rollup-linux-x64-musl': 4.16.2 + '@rollup/rollup-win32-arm64-msvc': 4.16.2 + '@rollup/rollup-win32-ia32-msvc': 4.16.2 + '@rollup/rollup-win32-x64-msvc': 4.16.2 fsevents: 2.3.3 run-parallel@1.2.0: @@ -5264,7 +5264,7 @@ snapshots: util-deprecate@1.0.2: optional: true - vite-plugin-pages@0.32.1(vite@5.2.9(@types/node@20.12.7)): + vite-plugin-pages@0.32.1(vite@5.2.10(@types/node@20.12.7)): dependencies: '@types/debug': 4.1.12 debug: 4.3.4 @@ -5274,7 +5274,7 @@ snapshots: json5: 2.2.3 local-pkg: 0.5.0 picocolors: 1.0.0 - vite: 5.2.9(@types/node@20.12.7) + vite: 5.2.10(@types/node@20.12.7) yaml: 2.4.1 transitivePeerDependencies: - supports-color @@ -5287,32 +5287,32 @@ snapshots: - prismjs - supports-color - vite-plugin-webfont-dl@3.9.3(vite@5.2.9(@types/node@20.12.7)): + vite-plugin-webfont-dl@3.9.3(vite@5.2.10(@types/node@20.12.7)): dependencies: axios: 1.6.8 clean-css: 5.3.3 flat-cache: 3.2.0 picocolors: 1.0.0 - vite: 5.2.9(@types/node@20.12.7) + vite: 5.2.10(@types/node@20.12.7) transitivePeerDependencies: - debug - vite-tsconfig-paths@4.3.2(typescript@5.4.5)(vite@5.2.9(@types/node@20.12.7)): + vite-tsconfig-paths@4.3.2(typescript@5.4.5)(vite@5.2.10(@types/node@20.12.7)): dependencies: debug: 4.3.4 globrex: 0.1.2 tsconfck: 3.0.3(typescript@5.4.5) optionalDependencies: - vite: 5.2.9(@types/node@20.12.7) + vite: 5.2.10(@types/node@20.12.7) transitivePeerDependencies: - supports-color - typescript - vite@5.2.9(@types/node@20.12.7): + vite@5.2.10(@types/node@20.12.7): dependencies: esbuild: 0.20.2 postcss: 8.4.38 - rollup: 4.14.3 + rollup: 4.16.2 optionalDependencies: '@types/node': 20.12.7 fsevents: 2.3.3 diff --git a/src/GZCTF/Resources/Program.resx b/src/GZCTF/Resources/Program.resx index cd1d3f6bc..5f3436e0f 100644 --- a/src/GZCTF/Resources/Program.resx +++ b/src/GZCTF/Resources/Program.resx @@ -754,7 +754,7 @@ 发送邮件:{0} - <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/></head><body><div style="max-width: 544px; margin: 0 auto; padding: 20px"> <h2 style="text-align: center">{title}</h2> <p>你好,{userName}!</p> <p style="text-indent: 2em">{information}</p> <p style="text-align: center; padding: 20px"> <a href="{url}" style=" font: 1rem Arial; white-space: nowrap; text-decoration: none; background-color: #000000; color: #ffffff; padding: 10px 20px 10px 20px; border: 1px solid #888888; border-radius: 7px; margin: 10px auto; " > {btnmsg} </a> </p> <div style="font-size: 0.8rem"> <p> 如果以上按钮无效,请复制此链接到浏览器访问:<br/><span style="word-break: break-all; font: 0.8em monospace" >{url} </span> </p> <p>如果你没有进行相关操作,请忽略此封邮件。</p> </div> <p style="font-size: 0.7em; text-align: right; color: #333">GZCTF @ {nowtime}</p></div></body> + <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/></head><body><div style="max-width: 544px; margin: 0 auto; padding: 20px"> <h2 style="text-align: center">{title}</h2> <p>你好,{userName}!</p> <p style="text-indent: 2em">{information}</p> <p style="text-align: center; padding: 20px"> <a href="{url}" style=" font: 1rem Arial; white-space: nowrap; text-decoration: none; background-color: #000000; color: #ffffff; padding: 10px 20px 10px 20px; border: 1px solid #888888; border-radius: 7px; margin: 10px auto; " > {btnmsg} </a> </p> <div style="font-size: 0.8rem"> <p> 如果以上按钮无效,请复制此链接到浏览器访问:<br/><span style="word-break: break-all; font: 0.8em monospace" >{url} </span> </p> <p>如果你没有进行相关操作,请忽略此封邮件。</p> </div> <p style="font-size: 0.7em; text-align: right; color: #333">{platform} @ {nowtime}</p></div></body> 确认验证邮箱 diff --git a/src/GZCTF/Services/MailSender.cs b/src/GZCTF/Services/MailSender.cs index 4da325a1a..2395b40f4 100644 --- a/src/GZCTF/Services/MailSender.cs +++ b/src/GZCTF/Services/MailSender.cs @@ -30,27 +30,28 @@ public MailSender( _options = options.Value; _cancellationToken = _cancellationTokenSource.Token; - if (_options is { SendMailAddress: not null, Smtp.Host: not null, Smtp.Port: not null }) - { - _smtpClient = new(); - _smtpClient.AuthenticationMechanisms.Remove("XOAUTH2"); - if (!OperatingSystem.IsWindows()) - { - // Some systems may not enable old (non-recommend) ciphers in SSL configuration and lead to failures when - // connecting to some SMTP servers, override the default policy to include all ciphers except MD5, SHA1, and NULL - _smtpClient.SslCipherSuitesPolicy = new CipherSuitesPolicy(Enum.GetValues() - .Where(cipher => - { - var cipherName = cipher.ToString(); - // Exclude MD5, SHA1, and NULL ciphers for security reasons - return !cipherName.EndsWith("MD5") && !cipherName.EndsWith("SHA") && - !cipherName.EndsWith("NULL"); - })); - } + if (_options is not { SendMailAddress: not null, Smtp.Host: not null, Smtp.Port: not null }) + return; + + _smtpClient = new(); + _smtpClient.AuthenticationMechanisms.Remove("XOAUTH2"); - Task.Factory.StartNew(MailSenderWorker, _cancellationToken, TaskCreationOptions.LongRunning, - TaskScheduler.Default); + if (!OperatingSystem.IsWindows()) + { + // Some systems may not enable old (non-recommend) ciphers in TLS configuration and lead to failures when + // connecting to some SMTP servers, override the default policy to include all ciphers except MD5, SHA1, and NULL + _smtpClient.SslCipherSuitesPolicy = new CipherSuitesPolicy(Enum.GetValues() + .Where(cipher => + { + var cipherName = cipher.ToString(); + // Exclude MD5, SHA1, and NULL ciphers for security reasons + return !cipherName.EndsWith("MD5") && !cipherName.EndsWith("SHA") && + !cipherName.EndsWith("NULL"); + })); } + + Task.Factory.StartNew(MailSenderWorker, _cancellationToken, TaskCreationOptions.LongRunning, + TaskScheduler.Default); } public async Task SendEmailAsync(string subject, string content, string to) @@ -78,15 +79,10 @@ public async Task SendEmailAsync(string subject, string content, string to public async Task SendUrlAsync(MailContent content) { - var template = content.GlobalConfig.EmailTemplate switch - { - GlobalConfig.DefaultEmailTemplate => content.Localizer[nameof(Resources.Program.MailSender_Template)], - _ => content.GlobalConfig.EmailTemplate - }; - + // TODO: use GlobalConfig.DefaultEmailTemplate // TODO: use a string formatter library // TODO: update default template with new names - var emailContent = new StringBuilder(template) + var emailContent = new StringBuilder(content.Template) .Replace("{title}", content.Title) .Replace("{information}", content.Information) .Replace("{btnmsg}", content.ButtonMessage) @@ -94,10 +90,10 @@ public async Task SendUrlAsync(MailContent content) .Replace("{userName}", content.UserName) .Replace("{url}", content.Url) .Replace("{nowtime}", content.Time) - .Replace("{platform}", $"{content.GlobalConfig.Title}::CTF") + .Replace("{platform}", content.Platform) .ToString(); - var title = $"{content.Title} - {content.GlobalConfig.Title}::CTF"; + var title = $"{content.Title} - {content.Platform}"; if (!await SendEmailAsync(title, emailContent, content.Email)) _logger.SystemLog(Program.StaticLocalizer[nameof(Resources.Program.MailSender_MailSendFailed)], @@ -184,13 +180,13 @@ bool SendUrlIfPossible(string? userName, string? email, string? resetLink, MailT public void Dispose() { - if (!_disposed) - { - _disposed = true; - _cancellationTokenSource.Cancel(); - _smtpClient?.Dispose(); - GC.SuppressFinalize(this); - } + if (_disposed) + return; + + _disposed = true; + _cancellationTokenSource.Cancel(); + _smtpClient?.Dispose(); + GC.SuppressFinalize(this); } } @@ -212,13 +208,19 @@ public class MailContent( string email, string resetLink, MailType type, + // DO NOT use IStringLocalizer after construction IStringLocalizer localizer, IOptionsSnapshot globalConfig) { + /// + /// 邮件模板 + /// + public string Template { get; } = localizer[nameof(Resources.Program.MailSender_Template)]; + /// /// 邮件标题 /// - public string Title { get; set; } = type switch + public string Title { get; } = type switch { MailType.ConfirmEmail => localizer[nameof(Resources.Program.MailSender_VerifyEmailTitle)], MailType.ChangeEmail => localizer[nameof(Resources.Program.MailSender_ChangeEmailTitle)], @@ -229,7 +231,7 @@ public class MailContent( /// /// 邮件信息 /// - public string Information { get; set; } = type switch + public string Information { get; } = type switch { MailType.ConfirmEmail => localizer[nameof(Resources.Program.MailSender_VerifyEmailContent), email], MailType.ChangeEmail => localizer[nameof(Resources.Program.MailSender_ChangeEmailContent)], @@ -240,7 +242,7 @@ public class MailContent( /// /// 邮件按钮显示内容 /// - public string ButtonMessage { get; set; } = type switch + public string ButtonMessage { get; } = type switch { MailType.ConfirmEmail => localizer[nameof(Resources.Program.MailSender_VerifyEmailButton)], MailType.ChangeEmail => localizer[nameof(Resources.Program.MailSender_ChangeEmailButton)], @@ -251,24 +253,25 @@ public class MailContent( /// /// 用户名 /// - public string UserName { get; set; } = userName; + public string UserName { get; } = userName; /// /// 用户邮箱 /// - public string Email { get; set; } = email; + public string Email { get; } = email; /// /// 邮件链接 /// - public string Url { get; set; } = resetLink; + public string Url { get; } = resetLink; /// /// 发信时间 /// - public string Time { get; set; } = DateTimeOffset.UtcNow.ToString("u"); - - public IStringLocalizer Localizer => localizer; + public string Time { get; } = DateTimeOffset.UtcNow.ToString("u"); - public GlobalConfig GlobalConfig => globalConfig.Value; + /// + /// 平台名称 + /// + public string Platform { get; } = $"{globalConfig.Value.Title}::CTF"; } \ No newline at end of file