Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions components/akismet/actions/check-comment/check-comment.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import app from "../../akismet.app.mjs";

export default {
key: "akismet-check-comment",
name: "Check Comment",
description: "Check if a comment is spam or not. [See the documentation](https://akismet.com/developers/detailed-docs/submit-spam-missed-spam/)",
version: "0.0.1",
type: "action",
props: {
app,
blog: {
propDefinition: [
app,
"blog",
],
},
userIp: {
propDefinition: [
app,
"userIp",
],
},
userAgent: {
propDefinition: [
app,
"userAgent",
],
},
referrer: {
propDefinition: [
app,
"referrer",
],
},
permalink: {
propDefinition: [
app,
"permalink",
],
},
commentType: {
propDefinition: [
app,
"commentType",
],
},
commentAuthor: {
propDefinition: [
app,
"commentAuthor",
],
},
commentAuthorEmail: {
propDefinition: [
app,
"commentAuthorEmail",
],
},
commentAuthorUrl: {
propDefinition: [
app,
"commentAuthorUrl",
],
},
commentContent: {
propDefinition: [
app,
"commentContent",
],
},

},
async run({ $ }) {
const response = await this.app.checkComment({
$,
data: {
blog: this.blog,
user_ip: this.userIp,
user_agent: this.userAgent,
referrer: this.referrer,
permalink: this.permalink,
comment_author: this.commentAuthor,
comment_author_email: this.commentAuthorEmail,
comment_author_url: this.commentAuthorUrl,
comment_content: this.commentContent,
comment_type: this.commentType,
},
});
$.export("$summary", "Successfully submited comment to be checked. Akismet spam analysis response: " + response);
return response;
},
};
84 changes: 84 additions & 0 deletions components/akismet/actions/submit-ham/submit-ham.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import app from "../../akismet.app.mjs";

export default {
key: "akismet-submit-ham",
name: "Submit Ham",
description: "Submit a comment that was incorrectly classified as spam. [See the documentation](https://akismet.com/developers/detailed-docs/submit-ham-false-positives/)",
version: "0.0.1",
type: "action",
props: {
app,
blog: {
propDefinition: [
app,
"blog",
],
},
userIp: {
propDefinition: [
app,
"userIp",
],
},
permalink: {
propDefinition: [
app,
"permalink",
],
},
userAgent: {
propDefinition: [
app,
"userAgent",
],
},
commentAuthor: {
propDefinition: [
app,
"commentAuthor",
],
},
commentAuthorEmail: {
propDefinition: [
app,
"commentAuthorEmail",
],
},
commentAuthorUrl: {
propDefinition: [
app,
"commentAuthorUrl",
],
},
commentContent: {
propDefinition: [
app,
"commentContent",
],
},
commentType: {
propDefinition: [
app,
"commentType",
],
},
},
async run({ $ }) {
const response = await this.app.submitHam({
$,
data: {
blog: this.blog,
user_ip: this.userIp,
user_agent: this.userAgent,
permalink: this.permalink,
comment_author: this.commentAuthor,
comment_author_email: this.commentAuthorEmail,
comment_author_url: this.commentAuthorUrl,
comment_content: this.commentContent,
comment_type: this.commentType,
},
});
$.export("$summary", "Successfully submited comment as a false positive");
return response;
},
};
93 changes: 93 additions & 0 deletions components/akismet/actions/submit-spam/submit-spam.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import app from "../../akismet.app.mjs";

export default {
key: "akismet-submit-spam",
name: "Submit Spam",
description: "Submit comment that was not marked as spam but should have been. [See the documentation](https://akismet.com/developers/detailed-docs/submit-spam-missed-spam/)",
version: "0.0.1",
type: "action",
props: {
app,
blog: {
propDefinition: [
app,
"blog",
],
},
userIp: {
propDefinition: [
app,
"userIp",
],
},
permalink: {
propDefinition: [
app,
"permalink",
],
},
userAgent: {
propDefinition: [
app,
"userAgent",
],
},
referrer: {
propDefinition: [
app,
"referrer",
],
},
commentAuthor: {
propDefinition: [
app,
"commentAuthor",
],
},
commentAuthorEmail: {
propDefinition: [
app,
"commentAuthorEmail",
],
},
commentAuthorUrl: {
propDefinition: [
app,
"commentAuthorUrl",
],
},
commentContent: {
propDefinition: [
app,
"commentContent",
],
},
commentType: {
propDefinition: [
app,
"commentType",
],
},
},
async run({ $ }) {

const response = await this.app.submitSpam({
$,
data: {
blog: this.blog,
user_ip: this.userIp,
permalink: this.permalink,
user_agent: this.userAgent,
referrer: this.referrer,
comment_author: this.commentAuthor,
comment_author_email: this.commentAuthorEmail,
comment_author_url: this.commentAuthorUrl,
comment_content: this.commentContent,
comment_type: this.commentType,
},
});

$.export("$summary", "Successfully submited comment as spam");
return response;
},
};
113 changes: 109 additions & 4 deletions components/akismet/akismet.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,116 @@
import { axios } from "@pipedream/platform";
import constants from "./common/constants.mjs";

export default {
type: "app",
app: "akismet",
propDefinitions: {},
propDefinitions: {
blog: {
type: "string",
label: "Blog URL",
description: "The URL of the blog where the comment was posted",
},
userIp: {
type: "string",
label: "User IP",
description: "The IP address of the comment author",
},
permalink: {
type: "string",
label: "Permalink",
description: "The full permanent URL of the entry the comment was submitted to",
},
userAgent: {
type: "string",
label: "User Agent",
description: "The user agent string of the web browser used to submit the comment",
optional: true,
},
referrer: {
type: "string",
label: "Referrer URL",
description: "The URL of the page that submitted the comment",
optional: true,
},
commentAuthor: {
type: "string",
label: "Comment Author Name",
description: "The name submitted with the comment",
optional: true,
},
commentAuthorEmail: {
type: "string",
label: "Comment Author Email",
description: "The email address submitted with the comment",
optional: true,
},
commentAuthorUrl: {
type: "string",
label: "Comment Author URL",
description: "The URL submitted with the comment",
optional: true,
},
commentContent: {
type: "string",
label: "Comment Content",
description: "The content of the comment itself",
optional: true,
},
commentType: {
type: "string",
label: "Comment Type",
description: "The type of comment",
optional: true,
options: constants.COMMENT_TYPES,
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://rest.akismet.com/1.1";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
data,
...otherOpts
} = opts;

return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
...headers,
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
},
data: {
api_key: `${this.$auth.api_key}`,
...data,
},
});
},
async submitSpam(args = {}) {
return this._makeRequest({
path: "/submit-spam",
method: "post",
...args,
});
},
async submitHam(args = {}) {
return this._makeRequest({
path: "/submit-ham",
method: "post",
...args,
});
},
async checkComment(args = {}) {
return this._makeRequest({
path: "/comment-check",
method: "post",
...args,
});
},
},
};
Loading
Loading