avo 2.3.1.pre.4 → 2.3.1.pre.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/app/assets/builds/avo.css +6 -0
- data/lib/avo/app.rb +4 -2
- data/lib/avo/licensing/h_q.rb +8 -5
- data/lib/avo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6256e502b9bb22a7d924ea43f8d0f6d7dbe6a28f9ad58877515f8d0a6954d481
|
4
|
+
data.tar.gz: 17956bd16b76b1f7017b20cbff9f841e8a7b942d7ad5d73c3442658e8bcfb7f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfea2ebe1abcbfcea4dfaf340791f44c7691a1b9b41ccfea534218aab32c0c4ec283a5494cb0369025690a0e4c73da42b04c3351aa9a5acf81bc30cf47d5af88
|
7
|
+
data.tar.gz: 6078470d3fe8efdb049f4bc49735589b6db7fb55bafe1417bd0130d5046a4b60a20246cff2c65464b72c6977ecea8b4bf4d141c53b95129c8be816056f552c58
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
avo (2.3.1.pre.
|
4
|
+
avo (2.3.1.pre.5)
|
5
5
|
active_link_to
|
6
6
|
addressable
|
7
7
|
breadcrumbs_on_rails
|
@@ -248,6 +248,8 @@ GEM
|
|
248
248
|
nokogiri (1.13.4)
|
249
249
|
mini_portile2 (~> 2.8.0)
|
250
250
|
racc (~> 1.4)
|
251
|
+
nokogiri (1.13.4-x86_64-linux)
|
252
|
+
racc (~> 1.4)
|
251
253
|
orm_adapter (0.5.0)
|
252
254
|
pagy (5.10.1)
|
253
255
|
activesupport
|
data/app/assets/builds/avo.css
CHANGED
data/lib/avo/app.rb
CHANGED
@@ -105,13 +105,15 @@ module Avo
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def main_menu
|
108
|
-
return
|
108
|
+
return [] if Avo::App.license.lacks_with_trial(:menu_builder)
|
109
|
+
return [] if Avo.configuration.main_menu.nil?
|
109
110
|
|
110
111
|
Avo::Menu::Builder.parse_menu(&Avo.configuration.main_menu)
|
111
112
|
end
|
112
113
|
|
113
114
|
def profile_menu
|
114
|
-
return
|
115
|
+
return [] if Avo::App.license.lacks_with_trial(:menu_builder)
|
116
|
+
return [] if Avo.configuration.profile_menu.nil?
|
115
117
|
|
116
118
|
Avo::Menu::Builder.parse_menu(&Avo.configuration.profile_menu)
|
117
119
|
end
|
data/lib/avo/licensing/h_q.rb
CHANGED
@@ -6,6 +6,7 @@ module Avo
|
|
6
6
|
ENDPOINT = "https://avohq.io/api/v1/licenses/check".freeze unless const_defined?(:ENDPOINT)
|
7
7
|
CACHE_KEY = "avo.hq.response".freeze unless const_defined?(:CACHE_KEY)
|
8
8
|
REQUEST_TIMEOUT = 5 unless const_defined?(:REQUEST_TIMEOUT) # seconds
|
9
|
+
CACHE_TIME = 3600 unless const_defined?(:CACHE_TIME) # seconds
|
9
10
|
|
10
11
|
def initialize(current_request)
|
11
12
|
@current_request = current_request
|
@@ -60,8 +61,8 @@ module Avo
|
|
60
61
|
field_types: field_types,
|
61
62
|
**other_metadata(:actions),
|
62
63
|
**other_metadata(:filters),
|
63
|
-
main_menu_present: Avo
|
64
|
-
profile_menu_present: Avo
|
64
|
+
main_menu_present: Avo.configuration.main_menu.present?,
|
65
|
+
profile_menu_present: Avo.configuration.profile_menu.present?,
|
65
66
|
}
|
66
67
|
end
|
67
68
|
|
@@ -94,10 +95,12 @@ module Avo
|
|
94
95
|
|
95
96
|
return cache_and_return_error "Avo HQ Internal server error.", hq_response.body if hq_response.code == 500
|
96
97
|
|
97
|
-
|
98
|
+
if hq_response.code == 200
|
99
|
+
cache_response response: hq_response.parsed_response
|
100
|
+
end
|
98
101
|
end
|
99
102
|
|
100
|
-
def cache_response(
|
103
|
+
def cache_response(response: nil, time: CACHE_TIME)
|
101
104
|
response.merge!(
|
102
105
|
expiry: time,
|
103
106
|
fetched_at: Time.now,
|
@@ -135,7 +138,7 @@ module Avo
|
|
135
138
|
end
|
136
139
|
|
137
140
|
def cache_and_return_error(error, exception_message = "")
|
138
|
-
cache_response
|
141
|
+
cache_response response: {error: error, exception_message: exception_message}.stringify_keys, time: 5.minutes.to_i
|
139
142
|
end
|
140
143
|
|
141
144
|
def has_cached_response
|
data/lib/avo/version.rb
CHANGED