active_hashcash 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/assets/config/active_hashcash_manifest.js +1 -0
- data/app/assets/javascripts/hashcash.js +257 -0
- data/app/assets/stylesheets/active_hashcash/application.css +15 -0
- data/app/controllers/active_hashcash/addresses_controller.rb +7 -0
- data/app/controllers/active_hashcash/application_controller.rb +4 -0
- data/app/controllers/active_hashcash/assets_controller.rb +34 -0
- data/app/controllers/active_hashcash/stamps_controller.rb +11 -0
- data/app/helpers/active_hashcash/addresses_helper.rb +4 -0
- data/app/helpers/active_hashcash/application_helper.rb +4 -0
- data/app/helpers/active_hashcash/stamps_helper.rb +4 -0
- data/app/jobs/active_hashcash/application_job.rb +4 -0
- data/app/mailers/active_hashcash/application_mailer.rb +6 -0
- data/app/models/active_hashcash/application_record.rb +5 -0
- data/app/models/active_hashcash/stamp.rb +70 -0
- data/app/views/active_hashcash/addresses/index.html.erb +17 -0
- data/app/views/active_hashcash/assets/_logo.svg.erb +1 -0
- data/app/views/active_hashcash/assets/_style.css +148 -0
- data/app/views/active_hashcash/assets/application.css.erb +1 -0
- data/app/views/active_hashcash/assets/ariato.css.erb +2 -0
- data/app/views/active_hashcash/assets/favicon.ico +0 -0
- data/app/views/active_hashcash/assets/favicon.svg.erb +1 -0
- data/app/views/active_hashcash/assets/vendor/_ariato_base.css +1297 -0
- data/app/views/active_hashcash/assets/vendor/_ariato_extra.css +1206 -0
- data/app/views/active_hashcash/stamps/_filters.html.erb +39 -0
- data/app/views/active_hashcash/stamps/index.html.erb +25 -0
- data/app/views/active_hashcash/stamps/show.html.erb +21 -0
- data/app/views/layouts/active_hashcash/application.html.erb +36 -0
- data/config/locales/de.yml +4 -0
- data/config/locales/en.yml +4 -0
- data/config/locales/es.yml +4 -0
- data/config/locales/fr.yml +4 -0
- data/config/locales/it.yml +4 -0
- data/config/locales/jp.yml +4 -0
- data/config/locales/pt.yml +4 -0
- data/config/routes.rb +6 -0
- data/db/migrate/20240215143453_create_active_hashcash_stamps.rb +25 -0
- data/lib/active_hashcash/version.rb +1 -1
- metadata +39 -3
@@ -0,0 +1,39 @@
|
|
1
|
+
<%= form_tag nil, method: :get do %>
|
2
|
+
<div class="grid-auto">
|
3
|
+
<div role="group">
|
4
|
+
<%= label_tag :created_from do %>
|
5
|
+
<%= ActiveHashcash::Stamp::human_attribute_name(:created_at) + " ≥" %>
|
6
|
+
<%= date_field_tag :created_from, params[:created_from] %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%= label_tag :created_from do %>
|
10
|
+
<%= ActiveHashcash::Stamp::human_attribute_name(:created_at) + " ≤" %>
|
11
|
+
<%= date_field_tag :created_to, params[:created_to] %>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div role="group">
|
16
|
+
<%= label_tag :bits_from do %>
|
17
|
+
<%= ActiveHashcash::Stamp::human_attribute_name(:bits) + " ≥" %>
|
18
|
+
<%= number_field_tag :bits_from, params[:bits_from] %>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<%= label_tag :bits_to do %>
|
22
|
+
<%= ActiveHashcash::Stamp::human_attribute_name(:bits) + " ≤" %>
|
23
|
+
<%= number_field_tag :bits_to, params[:bits_to] %>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div>
|
28
|
+
<%= label_tag :ip_address_starts_with, ActiveHashcash::Stamp::human_attribute_name(:ip_address) %>
|
29
|
+
<%= text_field_tag :ip_address_starts_with, params[:ip_address_starts_with] %>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div>
|
33
|
+
<%= label_tag :request_path_starts_with, ActiveHashcash::Stamp::human_attribute_name(:request_path) %>
|
34
|
+
<%= text_field_tag :request_path_starts_with, params[:request_path_starts_with] %>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<%= submit_tag t("active_hashcash.submit_filter") %>
|
38
|
+
</div>
|
39
|
+
<% end %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<details>
|
2
|
+
<summary>Filters</summary>
|
3
|
+
<%= render "filters" %>
|
4
|
+
</details>
|
5
|
+
|
6
|
+
<table>
|
7
|
+
<thead>
|
8
|
+
<tr>
|
9
|
+
<th><%= ActiveHashcash::Stamp.human_attribute_name(:created_at) %></th>
|
10
|
+
<th><%= ActiveHashcash::Stamp.human_attribute_name(:ip_address) %></th>
|
11
|
+
<th><%= ActiveHashcash::Stamp.human_attribute_name(:request_path) %></th>
|
12
|
+
<th><%= ActiveHashcash::Stamp.human_attribute_name(:bits) %></th>
|
13
|
+
</tr>
|
14
|
+
</thead>
|
15
|
+
<tbody>
|
16
|
+
<% for stamp in @stamps %>
|
17
|
+
<tr>
|
18
|
+
<td><%= link_to stamp.created_at, stamp %></td>
|
19
|
+
<td><%= stamp.ip_address %></td>
|
20
|
+
<td><%= stamp.request_path %></td>
|
21
|
+
<td><%= stamp.bits %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</tbody>
|
25
|
+
</table>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
<h3><%= @stamp %></h3>
|
3
|
+
<dl>
|
4
|
+
<dt><%= @stamp.class.human_attribute_name(:created_at) %></dt>
|
5
|
+
<dd><%= l @stamp.created_at %></dd>
|
6
|
+
|
7
|
+
<dt><%= @stamp.class.human_attribute_name(:resource) %></dt>
|
8
|
+
<dd><%= @stamp.resource %></dd>
|
9
|
+
|
10
|
+
<dt><%= @stamp.class.human_attribute_name(:bits) %></dt>
|
11
|
+
<dd><%= @stamp.bits %></dd>
|
12
|
+
|
13
|
+
<dt><%= @stamp.class.human_attribute_name(:ip_address) %></dt>
|
14
|
+
<dd><%= @stamp.ip_address %></dd>
|
15
|
+
|
16
|
+
<dt><%= @stamp.class.human_attribute_name(:request_path) %></dt>
|
17
|
+
<dd><%= @stamp.request_path %></dd>
|
18
|
+
|
19
|
+
<dt><%= @stamp.class.human_attribute_name(:context) %></dt>
|
20
|
+
<dd><%= @stamp.context %></dd>
|
21
|
+
</dl>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html class="active-analytics">
|
3
|
+
<head>
|
4
|
+
<title>Active Hashcash</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
|
8
|
+
<%= tag.link rel: "icon", href: asset_path(:favicon, format: :ico), sizes: "32x32" %>
|
9
|
+
<%= tag.link rel: "icon", href: asset_path(:favicon, format: :svg), type: "image/svg+xml" %>
|
10
|
+
|
11
|
+
<%= tag.link rel: "stylesheet", href: asset_path(:ariato, format: :css) %>
|
12
|
+
<%= tag.link rel: "stylesheet", href: asset_path(:application, format: :css) %>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<header>
|
16
|
+
<nav aria-label="site">
|
17
|
+
<ul role="menu" aria-label="Elements" class="is-horizontal">
|
18
|
+
<li role="none" class="logo"><%= link_to(root_path) { render partial: "/active_hashcash/assets/logo", formats: [:svg] } %></li>
|
19
|
+
<li role="none"><%= link_to_unless_current ActiveHashcash::Stamp.model_name.human.pluralize, stamps_path %></li>
|
20
|
+
<li role="none"><%= link_to_unless_current "Top IP addresses", addresses_path %></li>
|
21
|
+
</ul>
|
22
|
+
</nav>
|
23
|
+
</header>
|
24
|
+
|
25
|
+
<main class="card">
|
26
|
+
<%= yield %>
|
27
|
+
</main>
|
28
|
+
|
29
|
+
<footer>
|
30
|
+
Made by <a href="https://www.rorvswild.com">RorVsWild</a> |
|
31
|
+
<a href="https://github.com/BaseSecrete/active_hashcash">Source code</a> |
|
32
|
+
<a href="https://twitter.com/rorvswild">Twitter</a> |
|
33
|
+
<a href="https://ruby.social/@rorvswild">Mastodon</a> |
|
34
|
+
</footer>
|
35
|
+
</body>
|
36
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
class CreateActiveHashcashStamps < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :active_hashcash_stamps do |t|
|
4
|
+
t.string :version, null: false
|
5
|
+
t.integer :bits, null: false
|
6
|
+
t.date :date, null: false
|
7
|
+
t.string :resource, null: false
|
8
|
+
t.string :ext, null: false
|
9
|
+
t.string :rand, null: false
|
10
|
+
t.string :counter, null: false
|
11
|
+
t.string :request_path
|
12
|
+
t.string :ip_address
|
13
|
+
|
14
|
+
if t.respond_to?(:jsonb)
|
15
|
+
t.jsonb :context # SQLite JSONB support from version 3.45 (2024-01-15)
|
16
|
+
elsif t.respond_to?(:json)
|
17
|
+
t.json :context
|
18
|
+
end
|
19
|
+
|
20
|
+
t.timestamps
|
21
|
+
end
|
22
|
+
add_index :active_hashcash_stamps, [:ip_address, :created_at], where: "ip_address IS NOT NULL"
|
23
|
+
add_index :active_hashcash_stamps, [:counter, :rand, :date, :resource, :bits, :version, :ext], name: "index_active_hashcash_stamps_unique", unique: true
|
24
|
+
end
|
25
|
+
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Bernard
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -35,6 +35,42 @@ files:
|
|
35
35
|
- CHANGELOG.md
|
36
36
|
- LICENSE.txt
|
37
37
|
- README.md
|
38
|
+
- app/assets/config/active_hashcash_manifest.js
|
39
|
+
- app/assets/javascripts/hashcash.js
|
40
|
+
- app/assets/stylesheets/active_hashcash/application.css
|
41
|
+
- app/controllers/active_hashcash/addresses_controller.rb
|
42
|
+
- app/controllers/active_hashcash/application_controller.rb
|
43
|
+
- app/controllers/active_hashcash/assets_controller.rb
|
44
|
+
- app/controllers/active_hashcash/stamps_controller.rb
|
45
|
+
- app/helpers/active_hashcash/addresses_helper.rb
|
46
|
+
- app/helpers/active_hashcash/application_helper.rb
|
47
|
+
- app/helpers/active_hashcash/stamps_helper.rb
|
48
|
+
- app/jobs/active_hashcash/application_job.rb
|
49
|
+
- app/mailers/active_hashcash/application_mailer.rb
|
50
|
+
- app/models/active_hashcash/application_record.rb
|
51
|
+
- app/models/active_hashcash/stamp.rb
|
52
|
+
- app/views/active_hashcash/addresses/index.html.erb
|
53
|
+
- app/views/active_hashcash/assets/_logo.svg.erb
|
54
|
+
- app/views/active_hashcash/assets/_style.css
|
55
|
+
- app/views/active_hashcash/assets/application.css.erb
|
56
|
+
- app/views/active_hashcash/assets/ariato.css.erb
|
57
|
+
- app/views/active_hashcash/assets/favicon.ico
|
58
|
+
- app/views/active_hashcash/assets/favicon.svg.erb
|
59
|
+
- app/views/active_hashcash/assets/vendor/_ariato_base.css
|
60
|
+
- app/views/active_hashcash/assets/vendor/_ariato_extra.css
|
61
|
+
- app/views/active_hashcash/stamps/_filters.html.erb
|
62
|
+
- app/views/active_hashcash/stamps/index.html.erb
|
63
|
+
- app/views/active_hashcash/stamps/show.html.erb
|
64
|
+
- app/views/layouts/active_hashcash/application.html.erb
|
65
|
+
- config/locales/de.yml
|
66
|
+
- config/locales/en.yml
|
67
|
+
- config/locales/es.yml
|
68
|
+
- config/locales/fr.yml
|
69
|
+
- config/locales/it.yml
|
70
|
+
- config/locales/jp.yml
|
71
|
+
- config/locales/pt.yml
|
72
|
+
- config/routes.rb
|
73
|
+
- db/migrate/20240215143453_create_active_hashcash_stamps.rb
|
38
74
|
- lib/active_hashcash.rb
|
39
75
|
- lib/active_hashcash/engine.rb
|
40
76
|
- lib/active_hashcash/version.rb
|