Skip to content

Commit

Permalink
feat: v3.9.4
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Apr 12, 2022
1 parent 3a837c5 commit b7c49e1
Show file tree
Hide file tree
Showing 4 changed files with 1,393 additions and 1,496 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to this project will be documented in this file.

### 3.9.4 (2022-04-12)

**Feature**

- **[Helper]** improve `nodemailer` config
- **[Helper]** improve `akismet` types

**Chore**

- Upgrade deps

### 3.9.0 (2022-02-28)

**Feature**
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nodepress",
"version": "3.9.3",
"version": "3.9.4",
"description": "RESTful API service for Surmon.me blog",
"author": {
"name": "Surmon",
Expand Down Expand Up @@ -43,9 +43,9 @@
"@nestjs/passport": "^8.0.1",
"@nestjs/platform-express": "^8.2.4",
"@nestjs/throttler": "^2.0.0",
"@typegoose/auto-increment": "^1.0.0",
"@typegoose/typegoose": "^9.4.0",
"akismet-api": "^5.2.1",
"@typegoose/auto-increment": "^1.2.0",
"@typegoose/typegoose": "^9.7.0",
"akismet-api": "^5.3.0",
"ali-oss": "^6.16.0",
"axios": "^0.24.0",
"body-parser": "^1.19.1",
Expand All @@ -64,7 +64,7 @@
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.21",
"moment": "^2.29.2",
"mongoose": "~6.1.3",
"mongoose": "~6.2.3",
"node-schedule": "^2.1.0",
"nodemailer": "^6.7.2",
"passport": "0.5.0",
Expand Down
20 changes: 14 additions & 6 deletions src/processors/helper/helper.service.akismet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
* @author Surmon <https://github.com/surmon-china>
*/

import akismet from 'akismet-api'
import { AkismetClient } from 'akismet-api'
import { Injectable } from '@nestjs/common'
import { UNDEFINED } from '@app/constants/value.constant'
import { getMessageFromNormalError } from '@app/transformers/error.transformer'
import * as APP_CONFIG from '@app/app.config'
import logger from '@app/utils/logger'
Expand All @@ -31,7 +32,7 @@ export interface AkismetPayload {

@Injectable()
export class AkismetService {
private client: akismet
private client: AkismetClient
private clientIsValid = false

constructor() {
Expand All @@ -41,9 +42,9 @@ export class AkismetService {

private initClient(): void {
// https://github.com/chrisfosterelli/akismet-api
this.client = akismet.client({
key: APP_CONFIG.AKISMET.key,
blog: APP_CONFIG.AKISMET.blog,
this.client = new AkismetClient({
key: APP_CONFIG.AKISMET.key as string,
blog: APP_CONFIG.AKISMET.blog as string,
})
}

Expand Down Expand Up @@ -72,7 +73,14 @@ export class AkismetService {
}

logger.info(`[Akismet]`, `${handleType}...`, new Date())
this.client[handleType](content)
this.client[handleType]({
...content,
permalink: content.permalink || UNDEFINED,
comment_author: content.comment_author || UNDEFINED,
comment_author_email: content.comment_author_email || UNDEFINED,
comment_author_url: content.comment_author_url || UNDEFINED,
comment_content: content.comment_content || UNDEFINED,
})
.then((result) => {
// 如果是检查 spam 且检查结果为 true
if (handleType === AkismetAction.CheckSpam && result) {
Expand Down
Loading

0 comments on commit b7c49e1

Please sign in to comment.