diff --git a/docs/docs/develop/api-old.md b/docs/docs/develop/api-old.md index 8cb072fc..8533f3e5 100644 --- a/docs/docs/develop/api-old.md +++ b/docs/docs/develop/api-old.md @@ -43,7 +43,7 @@ | `data.comment.id` | Number | - | 评论 ID | | `data.comment.content` | String | - | 评论正文 | | `data.comment.nick` | String | - | 评论者昵称 | -| `data.comment.email_encrypted` | String | - | 评论者邮箱 MD5 加密值 | +| `data.comment.email_encrypted` | String | - | 评论者邮箱 SHA256 加密值 | | `data.comment.link` | String | - | 评论者链接 | | `data.comment.ua` | String | - | 评论者 User-Agent | | `data.comment.date` | String | - | 评论时间,格式为 `1970-01-01 00:00:00` | diff --git a/internal/dao/cook.go b/internal/dao/cook.go index 2706b403..06336d9f 100644 --- a/internal/dao/cook.go +++ b/internal/dao/cook.go @@ -1,6 +1,8 @@ package dao import ( + "strings" + "github.com/ArtalkJS/Artalk/internal/entity" "github.com/ArtalkJS/Artalk/internal/utils" "github.com/samber/lo" @@ -38,7 +40,7 @@ func (dao *Dao) CookComment(c *entity.Comment) entity.CookedComment { ContentMarked: markedContent, UserID: c.UserID, Nick: user.Name, - EmailEncrypted: utils.GetSha256Hash(user.Email), + EmailEncrypted: utils.GetSha256Hash(strings.ToLower(user.Email)), Link: user.Link, UA: c.UA, Date: c.CreatedAt.Local().Format(CommonDateTimeFormat), @@ -90,7 +92,7 @@ func (dao *Dao) CookCommentForEmail(c *entity.Comment) entity.CookedCommentForEm Site: dao.CookSite(&site), CookedComment: entity.CookedComment{ ID: c.ID, - EmailEncrypted: utils.GetSha256Hash(user.Email), + EmailEncrypted: utils.GetSha256Hash(strings.ToLower(user.Email)), Link: user.Link, UA: c.UA, IsCollapsed: c.IsCollapsed, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6d8844ac..414a1565 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -243,6 +243,9 @@ importers: artalk: specifier: workspace:^ version: link:../artalk + crypto-js: + specifier: ^4.2.0 + version: 4.2.0 pinia: specifier: ^2.1.7 version: 2.1.7(typescript@5.4.5)(vue@3.4.26(typescript@5.4.5)) @@ -265,6 +268,9 @@ importers: '@tsconfig/node18': specifier: ^18.2.4 version: 18.2.4 + '@types/crypto-js': + specifier: ^4.2.2 + version: 4.2.2 '@types/jsdom': specifier: ^21.1.6 version: 21.1.6 @@ -1333,6 +1339,9 @@ packages: '@types/babel__traverse@7.20.5': resolution: {integrity: sha512-WXCyOcRtH37HAUkpXhUduaxdm82b4GSlyTqajXviN4EfiuPgNYR109xMCKvpl6zPIpua0DGlMEDCq+g8EdoheQ==} + '@types/crypto-js@4.2.2': + resolution: {integrity: sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ==} + '@types/estree@1.0.5': resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} @@ -2077,6 +2086,9 @@ packages: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} + crypto-js@4.2.0: + resolution: {integrity: sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==} + css-color-keywords@1.0.0: resolution: {integrity: sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg==} engines: {node: '>=4'} @@ -5663,6 +5675,8 @@ snapshots: dependencies: '@babel/types': 7.24.5 + '@types/crypto-js@4.2.2': {} + '@types/estree@1.0.5': {} '@types/istanbul-lib-coverage@2.0.6': {} @@ -6615,6 +6629,8 @@ snapshots: shebang-command: 2.0.0 which: 2.0.2 + crypto-js@4.2.0: {} + css-color-keywords@1.0.0: {} css-functions-list@3.2.2: {} diff --git a/ui/artalk-sidebar/package.json b/ui/artalk-sidebar/package.json index f135831c..784a20ab 100644 --- a/ui/artalk-sidebar/package.json +++ b/ui/artalk-sidebar/package.json @@ -15,6 +15,7 @@ }, "dependencies": { "artalk": "workspace:^", + "crypto-js": "^4.2.0", "pinia": "^2.1.7", "vue": "^3.4.26", "vue-i18n": "^9.13.1", @@ -24,6 +25,7 @@ "devDependencies": { "@rushstack/eslint-patch": "^1.10.2", "@tsconfig/node18": "^18.2.4", + "@types/crypto-js": "^4.2.2", "@types/jsdom": "^21.1.6", "@vitejs/plugin-vue": "^5.0.4", "@vue/eslint-config-prettier": "^9.0.0", diff --git a/ui/artalk-sidebar/src/components/Header.vue b/ui/artalk-sidebar/src/components/Header.vue index 493fb949..4c05cfea 100644 --- a/ui/artalk-sidebar/src/components/Header.vue +++ b/ui/artalk-sidebar/src/components/Header.vue @@ -1,6 +1,5 @@