-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] akismet #11257 #17154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[Components] akismet #11257 #17154
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
components/akismet/actions/check-comment/check-comment.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| }, | ||
| }); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $.export("$summary", "Successfully submited comment as a false positive"); | ||
| return response; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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, | ||
| }, | ||
| }); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| 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, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.