Skip to content

Commit

Permalink
Fix live views for ui development (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
spuun authored Oct 11, 2024
1 parent ac3e231 commit a05fb6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/lavinmq/http/controller/static.cr
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ module LavinMQ
{% else %}
private def serve(context, file_path)
Log.debug { "Serve #{file_path} from static?" }
File.open(File.join(PUBLIC_DIR, file_path)) do |file|
full_path = File.join(PUBLIC_DIR, file_path)
raise File::NotFoundError.new("file isn't a file", file: full_path) unless File.file?(full_path)
File.open(full_path) do |file|
Log.debug { "Serving static #{file_path}" }
file.read_buffering = false
etag = %(W/"#{Digest::MD5.hexdigest(file)}")
Expand Down
2 changes: 1 addition & 1 deletion src/lavinmq/http/http_server.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ module LavinMQ
handlers = [
StrictTransportSecurity.new,
AMQPWebsocket.new(@amqp_server),
ViewsController.new,
StaticController.new,
ViewsController.new,
ApiErrorHandler.new,
AuthHandler.new(@amqp_server),
PrometheusController.new(@amqp_server),
Expand Down

0 comments on commit a05fb6b

Please sign in to comment.