<commit_before>class SiteController < Controller
  map '/site'

  helper :stack, :user

  def track
    if ! logged_in?
      redirect MainController.r( :login )
    end

    site = request[ 'site' ]

    uri = Ramalytics::URI.parse_and_ensure_exists( site )
    if uri.nil?
      flash[ :error ] = "Failed to parse site. (#{site})"
      redirect_referrer
    end

    access = SubdomainAccess[ subdomain_id: uri.subdomain_id, user_id: user.id ]
    if access
      flash[ :error ] = 'You already have or requested access to that subdomain.'
    else
      access = SubdomainAccess.create(
        subdomain_id: uri.subdomain_id,
        user_id: user.id,
        challenge: 'ramalytics-' + Digest::SHA1.hexdigest( Ramalytics.options.salt + Time.now.to_s )[ 0..16 ] + '.html'
      )
      if access
        flash[ :success ] = "Access request accepted.  Please create the challenge file (#{access.challenge_uri}), then click Verify."
      else
        flash[ :error ] = "Access request failed.  Please try again."
      end
    end

    redirect_referrer
  end<commit_msg>Fixed /site/track: uri.subdomain_id -> uri.subdomain.id<commit_after>class SiteController < Controller
  map '/site'

  helper :stack, :user

  def track
    if ! logged_in?
      redirect MainController.r( :login )
    end

    site = request[ 'site' ]

    uri = Ramalytics::URI.parse_and_ensure_exists( site )
    if uri.nil?
      flash[ :error ] = "Failed to parse site. (#{site})"
      redirect_referrer
    end

    access = SubdomainAccess[ subdomain_id: uri.subdomain.id, user_id: user.id ]
    if access
      flash[ :error ] = 'You already have or requested access to that subdomain.'
    else
      access = SubdomainAccess.create(
        subdomain_id: uri.subdomain.id,
        user_id: user.id,
        challenge: 'ramalytics-' + Digest::SHA1.hexdigest( Ramalytics.options.salt + Time.now.to_s )[ 0..16 ] + '.html'
      )
      if access
        flash[ :success ] = "Access request accepted.  Please create the challenge file (#{access.challenge_uri}), then click Verify."
      else
        flash[ :error ] = "Access request failed.  Please try again."
      end
    end

    redirect_referrer
  end
{'fraction_non_alphanumeric': 0.10675182481751824, 'fraction_numerical': 0.0036496350364963502, 'mean_word_length': 2.612850082372323, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '2711920', 'n_tokens_mistral': 695, 'n_tokens_neox': 674, 'n_words': 192}