active_hashcash 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +13 -1
- data/app/models/active_hashcash/stamp.rb +1 -2
- data/lib/active_hashcash/version.rb +1 -1
- data/lib/active_hashcash.rb +1 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27a33816eb2072dd2a76ed1f2844b1cd2f38915913f54a7ba4f855c5244ba1af
|
4
|
+
data.tar.gz: d9e0ad4861a95a9140d68005186ffa15ea369da874c3753c9230fefae260d870
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22a0e700d62551411c188dc33062b6b7738f08cc6da250c779beef08db7c3d98ea987c2cffebdfd9fe83c9879da293b570124cc86508fd19a32e7743bf7e50f3
|
7
|
+
data.tar.gz: ddf4aa8b020df59032e7f0711228279ecf375e903b46ce6a748c1b17d408277328db00f19b89955be639faaae7886e1ed700d2185fc91b520a547e0507afd3c4
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -45,6 +45,18 @@ Require hashcash from your JavaScript manifest.
|
|
45
45
|
//= require hashcash
|
46
46
|
```
|
47
47
|
|
48
|
+
OR
|
49
|
+
|
50
|
+
Link hashcash to your JavaScript manifest and load it to your head.
|
51
|
+
|
52
|
+
```js
|
53
|
+
//= link hashcash.js
|
54
|
+
```
|
55
|
+
|
56
|
+
```erb
|
57
|
+
<%= javascript_include_tag "hashcash", "data-turbo-track": "reload", defer: true %>
|
58
|
+
```
|
59
|
+
|
48
60
|
Add a Hashcash hidden field into the form you want to protect.
|
49
61
|
|
50
62
|
```erb
|
@@ -77,7 +89,7 @@ rails db:migrate
|
|
77
89
|
|
78
90
|
### Dashboard
|
79
91
|
|
80
|
-
There is a mountable
|
92
|
+
There is a mountable dashboard which allows to see all spent stamps.
|
81
93
|
It's not mandatory, but useful for monitoring purpose.
|
82
94
|
|
83
95
|

|
@@ -33,8 +33,7 @@ module ActiveHashcash
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.parse(string)
|
36
|
-
|
37
|
-
args = string.split(":")
|
36
|
+
args = string.to_s.split(":")
|
38
37
|
return if args.size != 7
|
39
38
|
new(version: args[0], bits: args[1], date: Date.strptime(args[2], ActiveHashcash.date_format), resource: args[3], ext: args[4], rand: args[5], counter: args[6])
|
40
39
|
end
|
data/lib/active_hashcash.rb
CHANGED
@@ -4,8 +4,6 @@ require "active_hashcash/engine"
|
|
4
4
|
module ActiveHashcash
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
|
-
include ActionView::Helpers::FormTagHelper
|
8
|
-
|
9
7
|
included do
|
10
8
|
helper_method :hashcash_hidden_field_tag
|
11
9
|
end
|
@@ -87,6 +85,6 @@ module ActiveHashcash
|
|
87
85
|
# Unless you need something really special, you should not need to override this method.
|
88
86
|
def hashcash_hidden_field_tag(name = :hashcash)
|
89
87
|
options = {resource: hashcash_resource, bits: hashcash_bits, waiting_message: hashcash_waiting_message}
|
90
|
-
hidden_field_tag(name, "", "data-hashcash" => options.to_json)
|
88
|
+
view_context.hidden_field_tag(name, "", "data-hashcash" => options.to_json)
|
91
89
|
end
|
92
90
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_hashcash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Bernard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
101
|
+
rubygems_version: 3.5.9
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Protect Rails applications against bots and brute force attacks without annoying
|