Fixes for proper production version
This commit is contained in:
parent
93d2f304d2
commit
a874f78f2a
3
Gemfile.lock
Normal file → Executable file
3
Gemfile.lock
Normal file → Executable file
@ -72,6 +72,7 @@ GEM
|
|||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
arm64-darwin-22
|
arm64-darwin-22
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
rackup
|
rackup
|
||||||
@ -82,4 +83,4 @@ DEPENDENCIES
|
|||||||
standard (~> 1.3)
|
standard (~> 1.3)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.15
|
2.4.19
|
||||||
|
0
config.example.yml
Normal file → Executable file
0
config.example.yml
Normal file → Executable file
16
lib/skeksis.rb
Normal file → Executable file
16
lib/skeksis.rb
Normal file → Executable file
@ -74,7 +74,7 @@ module Skeksis
|
|||||||
|
|
||||||
# Just do a directory listing if we're serving the root path
|
# Just do a directory listing if we're serving the root path
|
||||||
if path == "/"
|
if path == "/"
|
||||||
return create_dir_listing(@serve_dir, env)
|
return create_dir_listing(@serve_dir, env, check_subdirs=true)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Otherwise check if user's site has opted in to bridging
|
# Otherwise check if user's site has opted in to bridging
|
||||||
@ -106,7 +106,7 @@ module Skeksis
|
|||||||
end
|
end
|
||||||
|
|
||||||
def htmlize(data, env)
|
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
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -117,8 +117,10 @@ module Skeksis
|
|||||||
"</script>"
|
"</script>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_dir_listing(path, env)
|
def create_dir_listing(path, env, check_subdirs=false)
|
||||||
http = URI.parse(env['REQUEST_URI'])
|
#http = URI.parse(env['REQUEST_URI'])
|
||||||
|
|
||||||
|
puts env
|
||||||
|
|
||||||
unless Dir.each_child(path).include?('.directory-listing-ok')
|
unless Dir.each_child(path).include?('.directory-listing-ok')
|
||||||
return nil
|
return nil
|
||||||
@ -132,14 +134,16 @@ module Skeksis
|
|||||||
child_path = Pathname.new(path).join(i)
|
child_path = Pathname.new(path).join(i)
|
||||||
puts child_path
|
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
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
uri_path = Pathname.new(env['PATH_INFO']).join(i)
|
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)
|
||||||
"<a href=\"#{uri.to_s}\">#{i}</a><br>"
|
"<a href=\"#{uri.to_s}\">#{i}</a><br>"
|
||||||
end.join("\n")
|
end.join("\n")
|
||||||
|
puts listing
|
||||||
[Header + listing + Footer]
|
[Header + listing + Footer]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
5
lib/skeksis/htmlize.rb
Normal file → Executable file
5
lib/skeksis/htmlize.rb
Normal file → Executable file
@ -14,8 +14,9 @@ module Skeksis
|
|||||||
</html>
|
</html>
|
||||||
HTML
|
HTML
|
||||||
|
|
||||||
def htmlize(request_uri, proxied_uri=nil, port=80)
|
# TODO: Fix these method arguments so they don't depend on a rack env hash
|
||||||
@http = URI.parse(request_uri)
|
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?
|
unless proxied_uri.nil?
|
||||||
@proxied_uri = URI.parse(proxied_uri)
|
@proxied_uri = URI.parse(proxied_uri)
|
||||||
end
|
end
|
||||||
|
0
lib/skeksis/parser.rb
Normal file → Executable file
0
lib/skeksis/parser.rb
Normal file → Executable file
0
lib/skeksis/version.rb
Normal file → Executable file
0
lib/skeksis/version.rb
Normal file → Executable file
0
sig/skeksis.rbs
Normal file → Executable file
0
sig/skeksis.rbs
Normal file → Executable file
0
skeksis.gemspec
Normal file → Executable file
0
skeksis.gemspec
Normal file → Executable file
0
spec/skeksis_spec.rb
Normal file → Executable file
0
spec/skeksis_spec.rb
Normal file → Executable file
0
spec/spec_helper.rb
Normal file → Executable file
0
spec/spec_helper.rb
Normal file → Executable file
0
style/nord.css
Normal file → Executable file
0
style/nord.css
Normal file → Executable file
Loading…
Reference in New Issue
Block a user