active_hashcash 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbc710b7b2cc6fef0667915ac1a95ccfdd6d1cb3eaa1fa9b97d29ef81e79985d
4
- data.tar.gz: 323c22e60aa27d2d87e39ee8f5c356d2fc6e8190426e49831a29d762d2e74f28
3
+ metadata.gz: 27a33816eb2072dd2a76ed1f2844b1cd2f38915913f54a7ba4f855c5244ba1af
4
+ data.tar.gz: d9e0ad4861a95a9140d68005186ffa15ea369da874c3753c9230fefae260d870
5
5
  SHA512:
6
- metadata.gz: ed74328b7b1f91eb2dece7a29efb5b9d68079872694e589caca3e79de1a06e6d0bd5d2556dcab12f92fcede4c08b075a4dc4b9077e79c8511cb4045ce509c82c
7
- data.tar.gz: e8f580f0668529b3bd7e220f2bdbd4b2eae6bc63272228b9cb4d1fe75ef0e30202983e3e06d91664558d36239137b69d7ba96996c80b370f4b1638300f77781a
6
+ metadata.gz: 22a0e700d62551411c188dc33062b6b7738f08cc6da250c779beef08db7c3d98ea987c2cffebdfd9fe83c9879da293b570124cc86508fd19a32e7743bf7e50f3
7
+ data.tar.gz: ddf4aa8b020df59032e7f0711228279ecf375e903b46ce6a748c1b17d408277328db00f19b89955be639faaae7886e1ed700d2185fc91b520a547e0507afd3c4
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Changelog of ActiveHashcash
2
2
 
3
- ## Unrelease
3
+ ## 0.3.2 (2024-08-29)
4
+
5
+ - Fix methods conflitc by not including ActionView::Helpers::FormTagHelper
6
+ - Sanitize params by forcing as a String
7
+
8
+ ## 0.3.1 - 2024-04-04
4
9
 
5
10
  - Fix gem spec list files
6
11
 
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 dahsboard which allows to see all spent stamps.
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
  ![ActiveHashcash dashboard](active_hashcash_dashboard.png "ActiveHashcash dashboard")
@@ -33,8 +33,7 @@ module ActiveHashcash
33
33
  end
34
34
 
35
35
  def self.parse(string)
36
- return unless string
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
@@ -1,3 +1,3 @@
1
1
  module ActiveHashcash
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -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.1
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-04-04 00:00:00.000000000 Z
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.2.22
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