<commit_before>require "rack"

module Rack::Webtranslateit
  def new(app, mount_point = "/translations/")
    builder = Rack::Builder.new
    builder.use Rack::Auth::Basic, &method(:authenticator) if Configuration.password
    builder.map(mount_point){ run Ui.new }
    builder.map("/"){ run app }
    builder.to_app
  end

  def authenticator(username, password)
    username == "admin" and password == <PASSWORD>
  end

  autoload :Configuration, "rack/webtranslateit/configuration"
  autoload :Ui, "rack/webtranslateit/ui"
  autoload :TranslationFile, "rack/webtranslateit/translation_file"

  extend self
end<commit_msg>Only auth our own requests.<commit_after>require "rack"

module Rack::Webtranslateit
  def new(app, mount_point = "/translations/")
    authenticator = method(:authenticator)
    builder = Rack::Builder.new
    builder.map(mount_point) do
      use Rack::Auth::Basic, &authenticator if Configuration.password
      run Ui.new
    end
    builder.map("/"){ run app }
    builder.to_app
  end

  def authenticator(username, password)
    username == "admin" and password == <PASSWORD>
  end

  autoload :Configuration, "rack/webtranslateit/configuration"
  autoload :Ui, "rack/webtranslateit/ui"
  autoload :TranslationFile, "rack/webtranslateit/translation_file"

  extend self
end
{'fraction_non_alphanumeric': 0.11273006134969325, 'fraction_numerical': 0.0, 'mean_word_length': 4.37037037037037, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7527031', 'n_tokens_mistral': 418, 'n_tokens_neox': 400, 'n_words': 95}