Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

akismet

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

akismet - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

63

lib/index.d.ts

@@ -7,3 +7,5 @@ /**

* The front page or home URL of the instance making the request. For a blog
* or wiki this would be the front page. Note: Must be a full URI, including http://.
* or wiki this would be the front page.
*
* _Note:_ Must be a full URI, including `http://`.
*/

@@ -13,3 +15,3 @@ blog?: string;

* Akismet API key
* */
*/
apiKey: string;

@@ -44,3 +46,5 @@ /**

* The front page or home URL of the instance making the request. For a blog
* or wiki this would be the front page. Note: Must be a full URI, including http://.
* or wiki this would be the front page.
*
* _Note:_ Must be a full URI, including `http://`.
*/

@@ -54,7 +58,8 @@ blog?: string;

* User agent string of the web browser submitting the comment - typically the
* HTTP_USER_AGENT cgi variable. Not to be confused with the user agent of your Akismet library.
* `HTTP_USER_AGENT` cgi variable. Not to be confused with the user agent of
* your Akismet library.
*/
user_agent?: string;
/**
* The content of the HTTP_REFERER header should be sent here.
* The content of the `HTTP_REFERER` header should be sent here.
* (note spelling of `referrer`).

@@ -69,9 +74,9 @@ */

* A string that describes the type of content being sent. Examples:
* - comment: A blog comment.
* - forum-post: A top-level forum post.
* - reply: A reply to a top-level forum post.
* - blog-post: A blog post.
* - contact-form: A contact form or feedback form submission.
* - signup: A new user account.
* - message: A message sent between just a few users.
* - `comment`: A blog comment.
* - `forum-post`: A top-level forum post.
* - `reply`: A reply to a top-level forum post.
* - `blog-post`: A blog post.
* - `contact-form`: A contact form or feedback form submission.
* - `signup`: A new user account.
* - `message`: A message sent between just a few users.
*

@@ -115,3 +120,3 @@ * You may send a value not listed above if none of them accurately describe

/**
* The character encoding for the form values included in comment_* parameters,
* The character encoding for the form values included in `comment_*` parameters,
* such as `UTF-8` or `ISO-8859-1`.

@@ -142,4 +147,4 @@ */

*
* @param err - Returns the error message returned from the server.
* @param isValid - Returns `true` if the API key id valid; otherwise `false`.
* @param err - error message returned from the server.
* @param isValid - `true` if the API key is valid; otherwise `false`.
*/

@@ -150,4 +155,4 @@ declare type VerifyKeyCallback = (err: string | null, isValid: boolean) => void;

*
* @param err - Returns the error message returned from the server.
* @param isSpam - Returns `true` if the content is spam; otherwise `false`.
* @param err - error message returned from the server.
* @param isSpam - `true` if the content is spam; otherwise `false`.
*/

@@ -158,3 +163,3 @@ declare type CheckCommentCallback = (err: string | null, isSpam: boolean) => void;

*
* @param err - Returns the error message returned from the server.
* @param err - error message returned from the server.
*/

@@ -182,3 +187,3 @@ declare type SubmitCallback = (err: string | null) => void;

*
* @param callback - the callback function
* @param callback - callback function
*/

@@ -190,17 +195,10 @@ verifyKey(callback: VerifyKeyCallback): void;

* @param options - options to send to the Akismet API
* @param callback - the callback function
* @param callback - callback function
*/
checkComment(options: AkismetParameters, callback: CheckCommentCallback): void;
/**
* Historic alias of `checkComment`.
*
* @param options - options to send to the Akismet API
* @param callback - the callback function
*/
private checkSpam;
/**
* Marks a comment as spam and reports to the Akismet API.
*
* @param options - options to send to the Akismet API
* @param callback - the callback function
* @param callback - callback function
*/

@@ -212,3 +210,3 @@ submitSpam(options: AkismetParameters, callback: SubmitCallback): void;

* @param options - options to send to the Akismet API
* @param callback - the callback function
* @param callback - callback function
*/

@@ -220,2 +218,9 @@ submitHam(options: AkismetParameters, callback: SubmitCallback): void;

private _postRequest;
/**
* Historic alias of `checkComment`.
*
* @param options - options to send to the Akismet API
* @param callback - callback function
*/
private checkSpam;
}

@@ -222,0 +227,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var domain_1 = require("domain");
var request_1 = require("request");
var url_1 = require("url");
var domain_1 = require("domain");
/**

@@ -16,9 +16,9 @@ * Represents the Akismet API client.

function AkismetClient(options) {
this._blog = options.blog || '';
this._blog = options.blog || "";
this._apiKey = options.apiKey;
this._host = options.host || 'rest.akismet.com';
this._endPoint = options.endPoint || (this._apiKey + '.' + this._host);
this._host = options.host || "rest.akismet.com";
this._endPoint = options.endPoint || (this._apiKey + "." + this._host);
this._port = options.port || 80;
this._userAgent = options.userAgent || 'Generic Node.js/1.0.0 | Akismet/3.1.7';
this._charSet = options.charSet || 'utf-8';
this._userAgent = options.userAgent || "Generic Node.js/1.0.0 | Akismet/3.1.7";
this._charSet = options.charSet || "utf-8";
}

@@ -28,8 +28,8 @@ /**

*
* @param callback - the callback function
* @param callback - callback function
*/
AkismetClient.prototype.verifyKey = function (callback) {
var options = { key: this._apiKey, blog: this._blog };
this._postRequest(this._host, '/1.1/verify-key', options, function (err, status, body) {
callback(err, status >= 200 && status < 300 && body === 'valid');
this._postRequest(this._host, "/1.1/verify-key", options, function (err, status, body) {
callback(err, status >= 200 && status < 300 && body === "valid");
});

@@ -41,3 +41,3 @@ };

* @param options - options to send to the Akismet API
* @param callback - the callback function
* @param callback - callback function
*/

@@ -47,20 +47,11 @@ AkismetClient.prototype.checkComment = function (options, callback) {

options.user_agent = this._userAgent;
this._postRequest(this._endPoint, '/1.1/comment-check', options, function (err, status, body) {
callback(err, status >= 200 && status < 300 && body === 'true');
this._postRequest(this._endPoint, "/1.1/comment-check", options, function (err, status, body) {
callback(err, status >= 200 && status < 300 && body === "true");
});
};
/**
* Historic alias of `checkComment`.
*
* @param options - options to send to the Akismet API
* @param callback - the callback function
*/
AkismetClient.prototype.checkSpam = function (options, callback) {
this.checkComment(options, callback);
};
/**
* Marks a comment as spam and reports to the Akismet API.
*
* @param options - options to send to the Akismet API
* @param callback - the callback function
* @param callback - callback function
*/

@@ -70,3 +61,3 @@ AkismetClient.prototype.submitSpam = function (options, callback) {

options.user_agent = this._userAgent;
this._postRequest(this._endPoint, '/1.1/submit-spam', options, function (err, status, body) {
this._postRequest(this._endPoint, "/1.1/submit-spam", options, function (err, status, body) {
callback(err);

@@ -79,3 +70,3 @@ });

* @param options - options to send to the Akismet API
* @param callback - the callback function
* @param callback - callback function
*/

@@ -85,3 +76,3 @@ AkismetClient.prototype.submitHam = function (options, callback) {

options.user_agent = this._userAgent;
this._postRequest(this._endPoint, '/1.1/submit-ham', options, function (err, status, body) {
this._postRequest(this._endPoint, "/1.1/submit-ham", options, function (err, status, body) {
callback(err);

@@ -95,3 +86,3 @@ });

var requestUrl = url_1.format({
protocol: this._port === 443 ? 'https' : 'http',
protocol: this._port === 443 ? "https" : "http",
hostname: hostname,

@@ -102,20 +93,31 @@ pathname: path,

var options = {
'url': requestUrl,
'form': query,
'headers': {
'content-type': 'charset=' + this._charSet,
'user-agent': this._userAgent
"url": requestUrl,
"form": query,
"headers": {
"content-type": "charset=" + this._charSet,
"user-agent": this._userAgent
}
};
var dom = domain_1.create();
dom.on('error', function (err) { return callback(err, 0, ''); });
dom.on("error", function (err) { return callback(err, 0, ""); });
dom.run(function () {
request_1.post(options, function (err, response, body) {
if (err)
callback(err, 0, '');
else
if (err) {
callback(err, 0, "");
}
else {
callback(null, response.statusCode, body);
}
});
});
};
/**
* Historic alias of `checkComment`.
*
* @param options - options to send to the Akismet API
* @param callback - callback function
*/
AkismetClient.prototype.checkSpam = function (options, callback) {
this.checkComment(options, callback);
};
return AkismetClient;

@@ -133,2 +135,1 @@ }());

exports.client = client;
;
{
"name": "akismet",
"version": "2.0.4",
"version": "2.0.5",
"keywords": [

@@ -30,9 +30,9 @@ "akismet",

"devDependencies": {
"@types/jest": "*",
"@types/node": "*",
"@types/request": "2.x",
"jest": "^24.7.1",
"@types/jest": "^24.0.15",
"@types/node": "^12.6.8",
"@types/request": "^2.48.2",
"jest": "^24.8.0",
"ts-jest": "*",
"tslint": "*",
"typescript": "^3.4.5"
"tslint": "^5.18.0",
"typescript": "^3.5.3"
},

@@ -47,3 +47,3 @@ "jest": {

"scripts": {
"lint": "tslint -p . -t stylish 'src/**/*.{ts,tsx}'",
"lint": "tslint -c tslint.json -t stylish 'src/**/*.{ts,tsx}'",
"build": "tsc",

@@ -50,0 +50,0 @@ "prepublishOnly": "npm run build",

@@ -56,3 +56,3 @@ An [Akismet](http://www.akismet.com/) API client for [node.js](http://nodejs.org/).

```
See the [Akismet API documentation](http://www.akismet.com/development/api) for more information.
See the [wiki](https://github.com/oozcitak/akismet-js/wiki) and [Akismet API documentation](http://www.akismet.com/development/api) for more information.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc