How to use the akismet-api.Client function in akismet-api

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 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;
  }

akismet-api

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

MIT
Latest version published 1 year ago

Package Health Score

54 / 100
Full package analysis

Popular akismet-api functions