Skip to content

Commit 249b46f

Browse files
authored
Merge pull request #426 from themarshallproject/develop
v0.5.0
2 parents a5514e3 + dda946b commit 249b46f

File tree

15 files changed

+74
-48
lines changed

15 files changed

+74
-48
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
# Includes ruby, node, and chrome/phantomjs
88
# TODO: Go back to the non-legacy version of this image, when our test
99
# infrastructure no longer depends on phantomjs
10-
- image: circleci/ruby:2.5.7 # ...with this image as the primary container; this is where all `steps` will run
10+
- image: cimg/ruby:2.7.2 # ...with this image as the primary container; this is where all `steps` will run
1111
environment: # environment variables for primary container
1212
BUNDLE_JOBS: 3
1313
BUNDLE_RETRY: 3

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.5.7
1+
2.7.2

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ruby:2.5.7
1+
FROM ruby:2.7.2
22

33
# throw errors if Gemfile has been modified since Gemfile.lock
44
RUN bundle config --global frozen 1

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
source 'https://rubygems.org'
2-
ruby '2.5.7'
2+
ruby '2.7.2'
33

44
gem 'rails', '~> 6.0'
55
gem 'pg', '~> 0.21'
66
gem 'sass-rails', '~> 5.0'
77
gem 'uglifier', '>= 1.3.0'
8-
gem 'therubyracer'
8+
gem 'mini_racer', '~> 0.3'
99

1010
gem 'dotenv'
1111
gem 'jquery-rails'
@@ -28,7 +28,7 @@ gem 'httparty'
2828
gem 'diffy'
2929
gem 'kramdown'
3030

31-
gem 'aws-sdk-sqs', '~> 1.30'
31+
gem 'aws-sdk-sqs', '~> 1.35'
3232

3333
group :development, :test do
3434
gem 'byebug'

Gemfile.lock

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ GEM
5959
addressable (2.7.0)
6060
public_suffix (>= 2.0.2, < 5.0)
6161
aws-eventstream (1.1.0)
62-
aws-partitions (1.368.0)
63-
aws-sdk-core (3.105.0)
62+
aws-partitions (1.409.0)
63+
aws-sdk-core (3.110.0)
6464
aws-eventstream (~> 1, >= 1.0.2)
6565
aws-partitions (~> 1, >= 1.239.0)
6666
aws-sigv4 (~> 1.1)
6767
jmespath (~> 1.0)
68-
aws-sdk-sqs (1.32.0)
69-
aws-sdk-core (~> 3, >= 3.99.0)
68+
aws-sdk-sqs (1.35.0)
69+
aws-sdk-core (~> 3, >= 3.109.0)
7070
aws-sigv4 (~> 1.1)
7171
aws-sigv4 (1.2.2)
7272
aws-eventstream (~> 1, >= 1.0.2)
7373
bcrypt (3.1.16)
7474
bindex (0.8.1)
75-
bootsnap (1.4.8)
75+
bootsnap (1.5.1)
7676
msgpack (~> 1.0)
7777
builder (3.2.4)
7878
byebug (11.1.3)
@@ -87,8 +87,8 @@ GEM
8787
execjs
8888
coffee-script-source (1.12.2)
8989
concurrent-ruby (1.1.7)
90-
crack (0.4.3)
91-
safe_yaml (~> 1.0.0)
90+
crack (0.4.5)
91+
rexml
9292
crass (1.0.6)
9393
css_parser (1.7.1)
9494
addressable
@@ -97,7 +97,7 @@ GEM
9797
diffy (3.4.0)
9898
docile (1.1.5)
9999
dotenv (2.7.6)
100-
erubi (1.9.0)
100+
erubi (1.10.0)
101101
execjs (2.7.0)
102102
factory_bot (6.1.0)
103103
activesupport (>= 5.0.0)
@@ -127,7 +127,7 @@ GEM
127127
httparty (0.18.1)
128128
mime-types (~> 3.0)
129129
multi_xml (>= 0.5.2)
130-
i18n (1.8.5)
130+
i18n (1.8.7)
131131
concurrent-ruby (~> 1.0)
132132
jmespath (1.4.0)
133133
jquery-rails (4.4.0)
@@ -142,11 +142,11 @@ GEM
142142
addressable (~> 2.7)
143143
letter_opener (1.7.0)
144144
launchy (~> 2.2)
145-
libv8 (3.16.14.19)
145+
libv8 (8.4.255.0)
146146
listen (3.2.1)
147147
rb-fsevent (~> 0.10, >= 0.10.3)
148148
rb-inotify (~> 0.9, >= 0.9.10)
149-
loofah (2.7.0)
149+
loofah (2.9.0)
150150
crass (~> 1.0.2)
151151
nokogiri (>= 1.5.9)
152152
lumberjack (1.2.8)
@@ -160,16 +160,19 @@ GEM
160160
mime-types-data (3.2020.0512)
161161
mimemagic (0.3.5)
162162
mini_mime (1.0.2)
163-
mini_portile2 (2.4.0)
164-
minitest (5.14.2)
163+
mini_portile2 (2.5.0)
164+
mini_racer (0.3.1)
165+
libv8 (~> 8.4.255)
166+
minitest (5.14.3)
165167
msgpack (1.3.3)
166168
multi_xml (0.6.0)
167169
mustermann (1.1.1)
168170
ruby2_keywords (~> 0.0.1)
169171
nenv (0.3.0)
170172
nio4r (2.5.3)
171-
nokogiri (1.10.10)
172-
mini_portile2 (~> 2.4.0)
173+
nokogiri (1.11.1)
174+
mini_portile2 (~> 2.5.0)
175+
racc (~> 1.4)
173176
notiffany (0.1.3)
174177
nenv (~> 0.1)
175178
shellany (~> 0.0)
@@ -187,8 +190,9 @@ GEM
187190
public_suffix (4.0.6)
188191
puma (4.3.6)
189192
nio4r (~> 2.0)
193+
racc (1.5.2)
190194
rack (2.2.3)
191-
rack-cache (1.12.0)
195+
rack-cache (1.12.1)
192196
rack (>= 0.4)
193197
rack-protection (2.1.0)
194198
rack
@@ -234,7 +238,6 @@ GEM
234238
rb-inotify (0.10.1)
235239
ffi (~> 1.0)
236240
rdoc (6.2.1)
237-
ref (2.0.0)
238241
rexml (3.2.4)
239242
rspec (3.9.0)
240243
rspec-core (~> 3.9.0)
@@ -260,7 +263,6 @@ GEM
260263
rspec_junit_formatter (0.4.1)
261264
rspec-core (>= 2, < 4, != 2.12.0)
262265
ruby2_keywords (0.0.2)
263-
safe_yaml (1.0.5)
264266
sass (3.7.4)
265267
sass-listen (~> 4.0.0)
266268
sass-listen (4.0.0)
@@ -275,7 +277,7 @@ GEM
275277
sdoc (1.0.0)
276278
rdoc (>= 5.0)
277279
shellany (0.0.1)
278-
simple_form (5.0.2)
280+
simple_form (5.0.3)
279281
actionpack (>= 5.0)
280282
activemodel (>= 5.0)
281283
simplecov (0.13.0)
@@ -296,16 +298,13 @@ GEM
296298
actionpack (>= 4.0)
297299
activesupport (>= 4.0)
298300
sprockets (>= 3.0.0)
299-
therubyracer (0.12.3)
300-
libv8 (~> 3.16.14.15)
301-
ref
302301
thor (1.0.1)
303302
thread_safe (0.3.6)
304303
tilt (2.0.10)
305304
turbolinks (5.2.1)
306305
turbolinks-source (~> 5.2)
307306
turbolinks-source (5.2.0)
308-
tzinfo (1.2.7)
307+
tzinfo (1.2.9)
309308
thread_safe (~> 0.1)
310309
uglifier (4.2.0)
311310
execjs (>= 0.3.0, < 3)
@@ -314,20 +313,20 @@ GEM
314313
activemodel (>= 5.0)
315314
bindex (>= 0.4.0)
316315
railties (>= 5.0)
317-
webmock (3.8.3)
316+
webmock (3.11.1)
318317
addressable (>= 2.3.6)
319318
crack (>= 0.3.2)
320319
hashdiff (>= 0.4.0, < 2.0.0)
321320
websocket-driver (0.7.3)
322321
websocket-extensions (>= 0.1.0)
323322
websocket-extensions (0.1.5)
324-
zeitwerk (2.4.0)
323+
zeitwerk (2.4.2)
325324

326325
PLATFORMS
327326
ruby
328327

329328
DEPENDENCIES
330-
aws-sdk-sqs (~> 1.30)
329+
aws-sdk-sqs (~> 1.35)
331330
bcrypt (~> 3.1.12)
332331
bootsnap
333332
byebug
@@ -343,6 +342,7 @@ DEPENDENCIES
343342
jwt
344343
kramdown
345344
letter_opener
345+
mini_racer (~> 0.3)
346346
pg (~> 0.21)
347347
premailer-rails
348348
puma (~> 4.3)
@@ -357,14 +357,13 @@ DEPENDENCIES
357357
simple_form (~> 5.0)
358358
sinatra
359359
spring
360-
therubyracer
361360
turbolinks
362361
uglifier (>= 1.3.0)
363362
web-console (~> 3.7)
364363
webmock
365364

366365
RUBY VERSION
367-
ruby 2.5.7p206
366+
ruby 2.7.2p137
368367

369368
BUNDLED WITH
370-
1.17.3
369+
2.2.5

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,22 @@ Click on the button that says “Manage App”. This takes you behind the scenes
7070

7171
Unfortunately our email provider Sendgrid now requires an additional step to confirm that you are not a spammer. Your new Sendgrid account is now in a "suspended" state, and to get it unsuspended you have to contact [Sendgrid support](https://support.sendgrid.com/hc/en-us/requests/new#login-issue). You can do this by clicking the Sendgrid logo on the Resources tab. If clicking on the logo takes you to an error page, do not worry. This has been known to happen as Sendgrid's system has undergone redesigns. Instead, go to [Sendgrid's page to ask for support](https://support.sendgrid.com/hc/en-us/requests/new#login-issue). Be sure to use the same email address associated with your Heroku account and provide the url of your Klaxon instance. When they ask for "Business impact," choose "P3 General - You have a question about Sendgrid or how to use its products". This step is a nuisance, but important. **You will not be able to get an email log in to Klaxon until you are cleared by Sendgrid.** This usually happens pretty quickly (hours not days).
7272

73+
Unfortunately you are not yet done configuring Sendgrid. There are more steps to set up your account.
74+
75+
1. From the Heroku application page, click on the "Resources" tab, and click the link to the Sendgrid plugin, this will take you to the Sendgrid website.
76+
2. In the left hand column choose Settings -> API Keys. Click the blue "Create an API Key" button in the top right corner.
77+
3. In the form that appears fill in the API key name (doesn't matter what you name it), make sure the "Full Access" option is selected, and click "Create & View".
78+
4. Click the API key to copy it to your clipboard. Then navigate back to Heroku.
79+
5. In the "Settings" tab of your Heroku app click the "Reveal Config Vars" button.
80+
6. Change the `SENDGRID_PASSWORD` variable to the API Key by clicking the pencil icon next to it, pasting it in, and saving it.
81+
7. Change the `SENDGRID_USERNAME` variable to the string "apikey" in the same manner.
82+
83+
Now you'll need to set up a "Verified Sender" account in Sendgrid using an email address that you have access to. See https://github.com/themarshallproject/klaxon/issues/404 for some more context.
84+
85+
When you've completed this process in Sendgrid, you'll need to set the `MAILER_FROM_ADDRESS` variable as you did above to your verified sender email address.
86+
87+
Finally, now, you should be done setting up your Sendgrid account.
88+
7389
At the top of the scheduler page, click the link that is the name of your app (“sl-klaxon”). This will take you to back to Klaxon's dashboard. Then click the button in the upper right that says "Open app," and this should take you to your Klaxon's login screen on the web.
7490

7591
![](docs/login_screen.png)

SENDGRID.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Last week Sendgrid identified that some accounts had their credentials posted online. They accordingly reset the passwords of those accounts. If your account (like ours) was affected you would have received an email about it. Unfortunately this means that the connection between your Klaxon instance and Sendgrid has been broken. If your emails are not sending properly (which you can test simply by trying to log in to Klaxon), you may need to follow these steps.
1+
Sendgrid requires that you authenticate using an API key, instead of the user name and password that they automatically provide through the plugin. Unfortunately this means that some manual steps are required to properly configure your Klaxon instance. You will create an API key for Sendgrid, and set it as the Sendgrid password.
22

3-
1. From the Heroku application page, click on the "Resources" tab, and click the link to the Sendgrid plugin, this will take you to the Sendgrid website.
3+
1. From the Heroku application page, click on the "Resources" tab, and click the link to the Sendgrid plugin, this will take you to the Sendgrid website, which will ask you to update your email. Be sure to put your real email address you use for Klaxon.
44
2. In the left hand column choose Settings -> API Keys. Click the blue "Create an API Key" button in the top right corner.
55
3. In the form that appears fill in the API key name (doesn't matter what you name it), make sure the "Full Access" option is selected, and click "Create & View".
66
4. Click the API key to copy it to your clipboard. Then navigate back to Heroku.
77
5. In the "Settings" tab of your Heroku app click the "Reveal Config Vars" button.
88
6. Change the `SENDGRID_PASSWORD` variable to the API Key by clicking the pencil icon next to it, pasting it in, and saving it.
99
7. Change the `SENDGRID_USERNAME` variable to the string "apikey" in the same manner.
1010

11-
You should be all set! Confirm that your changes worked as expected by trying to log in to Klaxon again, and ensuring that the login email arrives as expected.
11+
You should be all set! Confirm that your changes worked as expected by trying to log in to Klaxon, and ensuring that the login email arrives as expected.

app.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"website": "https://github.com/themarshallproject/klaxon",
66
"repository": "https://github.com/themarshallproject/klaxon",
77
"success_url": "/",
8+
"stack": "heroku-20",
89
"scripts": {
910
"postdeploy": "bash ./postdeploy.sh"
1011
},

app/lib/safe_string.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ class SafeString
22
# this should always produce a valid UTF-8 string
33
# diffing/etc will fail if it's nil, non-utf8, etc
44
def self.coerce(dirty)
5-
dirty.to_s.force_encoding("UTF-8").encode("UTF-8", invalid: :replace, replace: "")
5+
(+dirty.to_s).force_encoding("UTF-8").encode("UTF-8", invalid: :replace, replace: "")
66
end
77
end

app/models/page.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ def document
3737
end
3838

3939
def match_text
40-
@match = document.css(self.css_selector)
40+
@match = document.css(self.css_selector.strip)
4141

4242
if self.exclude_selector.present?
4343
# Set the content of the exclude selector to the empty string
44-
@match.css(self.exclude_selector).each do |node|
44+
@match.css(self.exclude_selector.strip).each do |node|
4545
node.content = ""
4646
end
4747
end
@@ -50,7 +50,7 @@ def match_text
5050
end
5151

5252
def match_html
53-
document.css(self.css_selector).to_html
53+
document.css(self.css_selector.strip).to_html
5454
end
5555

5656
def sha2_hash
@@ -59,6 +59,8 @@ def sha2_hash
5959

6060
def sanitize
6161
self.url = url.strip
62+
self.css_selector = css_selector.strip unless self.css_selector.nil?
63+
self.exclude_selector = exclude_selector.strip unless self.exclude_selector.nil?
6264
end
6365

6466
def update_subscriptions

0 commit comments

Comments
 (0)