active_material 2.1.1 → 2.1.2

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: 93275c327756af4eafee3c5542609ec05715b93c493640a1f9762a2222afcf10
4
- data.tar.gz: 2ad339e7948a534d497c2c41fec43aca0aca8abfc04f51e1c710b25121d77ef8
3
+ metadata.gz: 0befeef9159040b47e03da4f2d258451c580a0d9ab33b2e0c10e249e8a7ac556
4
+ data.tar.gz: 550bc54c62434b4c81b1156a7d402283f22e497051b4d47a660ae5631be40790
5
5
  SHA512:
6
- metadata.gz: 9824e96641f906684578de15c16fbda84188897cf22e40a260cf12f4fdb632c277e3647a6f253030f3fbf5be2fe7da4ae81d78bfbb9fa07ae5cfc35b7175d95b
7
- data.tar.gz: 7e745b586892691b733a7a001fd495e0724a84bf8eb31d5e4456d97829a4603a02002c1540c90fcd1a443de5d56bab763767f424ed7f42dbca251bfa9702760d
6
+ metadata.gz: d0d4ed26ce6857b0837e759b8113e3a6f598a80b6880b79669d9303fdf3f8d320366f2618048ebead4452c0c27cf09490c704c3a0d7fa89edce07c93bcf3a2d6
7
+ data.tar.gz: 9174bfa663d0b9ae7718de7558883adc9ff8df4c82dc7195e1fa0ee7c1b5fa5dfd3e95e42c25cf872d2a75092ac4f9594614b856b067798291c3ef9d46b999e3
@@ -3,10 +3,24 @@ module ActiveMaterial
3
3
  def build_active_admin_head
4
4
  within super do
5
5
  uri = URI.parse(ActiveMaterial::Rails::Engine.config.active_material.font_url)
6
- link(rel: "preconnect", href: uri.origin)
7
- link(rel: "preconnect", href: uri.origin, crossorigin: true)
6
+ origin = extract_origin(uri)
7
+
8
+ link(rel: "preconnect", href: origin)
9
+ link(rel: "preconnect", href: origin, crossorigin: true)
8
10
  link(rel: "stylesheet", href: uri.to_s)
9
11
  end
10
12
  end
13
+
14
+ private
15
+
16
+ def extract_origin(uri)
17
+ origin = "#{uri.scheme}://#{uri.host}"
18
+ origin += ":#{uri.port}" if uri.port && !default_port?(uri)
19
+ origin
20
+ end
21
+
22
+ def default_port?(uri)
23
+ (uri.scheme == 'http' && uri.port == 80) || (uri.scheme == 'https' && uri.port == 443)
24
+ end
11
25
  end
12
26
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveMaterial
2
- VERSION = "2.1.1"
2
+ VERSION = "2.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_material
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Kniffin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-16 00:00:00.000000000 Z
11
+ date: 2024-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler