How to use akismet-api - 10 common examples

To help you get started, we’ve selected a few akismet-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github surmon-china / nodepress / src / processors / akismet / akismet.service.ts View on Github external
/**
 * Akismet spam module.
 * @file akismet-spam 反垃圾
 * @module utils/akismet
 * @author Surmon 
 */

const console = require('console')
const CONFIG = require('app.config')
const akismet = require('akismet-api')

let clientIsValid = false

const client = akismet.client({
  key: CONFIG.AKISMET.key,
  blog: CONFIG.AKISMET.blog
})

// check key
client.verifyKey().then(valid => {
  clientIsValid = valid
  if (valid) {
    console.ready(`Akismet key 有效,已准备好工作!`)
  } else {
    console.warn(`Akismet key 无效,无法工作!`)
  }
}).catch(err => {
  console.warn('Akismet VerifyKey Error:', err.message)
})
github coralproject / talk / plugins / talk-plugin-akismet / server / hooks.js View on Github external
const debug = require('debug')('talk:plugin:akismet');
const { ErrSpam } = require('./errors');
const akismet = require('akismet-api');
const { get, merge } = require('lodash');
const { KEY, SITE } = require('./config');
const client = akismet.client({
  key: KEY,
  blog: SITE,
});

let enabled = true;

// TODO: when using a developer key, this is possible, the plus plan does not
// allow us to check the key.
// let enabled = false;
// client.verifyKey((err, valid) => {
//   if (err) {
//     throw err;
//   }

//   if (valid) {
//     enabled = true;
github coralproject / talk / plugins / talk-plugin-akismet / index.js View on Github external
const debug = require('debug')('talk:plugin:akismet');
const { ErrSpam } = require('./errors');
const akismet = require('akismet-api');
const { get, merge } = require('lodash');
const { KEY, SITE } = require('./config');
const client = akismet.client({
  key: KEY,
  blog: SITE,
});

let enabled = true;

// TODO: when using a developer key, this is possible, the plus plan does not
// allow us to check the key.
// let enabled = false;
// client.verifyKey((err, valid) => {
//   if (err) {
//     throw err;
//   }

//   if (valid) {
//     enabled = true;
github coralproject / talk / src / core / server / services / comments / pipeline / phases / spam.ts View on Github external
}

  if (!integration.site) {
    log.error(
      "akismet integration was enabled but the site configuration was missing"
    );
    return;
  }

  // If the comment doesn't have a body, it can't be spam!
  if (!comment.body) {
    return;
  }

  // Create the Akismet client.
  const client = new Client({
    key: integration.key,
    blog: integration.site,
  });

  // Grab the properties we need.
  const userIP = req.ip;
  if (!userIP) {
    log.debug("request did not contain ip address, aborting spam check");
    return;
  }

  const userAgent = req.get("User-Agent");
  if (!userAgent || userAgent.length === 0) {
    log.debug("request did not contain User-Agent header, aborting spam check");
    return;
  }
github jo0ger / node-server / server / plugins / akismet.js View on Github external
initClient () {
    this.client = akismet.client({
      key: this.key,
      blog: this.site
    })
  }
github surmon-china / nodepress / src / processors / helper / helper.service.akismet.ts View on Github external
private initClient(): void {
    this.client = akismet.client({
      key: APP_CONFIG.AKISMET.key,
      blog: APP_CONFIG.AKISMET.blog,
    });
  }
github jimpick / lambda-comments / packages / utils / src / akismet.js View on Github external
constructor () {
    const { AKISMET: apiKey, BLOG: blog } = process.env

    this.client = akismet.client({ blog, key: apiKey })
    this.apiKey = apiKey
    this.blog = blog
  }
github extraStatic / stapsher / libs / Akismet.js View on Github external
const akismetCheckSpam = async (key, blog, entryObject) => {
  try {
    let spam = await akismet.client({ key, blog }).checkSpam(entryObject)
    return spam
  } catch (err) {
    throwError('AKISMET_CHECK_SPAM_FAILED', err, 500)
  }
}
github extraStatic / stapsher / libs / Akismet.js View on Github external
const akismetVerify = async (key, blog) => {
  try {
    let valid = await akismet.client({ key, blog }).verifyKey()
    return valid
  } catch (err) {
    throwError('AKISMET_VERIFICATION_FAILED', err, 500)
  }
}
github jo0ger / node-server / app / lib / plugin / egg-akismet / lib / akismet.js View on Github external
function createClient (config) {
    return akismet.client(config)
}

akismet-api

Nodejs bindings to the Akismet (https://akismet.com) spam detection service

MIT
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis

Popular akismet-api functions