Fixes for proper production version
This commit is contained in:
		
							
								
								
									
										3
									
								
								Gemfile.lock
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										3
									
								
								Gemfile.lock
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							@@ -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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										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
 | 
			
		||||
      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
 | 
			
		||||
      "</script>"
 | 
			
		||||
    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)
 | 
			
		||||
        "<a href=\"#{uri.to_s}\">#{i}</a><br>"
 | 
			
		||||
      end.join("\n")
 | 
			
		||||
      puts listing
 | 
			
		||||
      [Header + listing + Footer]
 | 
			
		||||
    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
 | 
			
		||||
 | 
			
		||||
    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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										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
									
								
							
		Reference in New Issue
	
	Block a user