darjeelink 0.14.4 → 0.14.6

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: e0f395d01b733415c7836867132dd888ac5f5dcd567a338e8d1d845d5e12a952
4
- data.tar.gz: fdf3c1b4f775a88169adacd74ae43529a00c1ae16f05df0e7f904226ae95d6e4
3
+ metadata.gz: 4303964ff9a26e9645a23dc23ddf42b0e4c0149d96bf0be0ff190cdabe45a3e9
4
+ data.tar.gz: 923d1bc1d321f08b66cf519bad76ce50c07418558ab15d2b97185071ffc9aee7
5
5
  SHA512:
6
- metadata.gz: 67c05cf3fab55ab937a75a511d55f231aef131b21fbb9baabcae3ba0819014346532e91d321b1674231e9bdce32f4bef7d52bf2e1eecc92635e62b6902fed322
7
- data.tar.gz: 914f84301d2cdd53df3501180082dc556b7bae47a415c4775fd750a07343a2f7fd466be5d49c37761bf76d653df4e003ac0e0f4c52fd6ca4c7d9d9b35cbf80a1
6
+ metadata.gz: 701f1be73fdefefed0ae84171fc7ac341bda12b182eaefb48bc1d3654781163b79a9c022dbcbe0097cd6542a8831ede814a251fdf9adf65b3bec6a39c6887053
7
+ data.tar.gz: cd5a66b7216dce4a247a5a3ce586caf75ec259653228e76e31daad7745a708fdacd2de6fb7f35fbfe757027077d90ac8573677663116a07da18cffd3017e45eb
data/README.md CHANGED
@@ -120,9 +120,32 @@ Change the database url to be different to the development one i.e. `postgres://
120
120
  ## Releasing
121
121
  Darjeelink follows [Semantic Versioning](https://semver.org)
122
122
 
123
+ ### Pre-releasing - Staging tests
124
+ There are several ways to test the gem before releasing it.
125
+
126
+ One way, is to check the new development branch into Github, and then use `portkey-app` to test it in a staging environment.
127
+
128
+ - Create a new branch in the `darjeelink` repo with a sensible name related to your intended release: e.g. `darjeelink-v0.14.6-upgrade`.
129
+ - Perform the required upgrades, security patching, etc for the new release.
130
+ - Bump the version number as required (see below).
131
+ - Create a new branch in the `portkey-app` repo with a sensible name related to your intdended release: e.g. `darjeelink-v0.14.6-upgrade`.
132
+ - In the `Gemfile` of the portkey-app repo, change the `darjeelink` gem to point to the branch you just created in the darjeelink repo.
133
+ ```gemfile
134
+ # Actual URL Shortener
135
+ # gem 'darjeelink' <-- Temporarilly change this. Remeber to change it back, and run bundle install to update the Gemfile.lock when done!
136
+ gem 'darjeelink', git: 'https://github.com/38degrees/darjeelink.git',
137
+ branch: 'darjeelink-v0.14.6-upgrade'
138
+ ```
139
+ - Update the `Gemfile.lock` in the `portkey-app` repo by running `bundle install` and commit then push the changes.
140
+ - Deploy your branch of the portkey-app to the staging environment and test the changes.
141
+
142
+ NB: When you have followed the production release steps below and created a GitHub release, you can then update the `Gemfile` in the `portkey-app` repo to point to the new release tag.
143
+
144
+ ### Releasing - Production
145
+
123
146
  Once all necessary changes have made it in to master and you are ready to do a release you need to do these steps.
124
147
 
125
- Note that if you are running in a vagrant VM, most of these steps can be done from within the VM.
148
+ Note that if you are running in a vagrant VM or `docker-shell.sh` constainer, most of these steps can be done from the terminal session.
126
149
 
127
150
  - Update `lib/darjeelink/version.rb` to the new version
128
151
  - Run `bundle install` to pick up the change in Gemfile.lock
@@ -131,6 +154,10 @@ Note that if you are running in a vagrant VM, most of these steps can be done fr
131
154
  - Run `gem build darjeelink.gemspec` this will output a file `darjeelink-X.X.X.gem` the version should match what version.rb and github.
132
155
  - Run `gem push darjeelink-X.X.X.gem`
133
156
 
157
+ ## TODOs
158
+
159
+ We have a few TODOs in the project. Please grep for TODO in the codebase to see them, and consider picking one up during maintainance.
160
+
134
161
  ## GDPR
135
162
  No personally identifiable data is stored about the public by this gem.
136
163
  It does not store information on individual clicks, only a counter of how many times a link has been clicked.
@@ -53,7 +53,7 @@ module Darjeelink
53
53
  def valid_authorization_token?(username_token)
54
54
  username, token = username_token.split ':'
55
55
 
56
- stored_token = ApiToken.find_by(username: username, active: true)&.token
56
+ stored_token = ApiToken.find_by(username:, active: true)&.token
57
57
  return false if stored_token.nil?
58
58
 
59
59
  ActiveSupport::SecurityUtils.secure_compare(
@@ -9,20 +9,27 @@ module Darjeelink
9
9
 
10
10
  private
11
11
 
12
+ # Disabling these rubocop rules. This is a simple function and tested in production sinve version 0.14.4.
13
+ #
14
+ # rubocop:disable Metrics/AbcSize
15
+ # rubocop:disable Layout/LineLength
12
16
  # Check user IP address against whitelist from ENV
13
17
  def check_ip_whitelist
14
18
  return unless Rails.env.production?
15
19
  return unless Rails.application.config.permitted_ips
20
+
16
21
  ip_to_verify = if Rails.application.config.respond_to?(:client_ip_header) && Rails.application.config.client_ip_header.present?
17
- request.headers[Rails.application.config.client_ip_header]
18
- else
19
- request.ip
20
- end
22
+ request.headers[Rails.application.config.client_ip_header]
23
+ else
24
+ request.ip
25
+ end
21
26
 
22
27
  return if Rails.application.config.permitted_ips.split(',').include? ip_to_verify
23
28
 
24
29
  render plain: 'Access Denied', status: :forbidden
25
30
  end
31
+ # rubocop:enable Metrics/AbcSize
32
+ # rubocop:enable Layout/LineLength
26
33
 
27
34
  # Authenticate against Google OAuth
28
35
  def authenticate
@@ -24,7 +24,7 @@ module Darjeelink
24
24
 
25
25
  def create_short_link(url, auto_generated_key, custom_key)
26
26
  shortened_path = custom_key.present? ? custom_key : auto_generated_key
27
- ::Darjeelink::ShortLink.create!(url: url, shortened_path: shortened_path)
27
+ ::Darjeelink::ShortLink.create!(url:, shortened_path:)
28
28
  rescue ActiveRecord::RecordNotUnique
29
29
  duplicates << "#{url}/#{custom_key || auto_generated_key}"
30
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Darjeelink
4
- VERSION = '0.14.4'
4
+ VERSION = '0.14.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: darjeelink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.4
4
+ version: 0.14.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Hulme
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-28 00:00:00.000000000 Z
11
+ date: 2024-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.9'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '3.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.9'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: omniauth-google-oauth2
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +64,14 @@ dependencies:
58
64
  requirements:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '6'
67
+ version: 6.1.7
62
68
  type: :runtime
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '6'
74
+ version: 6.1.7
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: rebrandly
71
77
  requirement: !ruby/object:Gem::Requirement
@@ -192,7 +198,7 @@ dependencies:
192
198
  - - ">="
193
199
  - !ruby/object:Gem::Version
194
200
  version: '0'
195
- description:
201
+ description:
196
202
  email:
197
203
  - james@38degrees.org.uk
198
204
  executables: []
@@ -244,8 +250,9 @@ files:
244
250
  homepage: https://github.com/38degrees/darjeelink
245
251
  licenses:
246
252
  - MIT
247
- metadata: {}
248
- post_install_message:
253
+ metadata:
254
+ rubygems_mfa_required: 'true'
255
+ post_install_message:
249
256
  rdoc_options: []
250
257
  require_paths:
251
258
  - lib
@@ -260,8 +267,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
267
  - !ruby/object:Gem::Version
261
268
  version: '0'
262
269
  requirements: []
263
- rubygems_version: 3.3.21
264
- signing_key:
270
+ rubygems_version: 3.3.26
271
+ signing_key:
265
272
  specification_version: 4
266
273
  summary: URL Shortener
267
274
  test_files: []