passkit 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.example.env +2 -0
- data/CHANGELOG.md +8 -2
- data/README.md +24 -6
- data/app/controllers/passkit/dashboard/application_controller.rb +15 -0
- data/app/controllers/passkit/dashboard/logs_controller.rb +9 -0
- data/app/controllers/passkit/dashboard/passes_controller.rb +9 -0
- data/app/controllers/passkit/dashboard/previews_controller.rb +13 -0
- data/app/views/passkit/{logs → dashboard/logs}/index.html.erb +0 -0
- data/app/views/passkit/{passes → dashboard/passes}/index.html.erb +0 -0
- data/app/views/passkit/{previews → dashboard/previews}/index.html.erb +1 -1
- data/app/views/shared/passkit/_navigation.html.erb +3 -3
- data/config/routes.rb +1 -1
- data/lib/passkit/version.rb +1 -1
- data/lib/passkit.rb +11 -1
- metadata +51 -8
- data/app/controllers/passkit/logs_controller.rb +0 -9
- data/app/controllers/passkit/passes_controller.rb +0 -9
- data/app/controllers/passkit/previews_controller.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c77f5931476c4b0bdab479bd47e3c6a26946bc4f0925c6795b3c3161b367783
|
4
|
+
data.tar.gz: 18786694faa7fa5d1b025f11b56ee0f24208e9635905869ff5d5797f881faac8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e396a55c7825411eb575112ed16a71f026ac1016f325b0b29242431d18df0f7a65a62a9823776b4f01e4ffbc86f7fa6d7c36aa45184e46344c5de4538df2c6aa
|
7
|
+
data.tar.gz: a592af51cfa009eaa1ab233b4e54203fe501062fc2870c1cbb6710cbb203408313dd7ec0893a8a7d93803495e288d900d08eeb61563c7a7231db207339c4a171
|
data/.example.env
CHANGED
@@ -4,3 +4,5 @@ PASSKIT_PRIVATE_P12_CERTIFICATE=path/to/certificate.p12
|
|
4
4
|
PASSKIT_APPLE_INTERMEDIATE_CERTIFICATE=path/to/AppleWWDRCA.cer
|
5
5
|
PASSKIT_APPLE_TEAM_IDENTIFIER=XXXXXXXXXX
|
6
6
|
PASSKIT_PASS_TYPE_IDENTIFIER=pass.com.example.pass
|
7
|
+
PASSKIT_DASHBOARD_USERNAME=admin
|
8
|
+
PASSKIT_DASHBOARD_PASSWORD=admin
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
+
## [0.4.0]
|
2
|
+
|
3
|
+
- Allow to use the dashboard also in production.
|
4
|
+
- Allow to protect the dashboard using different strategies. Basic auth is default.
|
5
|
+
- Breaking: now your Passkit dashboard is mounted under `/passkit/dashboard` instead of just `/passkit`.
|
6
|
+
|
1
7
|
## [0.3.3]
|
2
8
|
|
3
|
-
- Fix previews page
|
9
|
+
- Fix previews page.
|
4
10
|
|
5
11
|
## [0.3.2]
|
6
12
|
|
@@ -12,4 +18,4 @@
|
|
12
18
|
|
13
19
|
## [0.1.0]
|
14
20
|
|
15
|
-
- Initial release
|
21
|
+
- Initial release.
|
data/README.md
CHANGED
@@ -22,11 +22,6 @@ This gem provides everything necessary to distribute Wallet Passes in pkpass for
|
|
22
22
|
* Push notifications: this is the most wanted feature I believe. Pull requests are welcome!
|
23
23
|
* Google Wallet integration: we use https://walletpasses.io/ on Android to read .pkpass format.
|
24
24
|
|
25
|
-
## Apple documentation
|
26
|
-
|
27
|
-
* [Apple Wallet Passes](https://developer.apple.com/documentation/walletpasses)
|
28
|
-
* [Send Push Notifications](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns)
|
29
|
-
|
30
25
|
## Installation
|
31
26
|
|
32
27
|
Add this line to your application's Gemfile:
|
@@ -79,10 +74,27 @@ If you followed the installation steps and you have the ENV variables set, we ca
|
|
79
74
|
|
80
75
|
### Dashboard
|
81
76
|
|
82
|
-
Head to `http://localhost:3000/passkit/previews` and you will see a first `ExampleStoreCard` available for download.
|
77
|
+
Head to `http://localhost:3000/passkit/dashboard/previews` and you will see a first `ExampleStoreCard` available for download.
|
83
78
|
You can click on the button and you will obtain a `.pkpass` file that you can simply open or install on your phone.
|
84
79
|
The dashboard has also a view for logs, and a view for emitted passes.
|
85
80
|
|
81
|
+
By default the dashboard is protected with basic auth. Set the credentials using these ENV variables:
|
82
|
+
* `PASSKIT_DASHBOARD_USERNAME`
|
83
|
+
* `PASSKIT_DASHBOARD_PASSWORD`
|
84
|
+
|
85
|
+
You can also change the authentication method used (see example below for Devise):
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
# config/passkit.rb
|
89
|
+
|
90
|
+
Passkit.configure do |config|
|
91
|
+
config.authenticate_dashboard_with do
|
92
|
+
warden.authenticate! scope: :user
|
93
|
+
## redirect_to main_app.root_path unless warden.user.admin? # if you want to check a specific role
|
94
|
+
end
|
95
|
+
end
|
96
|
+
```
|
97
|
+
|
86
98
|
### Mailer Helpers
|
87
99
|
|
88
100
|
If you use mailer previews, you can create the following file in `spec/mailers/previews/passkit/example_mailer_preview.rb`:
|
@@ -135,6 +147,12 @@ Again, check the example mailer included in the gem to see how to use it.
|
|
135
147
|
* In case of error "The passTypeIdentifier or teamIdentifier provided may not match your certificate,
|
136
148
|
or the certificate trust chain could not be verified." the certificate (p12) might be expired.
|
137
149
|
|
150
|
+
|
151
|
+
## Apple documentation
|
152
|
+
|
153
|
+
* [Apple Wallet Passes](https://developer.apple.com/documentation/walletpasses)
|
154
|
+
* [Send Push Notifications](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns)
|
155
|
+
|
138
156
|
## Development
|
139
157
|
|
140
158
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Passkit
|
2
|
+
module Dashboard
|
3
|
+
class ApplicationController < ActionController::Base
|
4
|
+
layout "passkit/application"
|
5
|
+
|
6
|
+
before_action :_authenticate_dashboard!
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def _authenticate_dashboard!
|
11
|
+
instance_eval(&Passkit.configuration.authenticate_dashboard_with)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Passkit
|
2
|
+
module Dashboard
|
3
|
+
class PreviewsController < ApplicationController
|
4
|
+
def index
|
5
|
+
end
|
6
|
+
|
7
|
+
def show
|
8
|
+
builder = Passkit.configuration.available_passes[params[:class_name]]
|
9
|
+
send_file Factory.create_pass(params[:class_name].constantize, builder.call)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
File without changes
|
File without changes
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<% Passkit.configuration.available_passes.each do |pass_class_name, _builder_function| %>
|
16
16
|
<article>
|
17
17
|
<h2><%= pass_class_name %></h2>
|
18
|
-
<%= link_to 'Generate and download',
|
18
|
+
<%= link_to 'Generate and download', dashboard_preview_path(pass_class_name) %>
|
19
19
|
</article>
|
20
20
|
<% end %>
|
21
21
|
</main>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<nav>
|
2
|
-
<%=link_to 'Logs',
|
3
|
-
<%=link_to 'Passes',
|
4
|
-
<%=link_to 'Passes Previews',
|
2
|
+
<%=link_to 'Logs', dashboard_logs_path %>
|
3
|
+
<%=link_to 'Passes', dashboard_passes_path %>
|
4
|
+
<%=link_to 'Passes Previews', dashboard_previews_path %>
|
5
5
|
</nav>
|
data/config/routes.rb
CHANGED
data/lib/passkit/version.rb
CHANGED
data/lib/passkit.rb
CHANGED
@@ -17,7 +17,7 @@ module Passkit
|
|
17
17
|
|
18
18
|
def self.configure
|
19
19
|
self.configuration ||= Configuration.new
|
20
|
-
yield(configuration)
|
20
|
+
yield(configuration) if block_given?
|
21
21
|
end
|
22
22
|
|
23
23
|
class Configuration
|
@@ -29,6 +29,16 @@ module Passkit
|
|
29
29
|
:apple_team_identifier,
|
30
30
|
:pass_type_identifier
|
31
31
|
|
32
|
+
DEFAULT_AUTHENTICATION = proc do
|
33
|
+
authenticate_or_request_with_http_basic("Passkit Dashboard. Login required") do |username, password|
|
34
|
+
username == ENV["PASSKIT_DASHBOARD_USERNAME"] && password == ENV["PASSKIT_DASHBOARD_PASSWORD"]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
def authenticate_dashboard_with(&block)
|
38
|
+
@authenticate = block if block
|
39
|
+
@authenticate || DEFAULT_AUTHENTICATION
|
40
|
+
end
|
41
|
+
|
32
42
|
def initialize
|
33
43
|
@available_passes = {"Passkit::ExampleStoreCard" => -> {}}
|
34
44
|
@web_service_host = ENV["PASSKIT_WEB_SERVICE_HOST"] || (raise "Please set PASSKIT_WEB_SERVICE_HOST")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Rodi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -80,6 +80,48 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: capybara
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: selenium-webdriver
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webrick
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
83
125
|
- !ruby/object:Gem::Dependency
|
84
126
|
name: standard
|
85
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,19 +163,20 @@ files:
|
|
121
163
|
- app/controllers/passkit/api/v1/logs_controller.rb
|
122
164
|
- app/controllers/passkit/api/v1/passes_controller.rb
|
123
165
|
- app/controllers/passkit/api/v1/registrations_controller.rb
|
124
|
-
- app/controllers/passkit/
|
125
|
-
- app/controllers/passkit/
|
126
|
-
- app/controllers/passkit/
|
166
|
+
- app/controllers/passkit/dashboard/application_controller.rb
|
167
|
+
- app/controllers/passkit/dashboard/logs_controller.rb
|
168
|
+
- app/controllers/passkit/dashboard/passes_controller.rb
|
169
|
+
- app/controllers/passkit/dashboard/previews_controller.rb
|
127
170
|
- app/mailers/passkit/example_mailer.rb
|
128
171
|
- app/models/passkit/device.rb
|
129
172
|
- app/models/passkit/log.rb
|
130
173
|
- app/models/passkit/pass.rb
|
131
174
|
- app/models/passkit/registration.rb
|
132
175
|
- app/views/layouts/passkit/application.html.erb
|
176
|
+
- app/views/passkit/dashboard/logs/index.html.erb
|
177
|
+
- app/views/passkit/dashboard/passes/index.html.erb
|
178
|
+
- app/views/passkit/dashboard/previews/index.html.erb
|
133
179
|
- app/views/passkit/example_mailer/example_email.html.erb
|
134
|
-
- app/views/passkit/logs/index.html.erb
|
135
|
-
- app/views/passkit/passes/index.html.erb
|
136
|
-
- app/views/passkit/previews/index.html.erb
|
137
180
|
- app/views/shared/passkit/_navigation.html.erb
|
138
181
|
- bin/console
|
139
182
|
- bin/setup
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Passkit
|
2
|
-
class PreviewsController < ActionController::Base
|
3
|
-
layout "passkit/application"
|
4
|
-
|
5
|
-
def index
|
6
|
-
end
|
7
|
-
|
8
|
-
def show
|
9
|
-
builder = Passkit.configuration.available_passes[params[:class_name]]
|
10
|
-
send_file Factory.create_pass(params[:class_name].constantize, builder.call)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|