hubssolib 3.0.1 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36b026e98baa7f70c200a5abe0ff7e5e3a874e9aaf5a1f88c33114e45cb1ab14
4
- data.tar.gz: d19ff3d675d0b63286e06c03b6c3bce05be434a16f554533efde1152bb9c2641
3
+ metadata.gz: 891c5bc596ecfdd5f9f1e9b844ac77eaa443426607d55ba16110cc194baca3a8
4
+ data.tar.gz: 42ffee7f098f4c9cbd1eec9e42e2c0f2e10a700ebd85b083113b517cd6706619
5
5
  SHA512:
6
- metadata.gz: a8d0724e454ffab27e616a91b1aa9837d4aefa5dff6d871bb92671ddefda789626e7cf3ed2dc523b48d4a09bcb3210c81ff279c7e553d2d579c8b00d6af693dd
7
- data.tar.gz: 36f17712168ba66f8de41193c41959dfa3ddb81e1ae5c683f4f747d177a6e4f5643aee2a8b387eaa244f0945608ee88f70552143f58f344e2a4078dabbf65ea4
6
+ metadata.gz: 7d0046239b22405b6e6cf47d3e8e326bcc9f4c88a58ced4b13a3eab14fd822bb16bc63d3b06523a926abda7d46d53a15211000fdd9b7aff7e071ba2b708afd92
7
+ data.tar.gz: 0a1cd9ccaab6b08ae323ad572f3a563fa002c7a2250073cb0b76848f8f2c8879350828664fe37ee9a0590d134a8949dacb4419a54520569a3468d6a5b86eb3da
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 3.0.3, 10-Feb-2025
2
+
3
+ Change JavaScript code used for the login indicator so that simpler engines such as [Duktape](https://duktape.org) can run it. Operates correctly in script-enabled [NetSurf](https://www.netsurf-browser.org) now.
4
+
5
+ ## 3.0.2, 04-Feb-2025
6
+
7
+ Fixes a bug that could cause cookie deletions for login state indication to sometimes fail to work as expected.
8
+
1
9
  ## 3.0.0, 28-Jan-2025 and 3.0.1, 03-Feb-2025
2
10
 
3
11
  * The Hub "login indication" URL approach is now dropped, so layout templates **should be updated.**
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hubssolib (3.0.1)
4
+ hubssolib (3.0.3)
5
5
  base64 (~> 0.2)
6
6
  drb (~> 2.2)
7
7
 
@@ -29,7 +29,7 @@ GEM
29
29
  psych (5.2.3)
30
30
  date
31
31
  stringio
32
- rdoc (6.11.0)
32
+ rdoc (6.12.0)
33
33
  psych (>= 4.0.0)
34
34
  reline (0.6.0)
35
35
  io-console (~> 0.5)
@@ -37,7 +37,7 @@ GEM
37
37
  rspec-core (~> 3.13.0)
38
38
  rspec-expectations (~> 3.13.0)
39
39
  rspec-mocks (~> 3.13.0)
40
- rspec-core (3.13.2)
40
+ rspec-core (3.13.3)
41
41
  rspec-support (~> 3.13.0)
42
42
  rspec-expectations (3.13.3)
43
43
  diff-lcs (>= 1.2.0, < 2.0)
data/hubssolib.gemspec CHANGED
@@ -4,7 +4,7 @@ spec = Gem::Specification.new do |s|
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.name = 'hubssolib'
6
6
 
7
- s.version = '3.0.1'
7
+ s.version = '3.0.3'
8
8
  s.author = 'Andrew Hodgkinson and others'
9
9
  s.email = 'ahodgkin@rowing.org.uk'
10
10
  s.homepage = 'http://pond.org.uk/'
data/lib/hub_sso_lib.rb CHANGED
@@ -42,10 +42,10 @@ module HubSsoLib
42
42
  HUB_IDLE_TIME_LIMIT = 4 * 60 * 60
43
43
 
44
44
  # Shared cookie name.
45
- HUB_COOKIE_NAME = 'hubapp_shared_id'
45
+ HUB_COOKIE_NAME = :hubapp_shared_id
46
46
 
47
47
  # Principally for #hubssolib_account_link.
48
- HUB_LOGIN_INDICATOR_COOKIE = 'hubapp_shared_id_alive'
48
+ HUB_LOGIN_INDICATOR_COOKIE = :hubapp_shared_id_alive
49
49
  HUB_LOGIN_INDICATOR_COOKIE_VALUE = 'Y'
50
50
 
51
51
  # Bypass SSL, for testing purposes? Rails 'production' mode will
@@ -560,9 +560,14 @@ module HubSsoLib
560
560
  const logged_out_html = "#{helpers.j(logged_out_link)}";
561
561
  const container = document.getElementById('hubssolib_login_indication')
562
562
 
563
+ #{
564
+ # No '?.' support in NetSurf's JS engine, so can't do the match
565
+ # and pop in a single line via "?.pop() || ''".
566
+ }
563
567
  function hubSsoLibLoginStateWriteLink() {
564
568
  const regexp = '#{helpers.j(HUB_LOGIN_INDICATOR_COOKIE)}\\s*=\\s*([^;]+)';
565
- const flag = document.cookie.match(regexp)?.pop() || '';
569
+ const match = document.cookie.match(regexp);
570
+ const flag = (match ? match.pop() : null) || '';
566
571
 
567
572
  if (flag === '#{HUB_LOGIN_INDICATOR_COOKIE_VALUE}') {
568
573
  container.innerHTML = logged_in_html;
@@ -576,6 +581,7 @@ module HubSsoLib
576
581
  # login indications should thus arise from cached data.
577
582
  }
578
583
  hubSsoLibLoginStateWriteLink();
584
+ window.addEventListener('load', hubSsoLibLoginStateWriteLink);
579
585
  window.addEventListener('pageshow', hubSsoLibLoginStateWriteLink);
580
586
  </script>
581
587
  HTML
@@ -722,7 +728,7 @@ module HubSsoLib
722
728
  logged_in = hubssolib_logged_in?
723
729
 
724
730
  if logged_in == false
725
- cookies.delete(HUB_LOGIN_INDICATOR_COOKIE)
731
+ cookies.delete(HUB_LOGIN_INDICATOR_COOKIE, domain: :all, path: '/')
726
732
 
727
733
  if login_is_required
728
734
  hubssolib_store_location
@@ -736,8 +742,9 @@ module HubSsoLib
736
742
  #
737
743
  cookies[HUB_LOGIN_INDICATOR_COOKIE] = {
738
744
  value: HUB_LOGIN_INDICATOR_COOKIE_VALUE,
739
- domain: :all,
740
745
  path: '/',
746
+ domain: :all,
747
+ expires: 1.year, # I.e. *not* session-scope
741
748
  secure: ! hub_bypass_ssl?,
742
749
  httponly: false
743
750
  }
@@ -1039,8 +1046,8 @@ module HubSsoLib
1039
1046
 
1040
1047
  cookies[HUB_COOKIE_NAME] = {
1041
1048
  value: key,
1042
- domain: :all,
1043
1049
  path: '/',
1050
+ domain: :all,
1044
1051
  secure: ! hub_bypass_ssl?,
1045
1052
  httponly: true
1046
1053
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubssolib
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hodgkinson and others
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-03 00:00:00.000000000 Z
10
+ date: 2025-02-10 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: drb