<commit_before>require 'sinatra'

$BTTRACK_ROOT = File.dirname(File.expand_path(__FILE__))
$LOAD_PATH << "#{$BTTRACK_ROOT}/lib"

require 'bttrack/config'
require 'bttrack/request'
require 'config/config' if File.exists?("#{$BTTRACK_ROOT}/config/config.rb")

helpers do
  def req
    Bttrack::Request.new(params.merge(
      :remote_ip => request.ip
    ))
  end
end

error do
  request.env['sinatra.error'].message
end

get '/' do
  @version = `cat VERSION`
  erb :index
end

get '/announce' do<commit_msg>read VERSION file using full path<commit_after>require 'sinatra'

$BTTRACK_ROOT = File.dirname(File.expand_path(__FILE__))
$LOAD_PATH << "#{$BTTRACK_ROOT}/lib"

require 'bttrack/config'
require 'bttrack/request'
require 'config/config' if File.exists?("#{$BTTRACK_ROOT}/config/config.rb")

helpers do
  def req
    Bttrack::Request.new(params.merge(
      :remote_ip => request.ip
    ))
  end
end

error do
  request.env['sinatra.error'].message
end

get '/' do
  @version = `cat #{$BTTRACK_ROOT}/VERSION`
  erb :index
end

get '/announce' do
{'fraction_non_alphanumeric': 0.14775977121067682, 'fraction_numerical': 0.0, 'mean_word_length': 4.555555555555555, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2161195', 'n_tokens_mistral': 382, 'n_tokens_neox': 385, 'n_words': 80}