adamantite 0.0.13 → 0.0.14
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/adamantite.rb +5 -2
- data/lib/base/adamantite.rb +21 -14
- 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: 9f7cf1f6c53600d5d0c68d944098a7a98d3ae2715ed7aa48f54df72516c3722b
|
4
|
+
data.tar.gz: df595ee6fba2497f98ce2ac8446133207475861e6ea9681992e6e36f6b125fb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52b8593789453bbbcfa7a5fc9e75a166a0da8e14dbb6f639d08d5438b8acd7a977f7ca1929245f2a0ad5a31f7c10462f7d1b4f76b46bf551053c91c23a257eb9
|
7
|
+
data.tar.gz: 897783faaf123f26f8076b7cd25deb1c37e41138f53b0e660252077e433e22dcaae75d0487d4deccdffcf571cc7b79f3bf74278c7157f1bd8f34a2b20b493070
|
data/lib/adamantite.rb
CHANGED
@@ -147,8 +147,11 @@ module Adamantite
|
|
147
147
|
end
|
148
148
|
horizontal_box do
|
149
149
|
stretchy false
|
150
|
-
|
151
|
-
|
150
|
+
free_or_paid = @adamantite.free_tier ? 'free' : 'paid'
|
151
|
+
label_text = <<-TEXT
|
152
|
+
This is valid Adamantite installation on a #{free_or_paid} license.
|
153
|
+
TEXT
|
154
|
+
label(label_text)
|
152
155
|
end
|
153
156
|
end
|
154
157
|
else
|
data/lib/base/adamantite.rb
CHANGED
@@ -12,7 +12,7 @@ module Adamantite
|
|
12
12
|
include AdamantiteFileUtils
|
13
13
|
|
14
14
|
attr_reader :authenticated, :master_password, :master_password_salt, :stored_passwords,
|
15
|
-
:master_license_key
|
15
|
+
:master_license_key, :free_tier
|
16
16
|
|
17
17
|
OPSLIMIT = 2**20
|
18
18
|
MEMLIMIT = 2**24
|
@@ -50,22 +50,11 @@ module Adamantite
|
|
50
50
|
def activate_license!(master_license_key)
|
51
51
|
return unless authenticated?
|
52
52
|
|
53
|
-
|
54
|
-
'Content-Type': 'application/vnd.api+json',
|
55
|
-
'Accept': 'application/vnd.api+json'
|
56
|
-
}
|
57
|
-
body = {
|
58
|
-
'meta': {
|
59
|
-
'key': master_license_key,
|
60
|
-
'scope': {
|
61
|
-
'product': 'bb6542ab-7d74-44d0-b4f5-1fbc39cdeb99'
|
62
|
-
}
|
63
|
-
}
|
64
|
-
}
|
65
|
-
res = HTTParty.post(LICENSE_ACTIVATION_URL, headers: headers, body: body.to_json)
|
53
|
+
res = get_license_info(master_license_key)
|
66
54
|
|
67
55
|
if res['meta']['valid']
|
68
56
|
@master_license_key = master_license_key
|
57
|
+
@free_tier = res['data']['attributes']['name'] == 'Adamantite Free'
|
69
58
|
write_to_file(password_file('master_license_key'), @vault.encrypt(@master_license_key), true)
|
70
59
|
true
|
71
60
|
end
|
@@ -192,6 +181,24 @@ module Adamantite
|
|
192
181
|
return unless authenticated?
|
193
182
|
|
194
183
|
@master_license_key = @vault.decrypt(get_license_key)
|
184
|
+
res = get_license_info(@master_license_key)
|
185
|
+
@free_tier = res['data']['attributes']['name'] == 'Adamantite Free'
|
186
|
+
end
|
187
|
+
|
188
|
+
def get_license_info(license_key)
|
189
|
+
headers = {
|
190
|
+
'Content-Type': 'application/vnd.api+json',
|
191
|
+
'Accept': 'application/vnd.api+json'
|
192
|
+
}
|
193
|
+
body = {
|
194
|
+
'meta': {
|
195
|
+
'key': license_key,
|
196
|
+
'scope': {
|
197
|
+
'product': 'bb6542ab-7d74-44d0-b4f5-1fbc39cdeb99'
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
HTTParty.post(LICENSE_ACTIVATION_URL, headers: headers, body: body.to_json)
|
195
202
|
end
|
196
203
|
end
|
197
204
|
end
|