Skip to content

Commit c183b5a

Browse files
dblockCopilot
andcommitted
Upgrade framework and version website assets
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent aee1d45 commit c183b5a

12 files changed

Lines changed: 79 additions & 18 deletions

File tree

‎.rubocop_todo.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2025-10-01 17:50:25 UTC using RuboCop version 1.81.1.
3+
# on 2026-10-25 21:30:32 UTC using RuboCop version 1.81.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -44,7 +44,7 @@ RSpec/ContextWording:
4444
- 'spec/slack-api-explorer/commands/slack_spec.rb'
4545
- 'spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb'
4646

47-
# Offense count: 12
47+
# Offense count: 14
4848
# Configuration parameters: CountAsOne.
4949
RSpec/ExampleLength:
5050
Max: 27
@@ -67,7 +67,7 @@ RSpec/LetSetup:
6767
RSpec/MessageSpies:
6868
EnforcedStyle: receive
6969

70-
# Offense count: 26
70+
# Offense count: 29
7171
RSpec/MultipleExpectations:
7272
Max: 7
7373

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Changelog
22

3+
* 2026/10/25: Upgrade slack-ruby-bot-server to 2.3.0 and rack-server-pages to 0.3.0, version local website assets, and centrally configure private, revalidating page caching without changing Slack installation or API behavior - [@dblock](https://github.com/dblock), [@Copilot](https://github.com/apps/copilot-swe-agent).
34
* 2023/01/16: Replaced Travis-CI with GHA - [@dblock](https://github.com/dblock).
45
* 2018/05/10: Use ERB instead of static pages - [@dblock](https://github.com/dblock).
56
* 2017/03/14: Use slack-ruby-bot-server - [@dblock](https://github.com/dblock).

‎Gemfile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ gem 'ostruct'
1313
gem 'puma'
1414
gem 'rack'
1515
gem 'rack-robotz'
16-
gem 'rack-server-pages'
16+
gem 'rack-server-pages', '~> 0.3.0'
17+
gem 'slack-ruby-bot-server', '~> 2.3.0'
1718
gem 'slack-ruby-bot-server-mailchimp'
1819
gem 'slack-ruby-bot-server-rtm'
1920

‎Gemfile.lock‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ GEM
229229
rack-rewrite (1.5.1)
230230
rack-robotz (0.0.4)
231231
rack
232-
rack-server-pages (0.2.1)
232+
rack-server-pages (0.3.0)
233233
rack
234234
rack-test (2.2.0)
235235
rack (>= 1.3)
@@ -305,7 +305,7 @@ GEM
305305
activesupport
306306
hashie
307307
slack-ruby-client (>= 0.14.0)
308-
slack-ruby-bot-server (2.2.0)
308+
slack-ruby-bot-server (2.3.0)
309309
async
310310
foreman
311311
grape
@@ -390,7 +390,7 @@ DEPENDENCIES
390390
puma
391391
rack
392392
rack-robotz
393-
rack-server-pages
393+
rack-server-pages (~> 0.3.0)
394394
rack-test
395395
rackup
396396
rake
@@ -400,6 +400,7 @@ DEPENDENCIES
400400
rubocop-rake
401401
rubocop-rspec
402402
selenium-webdriver
403+
slack-ruby-bot-server (~> 2.3.0)
403404
slack-ruby-bot-server-mailchimp
404405
slack-ruby-bot-server-rtm
405406
vcr

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ Post a message into a channel.
2121

2222
![](public/img/post.gif)
2323

24+
## Website asset caching
25+
26+
Local scripts and images use content-hashed `asset_path` URLs from rack-server-pages 0.3.0. The custom middleware applies slack-ruby-bot-server 2.3.0's `config.server_pages` callback, setting `Cache-Control: private, no-cache` for rendered pages so browsers revalidate and discover changed asset URLs. Static files retain the middleware's content ETags and timestamp validation defaults, without long-lived or immutable caching. Versioned URLs are cache keys, not archives; old query strings still serve current files.
27+
2428
## Usage
2529

2630
### Help
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SlackRubyBotServer.configure do |config|
2+
config.server_pages do |pages|
3+
pages.cache_control = 'private, no-cache'
4+
end
5+
end
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<body style="text-align: left; margin: 50px;">
88
<p style="text-align: center">
9-
<img src='img/icon.png' width="100px" height="100px">
9+
<img src="<%= h asset_path('/img/icon.png') %>" width="100px" height="100px">
1010
</p>
1111
<h3>Help</h3>
1212
<p>
@@ -141,4 +141,3 @@ <h3>Help</h3>
141141
</p>
142142
</body>
143143
</html>
144-

‎public/index.html.erb‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<html>
22
<head>
33
<title>API Explorer for Slack</title>
4-
<script src="/scripts/jquery-1.7.1.min.js"></script>
5-
<script src="/scripts/url.min.js"></script>
6-
<script src="/scripts/register.js"></script>
7-
<script src="/scripts/stats.js"></script>
4+
<script src="<%= h asset_path('/scripts/jquery-1.7.1.min.js') %>"></script>
5+
<script src="<%= h asset_path('/scripts/url.min.js') %>"></script>
6+
<script src="<%= h asset_path('/scripts/register.js') %>"></script>
7+
<script src="<%= h asset_path('/scripts/stats.js') %>"></script>
88
</head>
99
<body style="text-align: center">
1010
<p>
11-
<img src='img/icon.png' width="100px" height="100px">
11+
<img src="<%= h asset_path('/img/icon.png') %>" width="100px" height="100px">
1212
</p>
1313
<p>
1414
<h3>Whoa, an API explorer for the Slack Web API.</h3>
@@ -19,7 +19,7 @@
1919
</p>
2020
<p id='active_teams_count'>&nbsp;</p>
2121
<p>
22-
<img src="img/dm.gif">
22+
<img src="<%= h asset_path('/img/dm.gif') %>">
2323
</p>
2424
<p>
2525
<a href="https://twitter.com/share" class="twitter-share-button"{count} data-text="Whoa, an API explorer for the Slack Web API!" data-via="dblockdotorg">Tweet</a>
@@ -43,4 +43,3 @@
4343
</p>
4444
</body>
4545
</html>
46-
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<body style="text-align: left; margin: 50px;">
88
<p style="text-align: center">
9-
<img src='img/icon.png' width="100px" height="100px">
9+
<img src="<%= h asset_path('/img/icon.png') %>" width="100px" height="100px">
1010
</p>
1111
<h3>tl;dr</h3>
1212
<p>

‎slack-api-explorer/api/middleware.rb‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ def self.instance
2323

2424
use Rack::Robotz, 'User-Agent' => '*', 'Disallow' => '/api'
2525

26-
use Rack::ServerPages
26+
use Rack::ServerPages do |pages|
27+
SlackRubyBotServer.config.server_pages&.call(pages)
28+
end
2729

2830
run Api::Middleware.new
2931
}.to_app

0 commit comments

Comments
 (0)