flipper-ui 1.4.1 → 1.4.2

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: '019dbf0664d70ba33fd6425f7ba20bff41a1be13ff42c97b184ea37c2c500fd5'
4
- data.tar.gz: d1f2131f1d38cc5aa1ac4b0b5cc1298c914e8d4fd6e6f8693f218f6802977e8b
3
+ metadata.gz: 0cb0f4ab52d69d747f65f3a49aa89656138bb326434e0d4b9e21a6827479fea0
4
+ data.tar.gz: 227e30ad6e4d67f2b69e73a4aed099c8e91fb7651aad1c4a5bb54881ab925f97
5
5
  SHA512:
6
- metadata.gz: 9cee5defa8de58857b30dabf3db81047e61b1138bfaa090817d2b9b0732bc662bf7b1eaa4e5973cb59ae1ded71ccda44c178901450ccd20c7b2ebec5b79f292b
7
- data.tar.gz: 011ba0f8d3db3ef0efaab5e684d79beb9fee04c28dc660ec394b1cdfab37ac1c0af3c83ab3f1731a623cdd92a159d87c8f157f269b0d1eac269603603eba18be
6
+ metadata.gz: bd9a23b242736d416fc7ea1a84a5c8af833916211ba6963340d30025b625bb16a4addc0342df706fdf10a528f93f2817c3dd1f7ff6f45a53d974e74de6b0edb7
7
+ data.tar.gz: 564f9d333365d60310f141efd208de1c3a5957c3c20b828f2f024922952d79992eb833073d4634813c4c6f208de8e75d04a1fb1a5492356ba08a84cf6cca9958
@@ -8,6 +8,7 @@ module Flipper
8
8
  route %r{\A/settings\/import/?\Z}
9
9
 
10
10
  def post
11
+ render_read_only if read_only?
11
12
  contents = params['file'][:tempfile].read
12
13
  export = Flipper::Exporters::Json::Export.new(contents: contents)
13
14
  flipper.import(export)
@@ -45,6 +45,11 @@ module Flipper
45
45
  # false and it will go away. Defaults to true.
46
46
  attr_accessor :cloud_recommendation
47
47
 
48
+ # Public: Set to false to disable the version check that fetches the
49
+ # latest release from flippercloud.io. Useful when a strict Content
50
+ # Security Policy is in place. Defaults to true.
51
+ attr_accessor :version_check_enabled
52
+
48
53
  # Public: What should show up in the form to add actors. This can be
49
54
  # different per application since flipper_id's can be whatever an
50
55
  # application needs. Defaults to "a flipper id".
@@ -114,6 +119,7 @@ module Flipper
114
119
  @feature_removal_enabled = true
115
120
  @fun = true
116
121
  @cloud_recommendation = true
122
+ @version_check_enabled = true
117
123
  @add_actor_placeholder = "a flipper id"
118
124
  @descriptions_source = DEFAULT_DESCRIPTIONS_SOURCE
119
125
  @actor_names_source = DEFAULT_ACTOR_NAMES_SOURCE
@@ -18,8 +18,10 @@
18
18
  <%- end -%>
19
19
 
20
20
  <div class="text-muted small text-end">
21
- <a href="#" class="badge text-bg-warning ms-2 d-none" style="font-size:100%" id="new-version-badge" data-version="<%= Flipper::VERSION %>">
22
- </a>
21
+ <% if Flipper::UI.configuration.version_check_enabled %>
22
+ <a href="#" class="badge text-bg-warning ms-2 d-none" style="font-size:100%" id="new-version-badge" data-version="<%= Flipper::VERSION %>">
23
+ </a>
24
+ <% end %>
23
25
 
24
26
  <% if Flipper.deprecated_ruby_version? %>
25
27
  <a href="https://github.com/flippercloud/flipper/pull/776" class="badge text-bg-danger ms-2" style="font-size:100%">
@@ -83,6 +85,8 @@
83
85
  <script src="<%= script_name + popper_js[:src] %>" integrity="<%= popper_js[:hash] %>" crossorigin="anonymous"></script>
84
86
  <script src="<%= script_name + bootstrap_js[:src] %>" integrity="<%= bootstrap_js[:hash] %>" crossorigin="anonymous"></script>
85
87
  <script src="<%= script_name %>/js/application.js?v=<%= Flipper::VERSION %>"></script>
86
- <script src="<%= script_name %>/js/version.js?v=<%= Flipper::VERSION %>"></script>
88
+ <% if Flipper::UI.configuration.version_check_enabled %>
89
+ <script src="<%= script_name %>/js/version.js?v=<%= Flipper::VERSION %>"></script>
90
+ <% end %>
87
91
  </body>
88
92
  </html>
@@ -38,6 +38,7 @@
38
38
  </div>
39
39
  </div>
40
40
 
41
+ <% if write_allowed? %>
41
42
  <div class="card">
42
43
  <div class="card-header">
43
44
  <h4 class="m-0">Import</h4>
@@ -51,3 +52,4 @@
51
52
  </form>
52
53
  </div>
53
54
  </div>
55
+ <% end %>
@@ -1,5 +1,5 @@
1
1
  module Flipper
2
- VERSION = '1.4.1'.freeze
2
+ VERSION = '1.4.2'.freeze
3
3
 
4
4
  REQUIRED_RUBY_VERSION = '2.6'.freeze
5
5
  NEXT_REQUIRED_RUBY_VERSION = '3.0'.freeze
@@ -11,11 +11,12 @@ RSpec.describe Flipper::UI::Actions::Import do
11
11
  { :csrf => token, 'csrf' => token, '_csrf_token' => token }
12
12
  end
13
13
 
14
+ let(:path) { FlipperRoot.join("spec", "fixtures", "flipper_pstore_1679087600.json") }
15
+
14
16
  describe "POST /settings/import" do
15
17
  before do
16
18
  flipper.enable :plausible
17
19
  flipper.disable :google_analytics
18
- path = FlipperRoot.join("spec", "fixtures", "flipper_pstore_1679087600.json")
19
20
 
20
21
  post '/settings/import',
21
22
  {
@@ -37,5 +38,26 @@ RSpec.describe Flipper::UI::Actions::Import do
37
38
  expect(last_response.status).to be(302)
38
39
  expect(last_response.headers['location']).to eq('/features')
39
40
  end
41
+
42
+ context "when in read only mode" do
43
+ before do
44
+ allow(flipper).to receive(:read_only?) { true }
45
+
46
+ post '/settings/import',
47
+ {
48
+ 'authenticity_token' => token,
49
+ 'file' => Rack::Test::UploadedFile.new(path, "application/json"),
50
+ },
51
+ 'rack.session' => session
52
+ end
53
+
54
+ it 'returns 403' do
55
+ expect(last_response.status).to be(403)
56
+ end
57
+
58
+ it 'renders read only template' do
59
+ expect(last_response.body).to include('read only')
60
+ end
61
+ end
40
62
  end
41
63
  end
@@ -73,6 +73,17 @@ RSpec.describe Flipper::UI::Configuration do
73
73
  end
74
74
  end
75
75
 
76
+ describe "#version_check_enabled" do
77
+ it "has default value" do
78
+ expect(configuration.version_check_enabled).to eq(true)
79
+ end
80
+
81
+ it "can be updated" do
82
+ configuration.version_check_enabled = false
83
+ expect(configuration.version_check_enabled).to eq(false)
84
+ end
85
+ end
86
+
76
87
  describe "#feature_removal_enabled" do
77
88
  it "has default value" do
78
89
  expect(configuration.feature_removal_enabled).to eq(true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-25 00:00:00.000000000 Z
11
+ date: 2026-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -76,14 +76,14 @@ dependencies:
76
76
  requirements:
77
77
  - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: 1.4.1
79
+ version: 1.4.2
80
80
  type: :runtime
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
84
  - - "~>"
85
85
  - !ruby/object:Gem::Version
86
- version: 1.4.1
86
+ version: 1.4.2
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: erubi
89
89
  requirement: !ruby/object:Gem::Requirement
@@ -203,7 +203,7 @@ metadata:
203
203
  homepage_uri: https://www.flippercloud.io
204
204
  source_code_uri: https://github.com/flippercloud/flipper
205
205
  bug_tracker_uri: https://github.com/flippercloud/flipper/issues
206
- changelog_uri: https://github.com/flippercloud/flipper/releases/tag/v1.4.1
206
+ changelog_uri: https://github.com/flippercloud/flipper/releases/tag/v1.4.2
207
207
  funding_uri: https://github.com/sponsors/flippercloud
208
208
  post_install_message:
209
209
  rdoc_options: []