opengraphplus 0.1.15 → 0.1.16
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 +4 -4
- data/lib/generators/opengraphplus/install/templates/initializer.rb +4 -0
- data/lib/opengraphplus/configuration.rb +16 -2
- data/lib/opengraphplus/rails/controller.rb +1 -7
- data/lib/opengraphplus/rails/helper.rb +1 -1
- data/lib/opengraphplus/signature/url.rb +1 -1
- data/lib/opengraphplus/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 560d079e7cf4a5ef84766fd42c4b012197d2dc7d6ea10220e56ec8a0a1af99fc
|
|
4
|
+
data.tar.gz: d348f8e8a9e80d83ef76bdf3b71e87bffb2491b77d67e16167532a11872ae270
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 720d8ddd5464df7581e8e7c30a51265a6cfed6cc5888140e546c8af47e970eab700928f4fd592c2c04477639dfd050f7c126464759cd72c079ed2d9278f0ac9a
|
|
7
|
+
data.tar.gz: b0f00ec27e925aabd42b69e2287c884fc48702b660d3f9059a9d911078be0a52e082ec06643de47f0a2617c96a19c54ea2a5071e63b568743074fdc233acdd0d
|
|
@@ -7,4 +7,8 @@ OpenGraphPlus.configure do |config|
|
|
|
7
7
|
|
|
8
8
|
# Or use ENV:
|
|
9
9
|
# config.api_key = ENV["OGPLUS__API_KEY"]
|
|
10
|
+
|
|
11
|
+
# Set base_url for static site generators (e.g., Sitepress) where
|
|
12
|
+
# request.url is not available at compile time:
|
|
13
|
+
# config.base_url = "https://example.com"
|
|
10
14
|
end
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "uri"
|
|
4
|
+
|
|
3
5
|
module OpenGraphPlus
|
|
4
6
|
class Configuration
|
|
5
7
|
DEFAULT_URL = "https://opengraphplus.com"
|
|
6
8
|
|
|
7
|
-
attr_accessor :
|
|
9
|
+
attr_accessor :api_url, :base_url
|
|
8
10
|
|
|
9
11
|
def initialize
|
|
10
12
|
@api_key = nil
|
|
11
|
-
@
|
|
13
|
+
@api_url = DEFAULT_URL
|
|
14
|
+
@base_url = nil
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def resolve_url(request)
|
|
18
|
+
if @base_url
|
|
19
|
+
URI.join(@base_url, request.path).to_s
|
|
20
|
+
elsif request.respond_to?(:host) && request.host.present?
|
|
21
|
+
request.url
|
|
22
|
+
else
|
|
23
|
+
warn "[OpenGraphPlus] Cannot determine site URL. Set OpenGraphPlus.configuration.base_url for static site generation."
|
|
24
|
+
nil
|
|
25
|
+
end
|
|
12
26
|
end
|
|
13
27
|
|
|
14
28
|
def api_key
|
|
@@ -8,7 +8,6 @@ module OpenGraphPlus
|
|
|
8
8
|
|
|
9
9
|
included do
|
|
10
10
|
helper_method :open_graph, :open_graph_tags, :open_graph_meta_tags, :open_graph_plus_image_url
|
|
11
|
-
before_action :set_default_open_graph
|
|
12
11
|
append_before_action :set_default_open_graph_image
|
|
13
12
|
end
|
|
14
13
|
|
|
@@ -18,17 +17,12 @@ module OpenGraphPlus
|
|
|
18
17
|
end
|
|
19
18
|
end
|
|
20
19
|
|
|
21
|
-
def open_graph_plus_image_url(source_url =
|
|
20
|
+
def open_graph_plus_image_url(source_url = open_graph.url)
|
|
22
21
|
OpenGraphPlus.image_url(source_url)
|
|
23
22
|
end
|
|
24
23
|
|
|
25
24
|
private
|
|
26
25
|
|
|
27
|
-
def set_default_open_graph
|
|
28
|
-
open_graph.type = "website"
|
|
29
|
-
open_graph.url = request.url
|
|
30
|
-
end
|
|
31
|
-
|
|
32
26
|
def set_default_open_graph_image
|
|
33
27
|
open_graph.image.url ||= open_graph_plus_image_url
|
|
34
28
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opengraphplus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.16
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brad Gessler
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-02-13 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activesupport
|