diff --git a/Gemfile b/Gemfile old mode 100644 new mode 100755 diff --git a/Gemfile.lock b/Gemfile.lock old mode 100644 new mode 100755 index 994f7a3..74f5f82 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -72,6 +72,7 @@ GEM PLATFORMS arm64-darwin-22 + x86_64-linux DEPENDENCIES rackup @@ -82,4 +83,4 @@ DEPENDENCIES standard (~> 1.3) BUNDLED WITH - 2.4.15 + 2.4.19 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/Rakefile b/Rakefile old mode 100644 new mode 100755 diff --git a/config.example.yml b/config.example.yml old mode 100644 new mode 100755 diff --git a/config.ru b/config.ru old mode 100644 new mode 100755 diff --git a/lib/skeksis.rb b/lib/skeksis.rb old mode 100644 new mode 100755 index c4e8161..4304407 --- a/lib/skeksis.rb +++ b/lib/skeksis.rb @@ -74,7 +74,7 @@ module Skeksis # Just do a directory listing if we're serving the root path if path == "/" - return create_dir_listing(@serve_dir, env) + return create_dir_listing(@serve_dir, env, check_subdirs=true) end # Otherwise check if user's site has opted in to bridging @@ -106,7 +106,7 @@ module Skeksis end def htmlize(data, env) - Skeksis::Parser.parse(data, strip_blanks=true).htmlize(env['REQUEST_URI'], @gemini_uri) + Skeksis::Parser.parse(data, strip_blanks=true).htmlize(env, @gemini_uri) end private @@ -117,8 +117,10 @@ module Skeksis "" end - def create_dir_listing(path, env) - http = URI.parse(env['REQUEST_URI']) + def create_dir_listing(path, env, check_subdirs=false) + #http = URI.parse(env['REQUEST_URI']) + + puts env unless Dir.each_child(path).include?('.directory-listing-ok') return nil @@ -132,14 +134,16 @@ module Skeksis child_path = Pathname.new(path).join(i) puts child_path - if Dir.exist?(child_path) and not Dir.each_child(child_path).include?('.serve_ok') + if check_subdirs and Dir.exist?(child_path) and not Dir.each_child(child_path).include?('.serve_ok') next end uri_path = Pathname.new(env['PATH_INFO']).join(i) - uri = URI::HTTP.build(host: http.host, port: http.port, path: uri_path.to_s) + puts "uri_path: #{uri_path.to_s}" + uri = URI::HTTP.build(host: env['HTTP_HOST'], port: env['SERVER_PORT'], path: uri_path.to_s) "#{i}
" end.join("\n") + puts listing [Header + listing + Footer] end end diff --git a/lib/skeksis/htmlize.rb b/lib/skeksis/htmlize.rb old mode 100644 new mode 100755 index 9e8d788..6466b4f --- a/lib/skeksis/htmlize.rb +++ b/lib/skeksis/htmlize.rb @@ -14,8 +14,9 @@ module Skeksis HTML - def htmlize(request_uri, proxied_uri=nil, port=80) - @http = URI.parse(request_uri) + # TODO: Fix these method arguments so they don't depend on a rack env hash + def htmlize(env, proxied_uri=nil, port=80) + @http = URI::HTTP.build(host: env['HTTP_HOST'], port: env['SERVER_PORT'], path: env['PATH_INFO']) unless proxied_uri.nil? @proxied_uri = URI.parse(proxied_uri) end diff --git a/lib/skeksis/parser.rb b/lib/skeksis/parser.rb old mode 100644 new mode 100755 diff --git a/lib/skeksis/version.rb b/lib/skeksis/version.rb old mode 100644 new mode 100755 diff --git a/sig/skeksis.rbs b/sig/skeksis.rbs old mode 100644 new mode 100755 diff --git a/skeksis.gemspec b/skeksis.gemspec old mode 100644 new mode 100755 diff --git a/spec/skeksis_spec.rb b/spec/skeksis_spec.rb old mode 100644 new mode 100755 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb old mode 100644 new mode 100755 diff --git a/style/nord.css b/style/nord.css old mode 100644 new mode 100755