Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Simple spam filtering that works with any Ruby application and can be set up in minutes. It does not depend on any specific ORM or framework, although it includes optional Rack middleware. It uses Akismet or TypePad AntiSpam.
Add this line to your application's Gemfile:
gem 'spamster'
And then execute:
$ bundle
First you'll need to sign up for an API key from Akismet or TypePad AntiSpam. Then configure Spamster like:
Spamster.use_akismet("your-api-key", "http://yoursite.com/")
or...
Spamster.use_typepad("your-api-key", "http://yoursite.com/")
If you're building a Rack app (all Rails 3+ apps are Rack apps), then you'll probably want to use the optional Rack middleware so Spamster can automatically fill in the referrer
, user_agent
, and user_ip
params. If you're using Rails then add the middleware like this:
Rails.application.config.middleware.use Spamster::Rack::Middleware
If you're using Rails, then a suggested location to keep the above configuration is in an initializer file.
First check that your key is valid:
Spamster.key_valid? # => true
Then check that it detects spam using the name viagra-test-123
:
Spamster.spam?(user_ip: "222.222.222.222", user_agent: "Mozilla", comment_author: "viagra-test-123") # => true
And if you want to see the HTTP requests/responses while debugging:
Spamster.debug_output = $stderr
The easiest way to use Spamster is to include the mixin in your comment model:
class Comment
attr_accessor :content, :email, :name
include Spamster::Model
spamster_attrs comment_author: :name, comment_author_email: :email, comment_content: :content
end
comment = Comment.new #...
comment.spamster.spam? # checks for spam
comment.spamster.spam! # reports a false negative
comment.spamster.ham! # reports a false positive
For a full list of parameters accepted by spamster_attrs
, see Akismet's documentation for comment-check
.
Checks if the key is valid using verify-key
.
Spamster.key_valid?
Checks if a comment is spam using comment-check
.
Spamster.spam?(user_ip: "222.222.222.222", user_agent: "Mozilla", comment_author: "viagra-test-123")
Reports a false negative using submit-spam
.
Spamster.spam!(user_ip: "222.222.222.222", user_agent: "Mozilla", comment_author: "viagra-test-123")
Reports a false positive using submit-ham
.
Spamster.ham!(user_ip: "222.222.222.222", user_agent: "Mozilla", comment_author: "viagra-test-123")
Fork it, install dependencies with bundle
, and run tests with bundle exec rake
. If you submit a pull request, then remember to include tests.
Created by Brian Alexander and released under an MIT License.
FAQs
Unknown package
We found that spamster demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.